update to sualibrary-0.1.1 from 2002-03-15:

* Contains Relaying functionality using hostnames.
    * Correct some bugs (multihoming....)
    * Compiles and runs on Linux, FreeBSD ....
    * Tested on IPv4 and IPV6 networks
    * interoperable with other SUA implementations
    * corresponds to sua draft v11
    * requires SCTP implementation from www.sctp.de
master
Harald Welte 13 years ago
parent acd8cf6013
commit 7e7186ca00
  1. 162
      sualibrary.kdevprj
  2. 302
      sualibrary/sua/sua_cl.cpp
  3. 39
      sualibrary/sua/sua_cl.h
  4. 306
      sualibrary/sua/sua_co.cpp
  5. 28
      sualibrary/sua/sua_database.h
  6. 6
      sualibrary/sua/sua_dataname.cpp
  7. 288
      sualibrary/sua/sua_datassoc.cpp
  8. 6
      sualibrary/sua/sua_debug.h

@ -1,57 +1,57 @@
# KDE Config File
[Workspace_1]
openfiles=Untitled.h,Untitled.cpp,/home/p82609/siemens/sualibrary/sualibrary/docs/en/index.html,/home/p82609/siemens/sualibrary/sualibrary/docs/en/index-1.html,/home/p82609/siemens/sualibrary/sualibrary/docs/en/index-4.html,/home/p82609/siemens/sualibrary/sualibrary/docs/en/index-2.html,/home/p82609/siemens/sualibrary/sualibrary/docs/en/index-3.html,/home/p82609/siemens/sualibrary/sualibrary/docs/en/index-5.html,/home/p82609/siemens/sualibrary/sualibrary/docs/en/index-6.html,/home/p82609/siemens/sualibrary/sualibrary/docs/en/Makefile.in,/home/p82609/siemens/sualibrary/sualibrary/docs/en/index.sgml,
show_outputview=true
show_treeview=true
header_file=/home/p82609/siemens/sualibrary/sualibrary/docs/en/index-4.html
cpp_file=Untitled.cpp
browser_file=file:/opt/kde/share/doc/HTML/default/kdevelop/reference/C/LIBRARIES/libraries.html
[sualibrary/docs/en/index-6.html]
install_location=
dist=true
install=false
type=DATA
[sualibrary/sua/sua_logging.h]
[Workspace_1]
openfiles=Untitled.h,Untitled.cpp,/home/p82609/siemens/sualibrary/sualibrary/sua/sua_datassoc.cpp,/home/p82609/siemens/sualibrary/sualibrary/sua/sua_distribution.cpp,
show_outputview=true
show_treeview=true
header_file=Untitled.h
cpp_file=/home/p82609/siemens/sualibrary/sualibrary/sua/sua_datassoc.cpp
browser_file=file:/opt/kde/share/doc/HTML/default/kdevelop/reference/C/LIBRARIES/libraries.html
[COPYING]
install_location=
dist=true
install=false
type=HEADER
[sualibrary/sua/sua_logging.cpp]
type=DATA
[sualibrary/sua/sua_adapt.cpp]
install_location=
dist=true
install=false
type=SOURCE
[sualibrary/sua/sua_adapt.cpp]
[sualibrary/sua/sua_logging.cpp]
install_location=
dist=true
install=false
type=SOURCE
[COPYING]
[sualibrary/sua/sua_logging.h]
install_location=
dist=true
install=false
type=DATA
type=HEADER
[sualibrary/sua/sua_database.h]
install_location=
dist=true
install=false
type=HEADER
[sualibrary/sua/sua_tcb.h]
[Config for BinMakefileAm]
ldflags=
addcxxflags=
ldadd=
cxxflags=-O0 -g3 -Wall
bin_program=sualibrary
[sualibrary/sua/sua.h]
install_location=
dist=true
install=false
type=HEADER
[sualibrary/sua/sua.h]
[sualibrary/sua/sua_tcb.h]
install_location=
dist=true
install=false
type=HEADER
[Config for BinMakefileAm]
ldflags=
addcxxflags=
ldadd=
bin_program=sualibrary
cxxflags=-O0 -g3 -Wall
[sualibrary/testup/main.cpp]
install_location=
dist=true
@ -62,22 +62,22 @@ install_location=
dist=true
install=false
type=DATA
[sualibrary/sua/sua_file.h]
[sualibrary/sua/sua_asp_mgnt.h]
install_location=
dist=true
install=false
type=HEADER
[sualibrary/sua/sua_asp_mgnt.h]
[sualibrary/sua/sua_file.h]
install_location=
dist=true
install=false
type=HEADER
[sualibrary.kdevprj]
[sualibrary/docs/en/index-1.html]
install_location=
dist=true
install=false
type=DATA
[sualibrary/docs/en/index-1.html]
[sualibrary.kdevprj]
install_location=
dist=true
install=false
@ -93,21 +93,26 @@ install_location=
dist=true
install=false
type=DATA
[sualibrary/docs/en/Makefile.am]
files=sualibrary/docs/en/index.html,sualibrary/docs/en/index-1.html,sualibrary/docs/en/index-2.html,sualibrary/docs/en/index-3.html,sualibrary/docs/en/index-4.html,sualibrary/docs/en/index-5.html,sualibrary/docs/en/index-6.html,
sub_dirs=
type=normal
[sualibrary/sua/sua_sual.cpp]
install_location=
dist=true
install=false
type=SOURCE
[sualibrary/docs/en/Makefile.am]
files=sualibrary/docs/en/index.html,sualibrary/docs/en/index-1.html,sualibrary/docs/en/index-2.html,sualibrary/docs/en/index-3.html,sualibrary/docs/en/index-4.html,sualibrary/docs/en/index-5.html,sualibrary/docs/en/index-6.html,
type=normal
sub_dirs=
[sualibrary/docs/en/index.html]
install_location=
dist=true
install=false
type=DATA
[sualibrary/sua/sua_file.cpp]
[sualibrary/docs/en/index-3.html]
install_location=
dist=true
install=false
type=DATA
[sualibrary/sua/sua_asp_mgnt.cpp]
install_location=
dist=true
install=false
@ -117,22 +122,22 @@ install_location=
dist=true
install=false
type=SOURCE
[sualibrary/sua/sua_asp_mgnt.cpp]
[sualibrary/sua/sua_file.cpp]
install_location=
dist=true
install=false
type=SOURCE
[sualibrary/docs/en/index-3.html]
[sualibrary/testup/assoc.sua]
install_location=
dist=true
dist=false
install=false
type=DATA
[sualibrary/docs/Makefile.am]
type=normal
sub_dirs=en,
[sualibrary/testup/assoc.sua]
type=normal
[sualibrary/docs/en/index-4.html]
install_location=
dist=false
dist=true
install=false
type=DATA
[sualibrary/sua/sua_distribution.h]
@ -140,35 +145,30 @@ install_location=
dist=true
install=false
type=HEADER
[sualibrary/docs/en/index-4.html]
[sualibrary/sua/sua_syntax.cpp]
install_location=
dist=true
install=false
type=DATA
type=SOURCE
[sualibrary/testup/testuser.h]
install_location=
dist=true
install=false
type=HEADER
[sualibrary/sua/sua_syntax.cpp]
install_location=
dist=true
install=false
type=SOURCE
[sualibrary/sua/sua_tcb.cpp]
[sualibrary.lsm]
install_location=
dist=true
install=false
type=SOURCE
type=DATA
[sualibrary/Makefile.am]
files=
type=prog_main
sub_dirs=docs,sua,testup,
[sualibrary.lsm]
type=prog_main
[sualibrary/sua/sua_tcb.cpp]
install_location=
dist=true
install=false
type=DATA
type=SOURCE
[sualibrary/docs/en/index-5.html]
install_location=
dist=true
@ -179,83 +179,87 @@ install_location=
dist=true
install=false
type=SOURCE
[sualibrary/sua/sua_cl.cpp]
[ChangeLog]
install_location=
dist=true
install=false
type=SOURCE
[ChangeLog]
type=DATA
[sualibrary/sua/sua_cl.cpp]
install_location=
dist=true
install=false
type=DATA
type=SOURCE
[General]
make_options=-j1
makefiles=Makefile.am,sualibrary/Makefile.am,sualibrary/docs/Makefile.am,sualibrary/docs/en/Makefile.am,sualibrary/sua/Makefile.am,sualibrary/testup/Makefile.am,
version_control=None
project_type=normal_cpp
author=Lode Coene
project_type=normal_cpp
sub_dir=sualibrary/
lfv_open_groups=
workspace=1
project_name=Sualibrary
version=0.1
AMChanged=true
project_name=Sualibrary
AMChanged=false
sgml_file=/home/p82609/sualibrary/sualibrary/docs/en/index.sgml
short_info=,
email=lode.coene@siemens.atea.be
kdevprj_version=1.2
configure_args=
modifyMakefiles=true
[INSTALL]
[sualibrary/sua/Makefile.am]
files=sualibrary/sua/sua.h,sualibrary/sua/sua_adapt.cpp,sualibrary/sua/sua_adapt.h,sualibrary/sua/sua_asp_mgnt.cpp,sualibrary/sua/sua_asp_mgnt.h,sualibrary/sua/sua_cl.cpp,sualibrary/sua/sua_cl.h,sualibrary/sua/sua_datassoc.cpp,sualibrary/sua/sua_co.cpp,sualibrary/sua/sua_co.h,sualibrary/sua/sua_database.cpp,sualibrary/sua/sua_database.h,sualibrary/sua/sua_dataname.cpp,sualibrary/sua/sua_debug.h,sualibrary/sua/sua_distribution.cpp,sualibrary/sua/sua_distribution.h,sualibrary/sua/sua_file.cpp,sualibrary/sua/sua_file.h,sualibrary/sua/sua_logging.cpp,sualibrary/sua/sua_logging.h,sualibrary/sua/sua_sual.cpp,sualibrary/sua/sua_sual.h,sualibrary/sua/sua_syntax.cpp,sualibrary/sua/sua_syntax.h,sualibrary/sua/sua_tcb.cpp,sualibrary/sua/sua_tcb.h,
type=static_library
[TODO]
install_location=
dist=true
install=false
type=DATA
[TODO]
[INSTALL]
install_location=
dist=true
install=false
type=DATA
[sualibrary/sua/Makefile.am]
files=sualibrary/sua/sua.h,sualibrary/sua/sua_adapt.cpp,sualibrary/sua/sua_adapt.h,sualibrary/sua/sua_asp_mgnt.cpp,sualibrary/sua/sua_asp_mgnt.h,sualibrary/sua/sua_cl.cpp,sualibrary/sua/sua_cl.h,sualibrary/sua/sua_datassoc.cpp,sualibrary/sua/sua_co.cpp,sualibrary/sua/sua_co.h,sualibrary/sua/sua_database.cpp,sualibrary/sua/sua_database.h,sualibrary/sua/sua_dataname.cpp,sualibrary/sua/sua_debug.h,sualibrary/sua/sua_distribution.cpp,sualibrary/sua/sua_distribution.h,sualibrary/sua/sua_file.cpp,sualibrary/sua/sua_file.h,sualibrary/sua/sua_logging.cpp,sualibrary/sua/sua_logging.h,sualibrary/sua/sua_sual.cpp,sualibrary/sua/sua_sual.h,sualibrary/sua/sua_syntax.cpp,sualibrary/sua/sua_syntax.h,sualibrary/sua/sua_tcb.cpp,sualibrary/sua/sua_tcb.h,
type=static_library
[sualibrary/sua/sua_syntax.h]
install_location=
dist=true
install=false
type=HEADER
[sualibrary/sua/sua_co.h]
install_location=
dist=true
install=false
type=HEADER
[sualibrary/testup/local.sua]
install_location=local.sua
dist=false
install=false
type=DATA
[sualibrary/testup/testuser.cpp]
[sualibrary/sua/sua_co.h]
install_location=
dist=true
install=false
type=SOURCE
[sualibrary/sua/sua_database.cpp]
type=HEADER
[sualibrary/sua/sua_adapt.h]
install_location=
dist=true
install=false
type=SOURCE
type=HEADER
[sualibrary/sua/sua_co.cpp]
install_location=
dist=true
install=false
type=SOURCE
[sualibrary/sua/sua_adapt.h]
[sualibrary/sua/sua_database.cpp]
install_location=
dist=true
install=false
type=HEADER
[sualibrary/sua/sua_sual.h]
type=SOURCE
[sualibrary/testup/testuser.cpp]
install_location=
dist=true
install=false
type=SOURCE
[Makefile.am]
files=sualibrary.kdevprj,AUTHORS,COPYING,ChangeLog,INSTALL,README,TODO,sualibrary.lsm,
sub_dirs=sualibrary,
type=normal
[sualibrary/sua/sua_cl.h]
install_location=
dist=true
install=false
@ -265,24 +269,20 @@ install_location=
dist=true
install=false
type=SOURCE
[sualibrary/sua/sua_cl.h]
[sualibrary/sua/sua_sual.h]
install_location=
dist=true
install=false
type=HEADER
[Makefile.am]
files=sualibrary.kdevprj,AUTHORS,COPYING,ChangeLog,INSTALL,README,TODO,sualibrary.lsm,
type=normal
sub_dirs=sualibrary,
[sualibrary/testup/Makefile.am]
files=sualibrary/testup/main.cpp,sualibrary/testup/testuser.cpp,sualibrary/testup/testuser.h,sualibrary/testup/local.sua,sualibrary/testup/assoc.sua,
sub_dirs=
type=static_library
[AUTHORS]
install_location=
dist=true
install=false
type=DATA
[sualibrary/testup/Makefile.am]
files=sualibrary/testup/main.cpp,sualibrary/testup/testuser.cpp,sualibrary/testup/testuser.h,sualibrary/testup/local.sua,sualibrary/testup/assoc.sua,
type=static_library
sub_dirs=
[sualibrary/sua/sua_debug.h]
install_location=
dist=true

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_cl.cpp,v 1.1.1.1 2002/02/04 14:30:41 p82609 Exp $
* $Id: sua_cl.cpp,v 1.3 2002/03/01 12:57:38 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@ -48,7 +48,9 @@
* inspiration : Dorothee
* "Always admire the local beauties in their natural enviroment."
*
* Purpose: This code-file defines the SUA connectionless message handling:
* Purpose: This code-file defines the SUA connectionless message handling:
* - send a SUA message(CL or CO) to SCTP
* - route a SUA message(CL or CO)
* - send a Unitdata msg to remote node
* (- send a Unitdata Service msg to remote node)
* - Process a Unitdata msg
@ -92,24 +94,180 @@ extern tcb_Sua_msgqueue_pool msg_store;
// import the received msg pool
extern vector<sua_save_str> rec_msg_pool;
/***********************************************************************/
/* sua_send_Message */
/***********************************************************************/
int sua_send_Message( signed int sctp_assoc_id,
short int sctp_stream_id,
int sctp_delivery_type,
unsigned int sctp_loadshare,
char *databuf,
unsigned int datalen
)
{
signed int result;
/* send data to SCTP */
/* yes it does, continue, no problem, send the msg */
#ifdef DEBUG
/* display byte array */
display_byte_array(databuf , datalen);
#endif
char logstring[100];
sprintf(logstring, "SUA encoded message, ready for being send to SCTP assoc %d", sctp_assoc_id);
event_log("sua_cl.c",logstring);
log_byte_array("sua_cl.c", databuf,datalen);
result = sctp_send ( sctp_assoc_id,
sctp_stream_id,
(unsigned char *) databuf,
datalen,
SUA_PPI,
SCTP_USE_PRIMARY, /* replace in future with sctp_loadshare*/
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
sctp_delivery_type,
SCTP_BUNDLING_DISABLED
);
#ifdef DEBUG
cout << "sua_cl.c:result sctp send = "<< result << "\n";
printf( "%d \n", result);
#endif
return(result);
}
/***********************************************************************/
/* sua_route_Message */
/***********************************************************************/
int sua_route_Message( unsigned int sctp_assoc_id,
unsigned int local_sua_id,
Sua_container &msg,
sccp_addr_str &called_pty_address,
sccp_addr_str &calling_pty_address
)
{
int result = 0;
short int sctp_stream_id = 0;
int sctp_delivery_type = SCTP_UNORDERED_DELIVERY;
signed int sctp_loadshare = SCTP_USE_PRIMARY;
int sua_assoc_id = 0;
int datalen = 0;
Sua_syntax_error_struct error;
// call routing to figure out which association to take for sending
// out the message
#ifdef DEBUG
cout << "call routing function\n";
#endif
sctp_assoc_id = Assoc_sua.route_msg( called_pty_address,
calling_pty_address,
sua_assoc_id
);
#ifdef DEBUG
cout << "routed to SCTP assoc " << sctp_assoc_id << "/SUA assoc id " << sua_assoc_id <<"\n";
#endif
/* does association exist? */
if (sctp_assoc_id > 0)
{
/* YES, encode the SUA unitdata message and ... */
error = msg.sua_encode();
/* figure out SCTP delivery type, stream to send msg on,...and.. */
if (msg.sua_prim.prot_class_pres)
{
switch(msg.sua_prim.prot_class.pcl)
{
case(prot_class_0): /* connectionless transport, non sequenced */
sctp_delivery_type = SCTP_UNORDERED_DELIVERY;
break;
case(prot_class_1): /* connectionless transport, sequenced */
sctp_delivery_type = SCTP_ORDERED_DELIVERY;
break;
case(prot_class_2): /* connection-oriented transport, ... */
sctp_delivery_type = SCTP_ORDERED_DELIVERY;
break;
case(prot_class_3): /* connection-oriented transport, ... */
sctp_delivery_type = SCTP_ORDERED_DELIVERY;
break;
default:
sctp_delivery_type = SCTP_UNORDERED_DELIVERY;
break;
}
sctp_stream_id = Assoc_sua.instance[sua_assoc_id].nr_of_outbound_streams;
sctp_stream_id = 0;
}
else
{
sctp_stream_id = 0;
}
/* copy data into buffer, then finally... */
char* databuf = new char[msg.sua_msg.length()];
msg.sua_msg.copy(databuf, msg.sua_msg.length());
datalen = msg.sua_msg.length();
// send data to SCTP
result = sua_send_Message( sctp_assoc_id,
sctp_stream_id,
sctp_delivery_type,
sctp_loadshare,
databuf,
datalen
);
delete databuf;
#ifdef DEBUG
cout.setf(ios::internal);
cout << "sua_cl.c:result sua send = "<< result << "\n";
#endif
}
else if (sctp_assoc_id < 0)
{
/* NOPE, message is routable, but destination is blocked */
/* due to administration or management descisions */
#ifdef DEBUG
cout << "sua_cl.c:sending msg prohibited \n";
#endif
result = -1;
}
else
{
/* NOPE message is NOT routable, destination not found. */
/* drop the message, no route present for that address */
result = 0;
}
return(result);
}
/***********************************************************************/
/* sua_send_Unitdata */
/***********************************************************************/
int sua_send_Unitdata(sccp_QOS_str &QOS,
sccp_addr_str &called_pty_address,
sccp_addr_str &calling_pty_address,
char *buffer,
unsigned int len
)
int sua_send_Unitdata ( sccp_QOS_str &QOS,
sccp_addr_str &called_pty_address,
sccp_addr_str &calling_pty_address,
char *buffer,
unsigned int len
)
{
Sua_container msg;
Sua_syntax_error_struct error;
int error_value;
int error_value = 0;
int string_size, datalen;
signed int sctp_assoc_id;
unsigned int sua_assoc_id;
short stream_id = 0;
int delivery_type, result;
int sua_assoc_id;
short sctp_stream_id = 0;
signed int sctp_loadshare = SCTP_USE_PRIMARY;
int sctp_delivery_type, result;
tcb_Sua_msg_elem sua_msg;
// init the message
@ -134,14 +292,14 @@ int sua_send_Unitdata(sccp_QOS_str &QOS,
msg.sua_prim.prot_class.pcl = prot_class_0;
msg.sua_prim.seq_control_pres = TRUE;
msg.sua_prim.seq_control = QOS.sequence_number;
delivery_type = SCTP_UNORDERED_DELIVERY;
sctp_delivery_type = SCTP_UNORDERED_DELIVERY;
break;
case(class1):
msg.sua_prim.prot_class_pres = TRUE;
msg.sua_prim.prot_class.pcl = prot_class_1;
msg.sua_prim.seq_control_pres = TRUE;
msg.sua_prim.seq_control = QOS.sequence_number;
delivery_type = SCTP_ORDERED_DELIVERY;
sctp_delivery_type = SCTP_ORDERED_DELIVERY;
break;
default:
return(PROTOCOL_CLASS_NOT_SPECIFIED);
@ -297,46 +455,35 @@ int sua_send_Unitdata(sccp_QOS_str &QOS,
cout << "call routing function\n";
#endif
sctp_assoc_id = Assoc_sua.route_msg( called_pty_address,
calling_pty_address
);
calling_pty_address,
sua_assoc_id
);
#ifdef DEBUG
cout << "routed to SCTP assoc " << sctp_assoc_id << "\n";
#endif
/* does association exist? */
if (sctp_assoc_id > 0)
{
// send data to SCTP
char* databuf = new char[msg.sua_msg.length()];
/* copy data into buffer, then finally... */
char* databuf = new char[msg.sua_msg.length()];
msg.sua_msg.copy(databuf, msg.sua_msg.length());
datalen = msg.sua_msg.length();
/* yes it does, continue, no problem, send the msg */
#ifdef DEBUG
// display byte array
display_byte_array(databuf , msg.sua_msg.length());
#endif
char logstring[100];
sprintf(logstring, "SUA encoded message, ready for being send to SCTP assoc %d", sctp_assoc_id);
event_log("sua_cl.c",logstring);
log_byte_array("sua_cl.c", databuf,msg.sua_msg.length());
result = sctp_send ( sctp_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
SUA_PPI,
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
delivery_type,
SCTP_BUNDLING_DISABLED
);
error_value = result;
delete databuf;
datalen = msg.sua_msg.length();
// send data to SCTP
result = sua_send_Message( sctp_assoc_id,
sctp_stream_id,
sctp_delivery_type,
sctp_loadshare,
databuf,
datalen
);
delete databuf;
#ifdef DEBUG
cout << "sua_cl.c:result sctp send = "<< result << "\n";
#endif
error_value = 0;
}
else if (sctp_assoc_id < 0)
{
@ -361,12 +508,12 @@ int sua_send_Unitdata(sccp_QOS_str &QOS,
/* - save the msg till the association is setup or */
/* association setup fails -> drop saved msg */
sua_msg.byte = msg.sua_msg;
sua_msg.delivery_type = delivery_type;
sua_msg.stream_id = stream_id;
sua_msg.delivery_type = sctp_delivery_type;
sua_msg.stream_id = sctp_stream_id;
sua_msg.valid = true;
msg_store.add_msg ( sua_assoc_id,
sua_msg
);
sua_msg
);
error_value = -1;
}
@ -385,8 +532,9 @@ short process_unitdata_msg ( int local_sua_id,
Sua_container &msg
)
{
sua_save_str temp;
int result = 0;
int sctp_assoc_id = 0;
temp.primitive = N_UNITDATA;
temp.user_ref = 0;
@ -435,7 +583,7 @@ short process_unitdata_msg ( int local_sua_id,
if (msg.sua_prim.source_addr.pc_pres == TRUE)
{
temp.calling_pty_address.address_fields_present.pc = ss7_pc_present;
temp.calling_pty_address.pc.ss7.ITU24.family = ITU24bit;
temp.calling_pty_address.pc.ss7.ITU24.family = Assoc_sua.instance[sua_assoc_id].Dest.pc.ITU14.family;
temp.calling_pty_address.pc.ss7.ITU24.pc = msg.sua_prim.source_addr.pc;
}
if (msg.sua_prim.source_addr.gt_pres == TRUE)
@ -483,11 +631,25 @@ short process_unitdata_msg ( int local_sua_id,
// retrieve the called(=destination) address(=should be our own local addr)
// not completely done yet
if (msg.sua_prim.dest_addr.ip_addr_pres == TRUE)
{
temp.called_pty_address.address_fields_present.pc = ipvx_pc_present;
if (msg.sua_prim.dest_addr.ip_addr_type == ip_v4) {
temp.called_pty_address.pc.ipvx.sin = msg.sua_prim.dest_addr.ip_addr.ipv4;
temp.called_pty_address.pc.ipvx.sa.sa_family = AF_INET;
temp.called_pty_address.pc.ipvx.sin.sin_port = Assoc_sua.instance[sua_assoc_id].Dest.addrs[0].sin.sin_port;
}
else if (msg.sua_prim.dest_addr.ip_addr_type == ip_v6) {
temp.called_pty_address.pc.ipvx.sin6 = msg.sua_prim.dest_addr.ip_addr.ipv6;
temp.called_pty_address.pc.ipvx.sa.sa_family = AF_INET6;
temp.called_pty_address.pc.ipvx.sin6.sin6_port = Assoc_sua.instance[sua_assoc_id].Dest.addrs[0].sin.sin_port;
}
}
if (msg.sua_prim.dest_addr.pc_pres == TRUE)
{
temp.called_pty_address.address_fields_present.pc = ss7_pc_present;
temp.called_pty_address.pc.ss7.ITU24.family = ITU24bit;
temp.called_pty_address.pc.ss7.ITU24.pc = msg.sua_prim.source_addr.pc;
temp.called_pty_address.pc.ss7.ITU24.family = Assoc_sua.instance[sua_assoc_id].Dest.pc.ITU14.family;
temp.called_pty_address.pc.ss7.ITU24.pc = msg.sua_prim.dest_addr.pc;
}
if (msg.sua_prim.dest_addr.hostname_pres == TRUE)
@ -525,19 +687,33 @@ short process_unitdata_msg ( int local_sua_id,
temp.userdata = msg.sua_prim.data_string;
else
cout << "sua_cl.c: no sua user data in unitdata msg \n";
// store primitive in a list(is retrieve via sua_receive_msg)
rec_msg_pool.push_back(temp);
/* call the application/user callBack function */
local_sua.instance[local_sua_id].SUA_APLCallBack.ulp_ClDataIndNotif
( local_sua_id,
N_UNITDATA,
temp.userdata.length()
);
/* Is this the final destination ? */
if ( Assoc_sua.Find_local_sua ( temp.called_pty_address) > 0 )
{
/* Yes, message has arrived at its final destination -> send to upper layer */
/* store primitive in a list(is retrieve via sua_receive_msg) */
rec_msg_pool.push_back(temp);
/* call the application/user callBack function */
local_sua.instance[local_sua_id].SUA_APLCallBack.ulp_ClDataIndNotif
( local_sua_id,
N_UNITDATA,
temp.userdata.length()
);
}
else
{
/* No, Message has not arrived at its final destination -> */
/* route it to the next SUA node via an SCTP association nr x */
result = sua_route_Message( sctp_assoc_id,
local_sua_id,
msg,
temp.called_pty_address,
temp.calling_pty_address
);
}
return(0);
}

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_cl.h,v 1.1.1.1 2002/02/04 14:30:41 p82609 Exp $
* $Id: sua_cl.h,v 1.2 2002/03/01 12:57:38 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@ -44,7 +44,9 @@
* Contact: gery.verwimp@siemens.atea.be
* lode.coene@siemens.atea.be
*
* Purpose: This header-file defines the SUA connectionless message handling:
* Purpose: This header-file defines the SUA connectionless message handling:
* - send a SUA message to SCTP
* - route/relay a received SUA msg towards to the correct SCTP association
* - send a Unitdata msg to remote node
* (- send a Unitdata Service msg to remote node)
* - Process a Unitdata msg
@ -69,17 +71,32 @@
using namespace std;
int sua_send_Unitdata(sccp_QOS_str &QOS,
sccp_addr_str &called_pty_address,
sccp_addr_str &calling_pty_address,
char *buffer,
unsigned int len
);
int sua_send_Message( signed int sctp_assoc_id,
short int sctp_stream_id,
int sctp_delivery_type,
unsigned int sctp_loadshare,
char *databuf,
unsigned int datalen
);
int sua_route_Message( unsigned int sctp_assoc_id,
unsigned int local_sua_id,
Sua_container &msg,
sccp_addr_str &called_pty_address,
sccp_addr_str &calling_pty_address
);
int sua_send_Unitdata( sccp_QOS_str &QOS,
sccp_addr_str &called_pty_address,
sccp_addr_str &calling_pty_address,
char *buffer,
unsigned int len
);
short process_unitdata_msg ( int local_sua_id,
unsigned int sua_assoc_id,
Sua_container &sua_msg
);
unsigned int sua_assoc_id,
Sua_container &sua_msg
);
#endif // SUA_CL_H

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_co.cpp,v 1.1.1.1 2002/02/04 14:30:41 p82609 Exp $
* $Id: sua_co.cpp,v 1.2 2002/03/01 12:57:38 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@ -70,7 +70,7 @@
#include "sua_distribution.h"
#include "sua_logging.h"
#include "sua_tcb.h"
#include "sua_cl.h"
#ifdef LINUX
#include <unistd.h>
@ -122,9 +122,10 @@ int sua_send_CORE( sccp_QOS_str &QOS,
int error_value;
int string_size, datalen;
signed int SCTP_assoc_id;
unsigned int sua_assoc_id;
short stream_id = 0;
int delivery_type, result;
int sua_assoc_id;
signed int sctp_loadshare = SCTP_USE_PRIMARY;
short sctp_stream_id = 0;
int sctp_delivery_type, result;
tcb_Sua_msg_elem sua_msg;
@ -150,7 +151,7 @@ int sua_send_CORE( sccp_QOS_str &QOS,
msg.sua_prim.prot_class.pcl = prot_class_2;
msg.sua_prim.seq_control_pres = TRUE;
msg.sua_prim.seq_control = 1;
delivery_type = SCTP_UNORDERED_DELIVERY;
sctp_delivery_type = SCTP_UNORDERED_DELIVERY;
break;
case(class3):
return(PROTOCOL_CLASS_NOT_SPECIFIED);
@ -320,10 +321,11 @@ int sua_send_CORE( sccp_QOS_str &QOS,
cout << "call routing function\n";
#endif
SCTP_assoc_id = Assoc_sua.route_msg( called_pty_address,
calling_pty_address
);
calling_pty_address,
sua_assoc_id
);
#ifdef DEBUG
cout << "routed to SCTP assoc " << SCTP_assoc_id << "\n";
cout << "routed to SCTP assoc " << SCTP_assoc_id << "/SUA association " << sua_assoc_id << "\n";
#endif
// fill in the TCB
@ -337,35 +339,24 @@ int sua_send_CORE( sccp_QOS_str &QOS,
/* does association exist? */
if (SCTP_assoc_id > 0)
{
// send data to SCTP
char* databuf = new char[msg.sua_msg.length()];
/* copy data into buffer, then finally... */
char* databuf = new char[msg.sua_msg.length()];
msg.sua_msg.copy(databuf, msg.sua_msg.length());
datalen = msg.sua_msg.length();
// send data to SCTP
result = sua_send_Message( SCTP_assoc_id,
sctp_stream_id,
sctp_delivery_type,
sctp_loadshare,
databuf,
datalen
);
delete databuf;
error_value = 0;
/* yes it does, continue, no problem, send the msg */
#ifdef DEBUG
// display byte array
display_byte_array(databuf , msg.sua_msg.length());
#endif
char logstring[100];
sprintf(logstring, "SUA encoded message, ready for being send to SCTP assoc %d", SCTP_assoc_id);
event_log("sua_co.c",logstring);
log_byte_array("sua_co.c", databuf,msg.sua_msg.length());
result = sctp_send ( SCTP_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
SUA_PPI,
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
delivery_type,
SCTP_BUNDLING_DISABLED
);
error_value = result;
delete databuf;
#ifdef DEBUG
cout << "sua_co.c:result sctp send = "<< result << "\n";
#endif
@ -395,8 +386,8 @@ int sua_send_CORE( sccp_QOS_str &QOS,
/* - save the msg till the association is setup or */
/* association setup fails -> drop saved msg */
sua_msg.byte = msg.sua_msg;
sua_msg.delivery_type = delivery_type;
sua_msg.stream_id = stream_id;
sua_msg.delivery_type = sctp_delivery_type;
sua_msg.stream_id = sctp_stream_id;
sua_msg.valid = true;
msg_store.add_msg ( sua_assoc_id,
sua_msg
@ -425,8 +416,9 @@ int sua_send_CORESP( sccp_QOS_str &QOS,
unsigned int SCTP_assoc_id;
unsigned int sua_assoc_id;
unsigned int local_sua_id,remote_sua_id;
short stream_id = 0;
int delivery_type, result = 0;
signed int sctp_loadshare = SCTP_USE_PRIMARY;
short sctp_stream_id = 0;
int sctp_delivery_type, result = 0;
// init the message
msg.sua_init();
@ -450,7 +442,7 @@ int sua_send_CORESP( sccp_QOS_str &QOS,
msg.sua_prim.prot_class.pcl = prot_class_2;
msg.sua_prim.seq_control_pres = TRUE;
msg.sua_prim.seq_control = tcb_ptr->seq_number ;
delivery_type = SCTP_UNORDERED_DELIVERY;
sctp_delivery_type = SCTP_UNORDERED_DELIVERY;
break;
case(class3):
return(PROTOCOL_CLASS_NOT_SPECIFIED);
@ -508,35 +500,24 @@ int sua_send_CORESP( sccp_QOS_str &QOS,
if (Assoc_sua.instance[sua_assoc_id].asp.status == asp_active)
{
#endif
// send data to SCTP
char* databuf = new char[msg.sua_msg.length()];
/* copy data into buffer, then finally... */
char* databuf = new char[msg.sua_msg.length()];
msg.sua_msg.copy(databuf, msg.sua_msg.length());
datalen = msg.sua_msg.length();
#ifdef DEBUG
// display byte array
display_byte_array(databuf , msg.sua_msg.length());
#endif
// send data to SCTP
result = sua_send_Message( SCTP_assoc_id,
sctp_stream_id,
sctp_delivery_type,
sctp_loadshare,
databuf,
datalen
);
delete databuf;
error_value = 0;
char logstring[100];
sprintf(logstring, "SUA encoded message, ready for being send to SCTP assoc %d", SCTP_assoc_id);
event_log("sua_co.c",logstring);
log_byte_array("sua_co.c", databuf,msg.sua_msg.length());
result = sctp_send ( SCTP_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
SUA_PPI,
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
delivery_type,
SCTP_BUNDLING_DISABLED
);
error_value = result;
delete databuf;
#ifdef SUA_MANAGEMENT
}
else
@ -572,8 +553,9 @@ int sua_send_CODATA( sccp_QOS_str &QOS,
unsigned int SCTP_assoc_id;
unsigned int sua_assoc_id;
unsigned int local_sua_id,remote_sua_id;
short stream_id = 0;
int delivery_type, result = 0;
signed int sctp_loadshare = SCTP_USE_PRIMARY;
short sctp_stream_id = 0;
int sctp_delivery_type, result = 0;
// init the message
@ -598,7 +580,7 @@ int sua_send_CODATA( sccp_QOS_str &QOS,
msg.sua_prim.prot_class.pcl = prot_class_2;
msg.sua_prim.seq_control_pres = TRUE;
msg.sua_prim.seq_control = tcb_ptr->seq_number ;
delivery_type = SCTP_UNORDERED_DELIVERY;
sctp_delivery_type = SCTP_UNORDERED_DELIVERY;
break;
case(class3):
return(PROTOCOL_CLASS_NOT_SPECIFIED);
@ -650,35 +632,25 @@ int sua_send_CODATA( sccp_QOS_str &QOS,
if (Assoc_sua.instance[sua_assoc_id].asp.status == asp_active)
{
#endif
// send data to SCTP
char* databuf = new char[msg.sua_msg.length()];
/* copy data into buffer, then finally... */
char* databuf = new char[msg.sua_msg.length()];
msg.sua_msg.copy(databuf, msg.sua_msg.length());
datalen = msg.sua_msg.length();
#ifdef DEBUG
// display byte array
display_byte_array(databuf , msg.sua_msg.length());
#endif
// send data to SCTP
result = sua_send_Message( SCTP_assoc_id,
sctp_stream_id,
sctp_delivery_type,
sctp_loadshare,
databuf,
datalen
);
delete databuf;
error_value = 0;
char logstring[100];
sprintf(logstring, "SUA encoded message, ready for being send to SCTP assoc %d", SCTP_assoc_id);
event_log("sua_co.c",logstring);
log_byte_array("sua_co.c", databuf,msg.sua_msg.length());
result = sctp_send ( SCTP_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
SUA_PPI,
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
delivery_type,
SCTP_BUNDLING_DISABLED
);
error_value = result;
delete databuf;
#ifdef SUA_MANAGEMENT
}
else
@ -714,8 +686,9 @@ int sua_send_CORELRQ( sccp_QOS_str &QOS,
unsigned int SCTP_assoc_id;
unsigned int sua_assoc_id;
unsigned int local_sua_id,remote_sua_id;
short stream_id = 0;
int delivery_type, result = 0;
signed int sctp_loadshare = SCTP_USE_PRIMARY;
short sctp_stream_id = 0;
int sctp_delivery_type, result = 0;
// init the message
@ -740,7 +713,7 @@ int sua_send_CORELRQ( sccp_QOS_str &QOS,
msg.sua_prim.prot_class.pcl = prot_class_2;
msg.sua_prim.seq_control_pres = TRUE;
msg.sua_prim.seq_control = tcb_ptr->seq_number ;
delivery_type = SCTP_UNORDERED_DELIVERY;
sctp_delivery_type = SCTP_UNORDERED_DELIVERY;
break;
case(class3):
return(PROTOCOL_CLASS_NOT_SPECIFIED);
@ -797,35 +770,24 @@ int sua_send_CORELRQ( sccp_QOS_str &QOS,
if (Assoc_sua.instance[sua_assoc_id].asp.status == asp_active)
{
#endif
// send data to SCTP
char* databuf = new char[msg.sua_msg.length()];
/* copy data into buffer, then finally... */
char* databuf = new char[msg.sua_msg.length()];
msg.sua_msg.copy(databuf, msg.sua_msg.length());
datalen = msg.sua_msg.length();
#ifdef DEBUG
// display byte array
display_byte_array(databuf , msg.sua_msg.length());
#endif
datalen = msg.sua_msg.length();
// send data to SCTP
result = sua_send_Message( SCTP_assoc_id,
sctp_stream_id,
sctp_delivery_type,
sctp_loadshare,
databuf,
datalen
);
delete databuf;
error_value = 0;
char logstring[100];
sprintf(logstring, "SUA encoded message, ready for being send to SCTP assoc %d", SCTP_assoc_id);
event_log("sua_co.c",logstring);
log_byte_array("sua_co.c", databuf,msg.sua_msg.length());
result = sctp_send ( SCTP_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
SUA_PPI,
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
delivery_type,
SCTP_BUNDLING_DISABLED
);
error_value = result;
delete databuf;
#ifdef SUA_MANAGEMENT
}
else
@ -861,8 +823,9 @@ int sua_send_CORELCO( sccp_QOS_str &QOS,
unsigned int SCTP_assoc_id;
unsigned int sua_assoc_id;
unsigned int local_sua_id,remote_sua_id;
short stream_id = 0;
int delivery_type, result = 0;
signed int sctp_loadshare = SCTP_USE_PRIMARY;
short sctp_stream_id = 0;
int sctp_delivery_type, result = 0;
// init the message
@ -887,7 +850,7 @@ int sua_send_CORELCO( sccp_QOS_str &QOS,
msg.sua_prim.prot_class.pcl = prot_class_2;
msg.sua_prim.seq_control_pres = TRUE;
msg.sua_prim.seq_control = tcb_ptr->seq_number ;
delivery_type = SCTP_UNORDERED_DELIVERY;
sctp_delivery_type = SCTP_UNORDERED_DELIVERY;
break;
case(class3):
return(PROTOCOL_CLASS_NOT_SPECIFIED);
@ -940,35 +903,24 @@ int sua_send_CORELCO( sccp_QOS_str &QOS,
if (Assoc_sua.instance[sua_assoc_id].asp.status == asp_active)
{
#endif
// send data to SCTP
char* databuf = new char[msg.sua_msg.length()];
/* copy data into buffer, then finally... */
char* databuf = new char[msg.sua_msg.length()];
msg.sua_msg.copy(databuf, msg.sua_msg.length());
datalen = msg.sua_msg.length();
#ifdef DEBUG
// display byte array
display_byte_array(databuf , msg.sua_msg.length());
#endif
// send data to SCTP
result = sua_send_Message( SCTP_assoc_id,
sctp_stream_id,
sctp_delivery_type,
sctp_loadshare,
databuf,
datalen
);
delete databuf;
error_value = 0;
char logstring[100];
sprintf(logstring, "SUA encoded message, ready for being send to SCTP assoc %d", SCTP_assoc_id);
event_log("sua_co.c",logstring);
log_byte_array("sua_co.c", databuf,msg.sua_msg.length());
result = sctp_send ( SCTP_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
SUA_PPI,
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
delivery_type,
SCTP_BUNDLING_DISABLED
);
error_value = result;
delete databuf;
#ifdef SUA_MANAGEMENT
}
else
@ -1007,8 +959,9 @@ int sua_send_COREF( sccp_QOS_str &QOS,
unsigned int SCTP_assoc_id;
unsigned int sua_assoc_id;
unsigned int local_sua_id,remote_sua_id;
short stream_id = 0;
int delivery_type, result = 0;
signed int sctp_loadshare = SCTP_USE_PRIMARY;
short sctp_stream_id = 0;
int sctp_delivery_type, result = 0;
sccp_addr_str called_pty_address;
// init the message
@ -1033,7 +986,7 @@ int sua_send_COREF( sccp_QOS_str &QOS,
msg.sua_prim.prot_class.pcl = prot_class_2;
msg.sua_prim.seq_control_pres = TRUE;
msg.sua_prim.seq_control = tcb_ptr->seq_number ;
delivery_type = SCTP_UNORDERED_DELIVERY;
sctp_delivery_type = SCTP_UNORDERED_DELIVERY;
break;
case(class3):
return(PROTOCOL_CLASS_NOT_SPECIFIED);
@ -1125,35 +1078,24 @@ int sua_send_COREF( sccp_QOS_str &QOS,
if (Assoc_sua.instance[sua_assoc_id].asp.status == asp_active)
{
#endif
// send data to SCTP
char* databuf = new char[msg.sua_msg.length()];
/* copy data into buffer, then finally... */
char* databuf = new char[msg.sua_msg.length()];
msg.sua_msg.copy(databuf, msg.sua_msg.length());
datalen = msg.sua_msg.length();
#ifdef DEBUG
// display byte array
display_byte_array(databuf , msg.sua_msg.length());
#endif
datalen = msg.sua_msg.length();
// send data to SCTP
result = sua_send_Message( SCTP_assoc_id,
sctp_stream_id,
sctp_delivery_type,
sctp_loadshare,
databuf,
datalen
);
delete databuf;
error_value = 0;
char logstring[100];
sprintf(logstring, "SUA encoded message, ready for being send to SCTP assoc %d", SCTP_assoc_id);
event_log("sua_co.c",logstring);
log_byte_array("sua_co.c", databuf,msg.sua_msg.length());
result = sctp_send ( SCTP_assoc_id,
stream_id,
(unsigned char *) databuf,
datalen,
SUA_PPI,
SCTP_USE_PRIMARY,
SCTP_NO_CONTEXT,
SCTP_INFINITE_LIFETIME,
delivery_type,
SCTP_BUNDLING_DISABLED
);
error_value = result;
delete databuf;
#ifdef SUA_MANAGEMENT
}
else

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_database.h,v 1.2 2002/02/07 16:34:27 p82609 Exp $
* $Id: sua_database.h,v 1.4 2002/03/01 12:57:38 p82609 Exp $
*
* SUA implementation according to SUA draft issue 8.
*
@ -317,23 +317,27 @@ class db_Sua_AssociationList{
);
short Terminate_remote_assoc_instance();
short shutdown();
signed int route_msg(sccp_addr_str& cld,
sccp_addr_str& clg
);
signed int resolve_host_name( hostname_str& dest_name,
pointcode_str& dest_pc
);
signed int route_msg( sccp_addr_str& cld,
sccp_addr_str& clg,
int& sua_assoc_id
);
signed int route_on_IPpc ( ipvxunion& dest_pc,
ipvxunion& org_pc,
int& sua_assoc_id
);
signed int route_on_SS7pc ( SS7union& dest_pc,
SS7union& org_pc,
int& sua_assoc_id
);
SS7union& org_pc,
int& sua_assoc_id
);
signed int route_on_GTname ( hostname_str& dest_name,
hostname_str& org_name,
int& sua_assoc_id,
pointcode_str& dest_pc,
pointcode_str& org_pc
);
hostname_str& org_name,
int& sua_assoc_id,
pointcode_str& dest_pc,
pointcode_str& org_pc
);
void increase_instance();
bool activate( unsigned int sua_id,
short mode

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_dataname.cpp,v 1.1.1.1 2002/02/04 14:30:41 p82609 Exp $