update to sualibrary-0.1.5 released 2006-10-10

* 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
This commit is contained in:
Harald Welte 2010-07-09 20:59:35 +02:00
parent 3b3b534da8
commit 283f8ffe84
13 changed files with 61 additions and 119 deletions

View File

@ -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)
AM_INIT_AUTOMAKE(sualibrary,0.1.5)
AC_PREFIX_DEFAULT(/usr/local)
if test "x$prefix" = "xNONE"; then
prefix=$ac_default_prefix
ac_configure_args="$ac_configure_args --prefix $prefix"
fi
# 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)
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,101 +194,42 @@ 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+.
#
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
# 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.
#
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)
#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)
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_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)])
# GLib & SCTPlib checks
enable_sctpd="no"
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_CHECK_LIB(glib, g_main_add_poll)
sctp_LIBS="-L/usr/local/lib -lsctplib"
AC_CHECK_LIB(sctplib, sctp_eventLoop)
AC_SUBST(sctp_LIBS)
# Checks for library functions.
AC_FUNC_VPRINTF
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

View File

@ -5,6 +5,3 @@ SUBDIRS = docs sua testup
####### kdevelop will overwrite this part!!! (end)############
SUBDIRS = docs sua testup

View File

@ -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)

View File

@ -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

View File

@ -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);*/

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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

View File

@ -69,7 +69,7 @@
#include <string>
#include <iostream>
#include <iomanip>
#include <fstream.h>
#include <fstream>
#include <sys/time.h>
#include <time.h>

View File

@ -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,