Index: contrib/README
===================================================================
--- contrib/README	(revision 327)
+++ contrib/README	(revision 328)
@@ -7,4 +7,11 @@
 	on the last modification time. Thought I might share it if other people find
 	it useful for their own project...
+
+
+- debian : This directory contains the packaging information to create native Debian / Ubuntu 
+	packages. It requires debhelper >= 7.3.9 (support for cmake). To use, simply link the
+	debian folder from the main freeDiameter folder, then use your building script as
+	usual ('dh binary' or 'pdebuild' or ...).
+
 
 - PKI : This directory contains useful material related to establishing a 
@@ -29,4 +36,5 @@
 		that provides more or less the same services as ca_script.
 
+
 - OpenWRT : This directory contains the scripts and documentation related to 
 	the integration of freeDiameter RADIUS/Diameter gateway component in the openWRT
Index: contrib/debian/changelog
===================================================================
--- contrib/debian/changelog	(revision 328)
+++ contrib/debian/changelog	(revision 328)
@@ -0,0 +1,5 @@
+freediameter (1.0.0-1) experimental; urgency=low
+
+  * Initial Release.
+  
+ -- Sebastien Decugis <sdecugis@nict.go.jp>  Wed, 19 May 2010 15:36:54 +0900
Index: contrib/debian/compat
===================================================================
--- contrib/debian/compat	(revision 328)
+++ contrib/debian/compat	(revision 328)
@@ -0,0 +1,1 @@
+7
Index: contrib/debian/control
===================================================================
--- contrib/debian/control	(revision 328)
+++ contrib/debian/control	(revision 328)
@@ -0,0 +1,122 @@
+Source: freediameter
+Section: unknown
+Priority: optional
+Maintainer: Sebastien Decugis <sdecugis@nict.go.jp>
+Build-Depends: debhelper ( >= 7.3.9),
+ cmake, make, gcc, bison, flex,
+ libsctp-dev, libgnutls-dev, libgcrypt-dev, libpq-dev
+Standards-Version: 3.8.3
+Homepage: http://aaa.koganei.wide.ad.jp
+
+Package: freediameter-common
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: The libfreeDiameter library.
+ This library is required by all freeDiameter components.
+ It may also be useful for other projects which need to 
+ perform operations on Diameter messages. 
+ .
+ See 'freeDiameter-dev' package to retrieve the API for the library.
+
+Package: freediameter-dev
+Architecture: any
+Depends: freediameter-daemon (= ${binary:Version}), libsctp-dev, libgnutls-dev, libgcrypt-dev
+Description: This package provides the development files for freeDiameter.
+
+Package: freediameter-daemon
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, freediameter-common (= ${binary:Version})
+Suggests: ssl-cert, freediameter-dictionary-rfc4005, freediameter-dictionary-rfc4072
+Description: The freeDiameter daemon. 
+ The freeDiameter daemon provides support for the Diameter
+ Base Protocol. Without any extension, the daemon can only
+ be used as a Diameter routing agent. You probably want to 
+ install some freeDiameter extension(s) to extend its 
+ features.
+ .
+ The daemon is shipped with a small set of extensions, for
+ example to configure the routing behavior. See the 
+ examples for more details.
+
+Package: freediameter-debug-tools
+Architecture: any
+Depends: ${misc:Depends}, freediameter-daemon (= ${binary:Version})
+Description: freeDiameter debug tools.
+ This package provides useful tools to help tracking 
+ problems in freeDiameter installation.
+
+Package: freediameter-dictionary-rfc4005
+Architecture: any
+Depends: ${misc:Depends}, freediameter-daemon (= ${binary:Version})
+Description: RFC4005 (NASREQ) dictionary support.
+ This freeDiameter extension provides the dictionary support
+ for commands and AVP defined in RFC4005 (NASREQ).
+ .
+ In order to use this extension, your main freeDiameter 
+ configuration file must contain a LoadExtension directive. 
+ See freeDiameter documentation for more details. 
+ .
+ This extension does not require a configuration file.
+
+Package: freediameter-dictionary-rfc4072
+Architecture: any
+Depends: ${misc:Depends}, freediameter-dictionary-rfc4005 (= ${binary:Version})
+Description: RFC4072 (Diameter EAP) dictionary support.
+ This freeDiameter extension provides the dictionary support
+ for commands and AVP defined in RFC4072 (Diameter EAP).
+ .
+ In order to use this extension, your main freeDiameter 
+ configuration file must contain a LoadExtension directive. 
+ See freeDiameter documentation for more details. 
+ .
+ This extension does not require a configuration file.
+
+Package: freediameter-radius-gateway
+Architecture: any
+Depends: ${misc:Depends}, freediameter-dictionary-rfc4072 (= ${binary:Version})
+Description: RADIUS/Diameter extensible gateway.
+ This freeDiameter extension implements a RADIUS to Diameter
+ gateway. It allows a RADIUS client to connect to a Diameter
+ server.
+ .
+ The support for specific Diameter applications and/or RADIUS 
+ extensions is provided in the gateway by the use of plugins.
+ Currently, the following plugins are available:
+  - echodrop.rgwx : drop or echo a RADIUS attribute. 
+                    The attribute is not converted to Diameter.
+		    See echodrop.rgwx.conf.sample for details.
+  - auth.rgwx : Convert Access-Request to Diameter AAR or DER.
+                Requests For Comments: RADIUS: 2865, 3162, 2868,
+		2869, 3579; Diameter: 4005, 4072.
+  - acct.rgwx : Converts Accounting-Request (2866) to Diameter 
+                ACR (3588).
+ .
+ In order to use this extension, your main freeDiameter 
+ configuration file must contain a LoadExtension directive. 
+ See freeDiameter documentation for more details. 
+ .
+ This extension requires a configuration file.
+ See app_radgw.conf.sample for more details.
+
+Package: freediameter-accounting-server
+Architecture: any
+Depends: ${misc:Depends}, freediameter-daemon (= ${binary:Version}), libpq5
+Description: freeDiameter simple Accounting server.
+ This freeDiameter extension implements the Diameter Base 
+ Accounting application. It saves the accounting records
+ in a PostgreSQL database backend in a highly configurable
+ maneer.
+ .
+ In order to use this extension, your main freeDiameter 
+ configuration file must contain a LoadExtension directive. 
+ See freeDiameter documentation for more details. 
+ .
+ This extension requires a configuration file.
+ See app_acct.conf.sample for more details.
+
+
+
+
+
+
+
Index: contrib/debian/copyright
===================================================================
--- contrib/debian/copyright	(revision 328)
+++ contrib/debian/copyright	(revision 328)
@@ -0,0 +1,35 @@
+Format-Specification: http://dep.debian.net/deps/dep5/
+Name: freeDiameter
+Maintainer: Sebastien Decugis <sdecugis@nict.go.jp>
+Source: http://aaa.koganei.wide.ad.jp
+
+Files: *
+Copyright: 2008-2010, WIDE Project and NICT.
+License: BSD
+ Redistribution and use of this software in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+ .
+ * Redistributions of source code must retain the above
+   copyright notice, this list of conditions and the
+   following disclaimer.
+ . 
+ * Redistributions in binary form must reproduce the above
+   copyright notice, this list of conditions and the
+   following disclaimer in the documentation and/or other
+   materials provided with the distribution.
+ .
+ * Neither the name of the WIDE Project or NICT nor the
+   names of its contributors may be used to endorse or
+   promote products derived from this software without
+   specific prior written permission of WIDE Project and
+   NICT.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
Index: contrib/debian/dirs
===================================================================
--- contrib/debian/dirs	(revision 328)
+++ contrib/debian/dirs	(revision 328)
@@ -0,0 +1,1 @@
+etc/freeDiameter/
Index: contrib/debian/docs
===================================================================
--- contrib/debian/docs	(revision 328)
+++ contrib/debian/docs	(revision 328)
@@ -0,0 +1,3 @@
+INSTALL*
+LICENSE
+README
Index: contrib/debian/freediameter-accounting-server.examples
===================================================================
--- contrib/debian/freediameter-accounting-server.examples	(revision 328)
+++ contrib/debian/freediameter-accounting-server.examples	(revision 328)
@@ -0,0 +1,1 @@
+doc/app_acct.conf.sample
Index: contrib/debian/freediameter-accounting-server.install
===================================================================
--- contrib/debian/freediameter-accounting-server.install	(revision 328)
+++ contrib/debian/freediameter-accounting-server.install	(revision 328)
@@ -0,0 +1,1 @@
+usr/lib/freeDiameter/app_acct.fdx
Index: contrib/debian/freediameter-common.install
===================================================================
--- contrib/debian/freediameter-common.install	(revision 328)
+++ contrib/debian/freediameter-common.install	(revision 328)
@@ -0,0 +1,1 @@
+usr/lib/libfreeDiameter.so*
Index: contrib/debian/freediameter-daemon.default
===================================================================
--- contrib/debian/freediameter-daemon.default	(revision 328)
+++ contrib/debian/freediameter-daemon.default	(revision 328)
@@ -0,0 +1,7 @@
+# Defaults for freediameter initscript
+# sourced by /etc/init.d/freediameter
+# installed at /etc/default/freediameter by the maintainer scripts
+
+# Additional options that are passed to the Daemon.
+# See "freeDiameterd --help" for supported flags.
+DAEMON_OPTS=""
Index: contrib/debian/freediameter-daemon.examples
===================================================================
--- contrib/debian/freediameter-daemon.examples	(revision 328)
+++ contrib/debian/freediameter-daemon.examples	(revision 328)
@@ -0,0 +1,3 @@
+doc/freediameter.conf.sample
+doc/acl_wl.conf.sample
+doc/rt_default.conf.sample
Index: contrib/debian/freediameter-daemon.init
===================================================================
--- contrib/debian/freediameter-daemon.init	(revision 328)
+++ contrib/debian/freediameter-daemon.init	(revision 328)
@@ -0,0 +1,160 @@
+#! /bin/sh
+
+### BEGIN INIT INFO
+# Provides:          freediameter
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Short-Description: Start freeDiameter daemon at boot time
+# Description:       Start the freeDiameter daemon at boot time.
+#	freeDiameter is an extensible implementation of the Diameter protocol,
+#	designed for Authentication, Authorization and Accounting. Diameter is
+#	an evolution of the RADIUS protocol.
+### END INIT INFO#
+
+DAEMON=/usr/bin/freeDiameterd
+CONF=/etc/freeDiameter/freeDiameter.conf
+NAME=freediameter
+DESC=freeDiameter daemon
+
+test -x $DAEMON || exit 0
+
+LOGDIR=/var/log/freediameter
+PIDFILE=/var/run/$NAME.pid
+DODTIME=30                  # Time to wait for the server to die, in seconds
+                            # The value is high because we wait for STA answers
+			    # before disconnecting the peers.
+
+# Include freediameter defaults if available
+if [ -f /etc/default/freediameter ] ; then
+    . /etc/default/freediameter
+fi
+
+test x"" != x$DAEMON_OPTS || test -f $CONF || exit 0
+
+set -e
+
+running_pid()
+{
+    # Check if a given process pid's cmdline matches a given name
+    pid=$1
+    name=$2
+    [ -z "$pid" ] && return 1
+    [ ! -d /proc/$pid ] &&  return 1
+    cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1`
+    # Is this the expected child?
+    [ "$cmd" != "$name" ] &&  return 1
+    return 0
+}
+
+running()
+{
+# Check if the process is running looking at /proc
+# (works for all users)
+
+    # No pidfile, probably no daemon present
+    [ ! -f "$PIDFILE" ] && return 1
+    # Obtain the pid and check it against the binary name
+    pid=`cat $PIDFILE`
+    running_pid $pid $DAEMON || return 1
+    return 0
+}
+
+force_stop() {
+# Forcefully kill the process
+    [ ! -f "$PIDFILE" ] && return
+    if running ; then
+        kill -15 $pid
+        # Is it really dead?
+        [ -n "$DODTIME" ] && sleep "$DODTIME"s
+        if running ; then
+            kill -9 $pid
+            [ -n "$DODTIME" ] && sleep "$DODTIME"s
+            if running ; then
+                echo "Cannot kill $LABEL (pid=$pid)!"
+                exit 1
+            fi
+        fi
+    fi
+    rm -f $PIDFILE
+    return 0
+}
+
+case "$1" in
+  start)
+        echo -n "Starting $DESC: "
+        start-stop-daemon --start --quiet --pidfile $PIDFILE \
+            --exec $DAEMON -- $DAEMON_OPTS
+        if running ; then
+            echo "$NAME."
+        else
+            echo " ERROR."
+        fi
+        ;;
+  stop)
+        echo -n "Stopping $DESC: "
+        start-stop-daemon --stop --quiet --pidfile $PIDFILE \
+            --exec $DAEMON
+        echo "$NAME."
+        ;;
+  force-stop)
+        echo -n "Forcefully stopping $DESC: "
+        force_stop
+        if ! running ; then
+            echo "$NAME."
+        else
+            echo " ERROR."
+        fi
+        ;;
+  #reload)
+        #
+        # If the daemon can reload its config files on the fly
+        # for example by sending it SIGHUP, do it here.
+        #
+        # If the daemon responds to changes in its config file
+        # directly anyway, make this a do-nothing entry.
+        #
+        # echo "Reloading $DESC configuration files."
+        # start-stop-daemon --stop --signal 1 --quiet --pidfile \
+        #       /var/run/$NAME.pid --exec $DAEMON
+  #;;
+  force-reload)
+        #
+        # If the "reload" option is implemented, move the "force-reload"
+        # option to the "reload" entry above. If not, "force-reload" is
+        # just the same as "restart" except that it does nothing if the
+        # daemon isn't already running.
+        # check wether $DAEMON is running. If so, restart
+        start-stop-daemon --stop --test --quiet --pidfile \
+            /var/run/$NAME.pid --exec $DAEMON \
+            && $0 restart \
+            || exit 0
+        ;;
+  restart)
+    echo -n "Restarting $DESC: "
+        start-stop-daemon --stop --quiet --pidfile \
+            /var/run/$NAME.pid --exec $DAEMON
+        [ -n "$DODTIME" ] && sleep $DODTIME
+        start-stop-daemon --start --quiet --pidfile \
+            /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
+        echo "$NAME."
+        ;;
+  status)
+    echo -n "$LABEL is "
+    if running ;  then
+        echo "running"
+    else
+        echo " not running."
+        exit 1
+    fi
+    ;;
+  *)
+    N=/etc/init.d/$NAME
+    # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
+    echo "Usage: $N {start|stop|restart|force-reload|status|force-stop}" >&2
+    exit 1
+    ;;
+esac
+
+exit 0
Index: contrib/debian/freediameter-daemon.install
===================================================================
--- contrib/debian/freediameter-daemon.install	(revision 328)
+++ contrib/debian/freediameter-daemon.install	(revision 328)
@@ -0,0 +1,3 @@
+usr/bin/freeDiameterd*
+usr/lib/freeDiameter/acl_wl.fdx
+usr/lib/freeDiameter/rt_default.fdx
Index: contrib/debian/freediameter-debug-tools.examples
===================================================================
--- contrib/debian/freediameter-debug-tools.examples	(revision 328)
+++ contrib/debian/freediameter-debug-tools.examples	(revision 328)
@@ -0,0 +1,1 @@
+doc/test_app.conf.sample
Index: contrib/debian/freediameter-debug-tools.install
===================================================================
--- contrib/debian/freediameter-debug-tools.install	(revision 328)
+++ contrib/debian/freediameter-debug-tools.install	(revision 328)
@@ -0,0 +1,3 @@
+usr/lib/freeDiameter/dbg_rt.fdx
+usr/lib/freeDiameter/dbg_monitor.fdx
+usr/lib/freeDiameter/test_app.fdx
Index: contrib/debian/freediameter-dev.install
===================================================================
--- contrib/debian/freediameter-dev.install	(revision 328)
+++ contrib/debian/freediameter-dev.install	(revision 328)
@@ -0,0 +1,1 @@
+usr/include/freeDiameter/*
Index: contrib/debian/freediameter-dictionary-rfc4005.install
===================================================================
--- contrib/debian/freediameter-dictionary-rfc4005.install	(revision 328)
+++ contrib/debian/freediameter-dictionary-rfc4005.install	(revision 328)
@@ -0,0 +1,1 @@
+usr/lib/freeDiameter/dict_nasreq.fdx
Index: contrib/debian/freediameter-dictionary-rfc4072.install
===================================================================
--- contrib/debian/freediameter-dictionary-rfc4072.install	(revision 328)
+++ contrib/debian/freediameter-dictionary-rfc4072.install	(revision 328)
@@ -0,0 +1,1 @@
+usr/lib/freeDiameter/dict_eap.fdx
Index: contrib/debian/freediameter-radius-gateway.examples
===================================================================
--- contrib/debian/freediameter-radius-gateway.examples	(revision 328)
+++ contrib/debian/freediameter-radius-gateway.examples	(revision 328)
@@ -0,0 +1,2 @@
+doc/app_radgw.conf.sample
+doc/echodrop.rgwx.conf.sample
Index: contrib/debian/freediameter-radius-gateway.install
===================================================================
--- contrib/debian/freediameter-radius-gateway.install	(revision 328)
+++ contrib/debian/freediameter-radius-gateway.install	(revision 328)
@@ -0,0 +1,2 @@
+usr/lib/freeDiameter/app_radgw.fdx
+usr/lib/freeDiameter/*.rgwx
Index: contrib/debian/rules
===================================================================
--- contrib/debian/rules	(revision 328)
+++ contrib/debian/rules	(revision 328)
@@ -0,0 +1,36 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+#
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+#
+# Modified to make a template file for a multi-binary package with separated
+# build-arch and build-indep targets  by Bill Allombert 2001
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This has to be exported to make some magic below work.
+export DH_OPTIONS
+
+# Uncomment this to run the tests when the package is built
+# compile_the_tests=-DSKIP_TESTS:BOOL=OFF
+
+%:
+	dh  $@
+
+override_dh_auto_configure:
+	dh_auto_configure -- $(compile_the_tests) \
+		-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
+		-DDEFAULT_CONF_PATH:PATH=/etc/freeDiameter \
+		-DBUILD_APP_ACCT:BOOL=ON \
+		-DBUILD_APP_RADGW:BOOL=ON \
+		-DBUILD_DBG_MONITOR:BOOL=ON \
+		-DBUILD_DBG_RT:BOOL=ON \
+		-DBUILD_TEST_APP:BOOL=ON \
+		-DBUILD_APP_ACCT:BOOL=ON
+		
+
