aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-07-09 20:59:35 +0200
committerHarald Welte <laforge@gnumonks.org>2010-07-09 20:59:35 +0200
commit283f8ffe840b3eba9d55e6bf5affdf6fd9d998e1 (patch)
tree2486b9b7c6925456811f8215d5e3a90a971c5013
parent3b3b534da81fbe127cb704918eb5974156686725 (diff)
update to sualibrary-0.1.5 released 2006-10-10HEADmaster
* In addition to 1.4 Contains : * Correct some issues with newer GCC compilers. * Correct some bugs * Compiles and runs on Linux, FreeBSD, Max OS X .... * Tested on IPv4 and IPV6 networks * interoperable with other SUA implementations * corresponds to RFC3868 * requires SCTP implementation sctplib-1.0.5 from www.sctp.de
-rw-r--r--configure.in115
-rw-r--r--sualibrary/Makefile.am3
-rw-r--r--sualibrary/sua/Makefile.am6
-rw-r--r--sualibrary/sua/sua.h1
-rw-r--r--sualibrary/sua/sua_adapt.cpp2
-rw-r--r--sualibrary/sua/sua_asp_mgnt.cpp22
-rw-r--r--sualibrary/sua/sua_cl.cpp2
-rw-r--r--sualibrary/sua/sua_co.cpp3
-rw-r--r--sualibrary/sua/sua_distribution.cpp2
-rw-r--r--sualibrary/sua/sua_distribution.h2
-rw-r--r--sualibrary/sua/sua_file.cpp3
-rw-r--r--sualibrary/sua/sua_logging.cpp2
-rw-r--r--sualibrary/sua/sua_snm_mgnt.cpp7
13 files changed, 56 insertions, 114 deletions
diff --git a/configure.in b/configure.in
index aaa89e1..22626af 100644
--- a/configure.in
+++ b/configure.in
@@ -1,6 +1,4 @@
-AC_PREREQ(2.12)
-AC_COPYRIGHT(test)
-
+# proces this file with autoconf
rm -f config.cache
AC_INIT(acconfig.h)
@@ -8,20 +6,14 @@ AC_INIT(acconfig.h)
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
-AM_INIT_AUTOMAKE(sualibrary,0.1.4)
-
-AC_PREFIX_DEFAULT(/usr/local)
-if test "x$prefix" = "xNONE"; then
- prefix=$ac_default_prefix
- ac_configure_args="$ac_configure_args --prefix $prefix"
-fi
+AM_INIT_AUTOMAKE(sualibrary,0.1.5)
-# keep this order because automake gets confused apart from the authors
AM_CONFIG_HEADER(config.h:config.h.in)
# Checks for programs.
AC_PROG_AWK
AC_PROG_CC
+AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_CXX
@@ -30,7 +22,7 @@ AC_PROG_RANLIB
# Checks for libraries.
# create only shared libtool-libraries (add --enable-shared)
-AC_ENABLE_SHARED(no)
+AC_ENABLE_SHARED(yes)
# AM_DISABLE_SHARED
# set the following to yes, if you want to create static
@@ -60,17 +52,21 @@ all_includes="$all_includes $USER_INCLUDES"
AC_SUBST(all_includes)
AC_SUBST(all_libraries)
AC_SUBST(AUTODIRS)
+AC_SUBST(ac_aux_dir)
-# Checks for header files.
+AC_SUBST(CHECKERGCC,[checkergcc])
+# Checks for header files.
AC_HEADER_STDC
AC_HEADER_TIME
-AC_CHECK_HEADERS(strings.h sys/file.h sys/time.h unistd.h netinet/in.h netdb.h \
-sys/socket.h netinet/icmp6.h)
+AC_CHECK_HEADERS([stdlib.h string.h])
+AC_CHECK_HEADERS(strings.h sys/file.h sys/time.h unistd.h)
+AC_CHECK_HEADERS( netinet/in.h netdb.h sys/socket.h netinet/icmp6.h)
AC_CHECK_HEADERS(sys/poll.h, AC_DEFINE(HAVE_SYS_POLL_H))
# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
# ----------------------
# Packages configuration - Blatantly stolen from zebra !
@@ -198,94 +194,34 @@ AC_TRY_COMPILE([#include <sys/types.h>
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
-# This is taken from the ethereal configuration scripts.
-# We check whether user wants to build gtk-based programs
-# These need to be enabled explicitly
-GTK_OK=yes
-
-# GTK checks
-# We don't add $GLIB_LIBS to LIBS, because we don't want to force all
-# programs to be built with GTK+.
-#
+# Checks for library functions.
+AC_CHECK_LIB(socket, socket)
+AC_CHECK_LIB(nsl, gethostbyname)
+# removed libefence....this should be used though, when we REALLY debug :-)
+AC_CHECK_LIB(efence, malloc)
-AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no)
-if test "x$GTK_OK" = "xno" ; then
- AC_MSG_RESULT(GTK distribution not found - disabling sctpd compilation.)
- AC_MSG_RESULT(On FreeBSD, you might want to do: ln -s gtk12-config gtk-config)
-fi
+AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP)])
+AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
+AC_CHECK_LIB(c, inet_aton, [AC_DEFINE(HAVE_INET_ATON)])
-# GLib checks
-# This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
-# GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
-# However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
-# set when generating the Makefile, so we can make programs that require
-# only GLib link with @GLIB_LIBS@ and make programs that require GTK+
-# link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
-# We don't add $GLIB_LIBS to LIBS, because we don't want to force all
-# programs to be built with GLib.
-#
+# GLib & SCTPlib checks
enable_sctpd="no"
-# gtkprogs_bin=""
sctpd_SUBDIRS=""
+
# Honor GLIB_CFLAGS
AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found. On FreeBSD do: ln -s glib12-config glib-config), gmodule)
+glib_LIBS="$GLIB_LIBS"
+AC_SUBST(glib_LIBS)
-#AC_SUBST(gtkprogs_bin)
-AC_SUBST(sctp_SUBDIRS)
-
-
-# Checks for library functions.
-AC_CHECK_LIB(socket, socket)
-AC_CHECK_LIB(nsl, gethostbyname)
-AC_CHECK_LIB(sctp, sctp_eventloop)
-
-# removed libefence....this should be used though, when we REALLY debug :-)
-AC_CHECK_LIB(efence, malloc)
AC_CHECK_LIB(glib, g_main_add_poll)
+sctp_LIBS="-L/usr/local/lib -lsctplib"
-AC_CHECK_HEADERS(ncurses.h, AC_DEFINE(HAVE_NCURSES_H))
-# AC_CHECK_HEADERS(curses.h, AC_DEFINE(HAVE_CURSES_H))
-AC_CHECK_LIB(ncurses, initscr, found_ncurses_lib=yes,found_ncurses_lib=no)
-
-if test "x$found_ncurses_lib" = "xyes" -a "x$ac_cv_header_ncurses_h" = "xyes" ; then
- curses_LIBS="-lncurses"
- # CPPFLAGS="$CPPFLAGS -I/usr/include/ncurses.h"
- cursesprogs_BIN="monitor chat echo_monitor"
-else
-# AC_CHECK_LIB(curses, initscr, found_curses_lib=yes,found_curses_lib=no)
-# if test "x$found_curses_lib" = "xyes" -a "x$ac_cv_header_curses_h" = "xyes" ; then
-# curses_LIBS="-lcurses"
- # CPPFLAGS="$CPPFLAGS -I/usr/include/curses.h"
-# cursesprogs_BIN="monitor chat echo_monitor"
-# else
- cursesprogs_BIN=""
- curses_LIBS=""
- AC_MSG_WARN(nCurses libraries seem to be missing. Not compiling Curses-Programs! Please contact ajung@exp-math.uni-essen.de in case this test should not have failed!)
-# fi
-fi
-AC_SUBST(cursesprogs_BIN)
-AC_SUBST(curses_LIBS)
-
-if test "$GTK_OK" = "yes" ; then
- sctp_LIBS="-L/usr/local/lib/ -lsctp"
- gtk_LIBS="$GTK_LIBS"
- glib_LIBS="$GLIB_LIBS"
-else
- sctp_LIBS="-L/usr/local/lib/ -lsctp"
- gtk_LIBS=""
- glib_LIBS="$GLIB_LIBS"
-fi
+AC_CHECK_LIB(sctplib, sctp_eventLoop)
AC_SUBST(sctp_LIBS)
-AC_SUBST(gtk_LIBS)
-AC_SUBST(glib_LIBS)
-
-AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP)])
-AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
-AC_CHECK_LIB(c, inet_aton, [AC_DEFINE(HAVE_INET_ATON)])
# Checks for library functions.
AC_FUNC_VPRINTF
@@ -293,6 +229,7 @@ AC_FUNC_MEMCMP
AC_CHECK_FUNCS(gettimeofday socket strerror poll getuid setuid geteuid random)
AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
+CFLAGS="$CFLAGS -D_REENTRANT -D_THREAD_SAFE"
# checks for host/build/target system type
AC_CANONICAL_HOST
diff --git a/sualibrary/Makefile.am b/sualibrary/Makefile.am
index 4d788e8..8ae86c4 100644
--- a/sualibrary/Makefile.am
+++ b/sualibrary/Makefile.am
@@ -5,6 +5,3 @@ SUBDIRS = docs sua testup
####### kdevelop will overwrite this part!!! (end)############
-SUBDIRS = docs sua testup
-
-
diff --git a/sualibrary/sua/Makefile.am b/sualibrary/sua/Makefile.am
index 85b480e..cbda082 100644
--- a/sualibrary/sua/Makefile.am
+++ b/sualibrary/sua/Makefile.am
@@ -20,8 +20,12 @@ include_HEADERS = sua.h
INCLUDES = -I/usr/local/include
#build a libtool library for installation in libdir
+
lib_LTLIBRARIES = libsua.la
-libsua_la_SOURCES = sua_tcb.cpp sua_syntax.cpp sua_sual.cpp sua_logging.cpp sua_file.cpp sua_distribution.cpp sua_dataname.cpp sua_database.cpp sua_co.cpp sua_datassoc.cpp sua_cl.cpp sua_asp_mgnt.cpp sua_adapt.cpp sua_snm_mgnt.cpp
+
+AUTOMAKE_OPTIONS = no-dependencies
+
+libsua_la_SOURCES = sua_snm_mgnt.cpp sua_tcb.cpp sua_syntax.cpp sua_sual.cpp sua_logging.cpp sua_file.cpp sua_distribution.cpp sua_dataname.cpp sua_database.cpp sua_co.cpp sua_datassoc.cpp sua_cl.cpp sua_asp_mgnt.cpp sua_adapt.cpp
libsua_la_LDFLAGS = -no-undefined -version-info $(SOMAJOR):$(SOMINOR):$(SOSUBMINOR) $(LDFLAGS)
diff --git a/sualibrary/sua/sua.h b/sualibrary/sua/sua.h
index 9c70744..cda1b76 100644
--- a/sualibrary/sua/sua.h
+++ b/sualibrary/sua/sua.h
@@ -130,7 +130,6 @@ using namespace std;
#define SUA_PORT 14001
#define SUA_PPI 4
-#define IPPROTO_SCTP 132
#define SUA_MAX_MSG_LEN 2000
diff --git a/sualibrary/sua/sua_adapt.cpp b/sualibrary/sua/sua_adapt.cpp
index 1511949..8f9b1ea 100644
--- a/sualibrary/sua/sua_adapt.cpp
+++ b/sualibrary/sua/sua_adapt.cpp
@@ -199,7 +199,7 @@ unsigned int sua_getPath( unsigned int assoc_id,
else
result = SUA_PATH_NO_DEST_ADDR_PRESENT;
- pathinfo.local_addr.pc.ipvx.ch = sua.local_sua.instance[sua.AssocDB.instance[assoc_id].local_sua_id].Source.addrs[0].ch;
+ pathinfo.local_addr.pc.ipvx = sua.local_sua.instance[sua.AssocDB.instance[assoc_id].local_sua_id].Source.addrs[0];
/*memcpy( pathinfo.local_addr.pc.ipvx.ch, sua.AssocDB.instance[assoc_id].Source.addrs[0].ch,24);*/
diff --git a/sualibrary/sua/sua_asp_mgnt.cpp b/sualibrary/sua/sua_asp_mgnt.cpp
index e63bbde..af7b271 100644
--- a/sualibrary/sua/sua_asp_mgnt.cpp
+++ b/sualibrary/sua/sua_asp_mgnt.cpp
@@ -151,7 +151,7 @@ int sua_send_ASPUP( unsigned int Sua_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
@@ -228,7 +228,7 @@ int sua_send_ASPUP_ACK( unsigned int Sua_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
@@ -300,7 +300,7 @@ int sua_send_ASPDOWN( unsigned int Sua_assoc_id
stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
@@ -371,7 +371,7 @@ int sua_send_ASPDOWN_ACK( unsigned int Sua_assoc_id
stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
@@ -441,7 +441,7 @@ int sua_send_BEAT( unsigned int Sua_assoc_id
stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
@@ -515,7 +515,7 @@ int sua_send_BEAT_ACK( unsigned int Sua_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
@@ -601,7 +601,7 @@ int sua_send_ASPAC( unsigned int Sua_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
@@ -685,7 +685,7 @@ int sua_send_ASPAC_ACK( unsigned int Sua_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
@@ -762,7 +762,7 @@ int sua_send_ASPINAC( unsigned int Sua_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
@@ -839,7 +839,7 @@ int sua_send_ASPINAC_ACK( unsigned int Sua_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
@@ -923,7 +923,7 @@ int sua_send_NOTIFY( unsigned int Sua_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
diff --git a/sualibrary/sua/sua_cl.cpp b/sualibrary/sua/sua_cl.cpp
index 3120ac5..dbe8c50 100644
--- a/sualibrary/sua/sua_cl.cpp
+++ b/sualibrary/sua/sua_cl.cpp
@@ -120,7 +120,7 @@ int sua_send_Message( signed int sctp_assoc_id,
sctp_stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY, /* replace in future with sctp_loadshare*/
SCTP_NO_CONTEXT, SCTP_INFINITE_LIFETIME,
sctp_delivery_type,
diff --git a/sualibrary/sua/sua_co.cpp b/sualibrary/sua/sua_co.cpp
index bbee72a..4d331fa 100644
--- a/sualibrary/sua/sua_co.cpp
+++ b/sualibrary/sua/sua_co.cpp
@@ -71,6 +71,7 @@
#include "sua_logging.h"
#include "sua_tcb.h"
#include "sua_cl.h"
+#include "sua_co.h"
#ifdef LINUX
#include <unistd.h>
@@ -1767,7 +1768,7 @@ short process_CORELRQ_msg ( unsigned int sua_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
diff --git a/sualibrary/sua/sua_distribution.cpp b/sualibrary/sua/sua_distribution.cpp
index d8b342b..6def7b3 100644
--- a/sualibrary/sua/sua_distribution.cpp
+++ b/sualibrary/sua/sua_distribution.cpp
@@ -104,7 +104,7 @@ extern tcb_Sua_msgqueue_pool msg_store;
/* sctp_DataArriveNotif */
/***********************************************************************/
void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
- unsigned int stream_id,
+ unsigned short stream_id,
unsigned int len,
unsigned short data_streamSN,
unsigned int data_tsn,
diff --git a/sualibrary/sua/sua_distribution.h b/sualibrary/sua/sua_distribution.h
index eac8e1c..b94175e 100644
--- a/sualibrary/sua/sua_distribution.h
+++ b/sualibrary/sua/sua_distribution.h
@@ -90,7 +90,7 @@ typedef struct {
/* sctp_DataArriveNotif */
/***********************************************************************/
void sctp_DataArriveNotif( unsigned int assoc_id,
- unsigned int stream_id,
+ unsigned short stream_id,
unsigned int len,
unsigned short streamSN,
unsigned int tsn,
diff --git a/sualibrary/sua/sua_file.cpp b/sualibrary/sua/sua_file.cpp
index f9ca43d..293639a 100644
--- a/sualibrary/sua/sua_file.cpp
+++ b/sualibrary/sua/sua_file.cpp
@@ -917,6 +917,9 @@ int read_sua_conf_file( string filename,
cout << cmdline << "\n";
}
+
+ return(0);
+
} /* end of read_sua_conf_file */
// end of module sua_file.c
diff --git a/sualibrary/sua/sua_logging.cpp b/sualibrary/sua/sua_logging.cpp
index a3a2a84..ffbd777 100644
--- a/sualibrary/sua/sua_logging.cpp
+++ b/sualibrary/sua/sua_logging.cpp
@@ -69,7 +69,7 @@
#include <string>
#include <iostream>
#include <iomanip>
-#include <fstream.h>
+#include <fstream>
#include <sys/time.h>
#include <time.h>
diff --git a/sualibrary/sua/sua_snm_mgnt.cpp b/sualibrary/sua/sua_snm_mgnt.cpp
index 0eb5950..996f27a 100644
--- a/sualibrary/sua/sua_snm_mgnt.cpp
+++ b/sualibrary/sua/sua_snm_mgnt.cpp
@@ -60,6 +60,7 @@
*/
#include "sua_debug.h"
+#include "sua_snm_mgnt.h"
#include "sua_asp_mgnt.h"
#include "sua_database.h"
#include "sua_syntax.h"
@@ -135,7 +136,7 @@ int sua_send_DAVA( unsigned int Sua_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
@@ -210,7 +211,7 @@ int sua_send_DUNA( unsigned int Sua_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
@@ -292,7 +293,7 @@ unsigned int sua_send_daud()
stream_id,
(unsigned char *) databuf,
datalen,
- SUA_PPI,
+ htonl(SUA_PPI),
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,