update to sualibrary-0.1.4 released 2003-10-15

* In addition to 1.3 Contains :
    * SSNM support(DAUD, DAVA, DUNA).
    * improved ASP management support.
    * test user can initiate certain ASP and SSNM proecdures.
    * 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 sua draft v15
    * requires SCTP implementation sctplib-1.0.0-pre19 from www.sctp.de
This commit is contained in:
Harald Welte 2010-07-09 20:59:00 +02:00
parent c9c547aafe
commit 3b3b534da8
24 changed files with 2604 additions and 185 deletions

View File

@ -8,7 +8,7 @@ AC_INIT(acconfig.h)
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
AM_INIT_AUTOMAKE(sualibrary,0.1.3)
AM_INIT_AUTOMAKE(sualibrary,0.1.4)
AC_PREFIX_DEFAULT(/usr/local)
if test "x$prefix" = "xNONE"; then

View File

@ -1,7 +1,5 @@
####### kdevelop will overwrite this part!!! (begin)##########
bin_PROGRAMS = sualibrary
sualibrary_SOURCES =
sualibrary_LDADD = ./sua/libsua.a ./testup/libtestup.a
SUBDIRS = docs sua testup

View File

@ -169,21 +169,25 @@ REMARK: Spaces are used to clarify the commands only. They are not allowed or no
<P>
- cr destip: dest_id = i,ip = cccc;</P>
<P>Provides the Destination IP address(es)(v4/v6) for the remote node with dest_id i.</P>
<P>
A node can have both a PC or/and a IP address. If both are present then the dest_id must be the same for that particular node.</P>
<P>If a destname is provided, then a cr destip must be done as the translation of the hostname or global title will yield a IP address , which is subsequently used to find the correct association to send the msg out on. The IP address of the cr destip and the ip address of one of the cr assoc's must be the same. Do not forget to do a cr route also for the IP address.</P>
<P>A node can have both a PC or/and a IP address. If both are present then the dest_id must be the same for that particular node.</P>
<P>
- cr destname: dname_id = i,name = www.sctp.be;</P>
<P>Provides the Destination Hostname for the remote node with dname_id i.</P>
<P>Provides the Destination Hostname for the remote node with dname_id i. (Do not forget to do a cr destip.)</P>
<P>
- cr name: dname_id=k,tt=tt,na=nn,np=ppp,digits= 123456789abcdef;</p>
<P>Provides the Destination Global Title for the remote node with dname_id i. tt = translation identifier, na = Nature of address, np= Numbering plan, digits= digits of the Global Title</P>
- cr destname: dname_id=k,tt=tt,na=nn,np=ppp,digits= 123456789abcdef;</p>
<P>Provides the Destination Global Title for the remote node with dname_id i. tt = translation identifier, na = Nature of address, np= Numbering plan, digits= digits of the Global Title(Do not forget to do a cr destip)</P>
<P>
- cr route: dest_id = j, assoc_id = i;</P>
<P>Make the link between a Destination(PC/IP addr) and a association. Destination dest_id j can be reached via the association assoc_id i.</P>
<P>Make the link between a Destination(PC/IP addr) and a association. Destination dest_id j(created via cr destpc or destip) can be reached via the association assoc_id i(created via cr assoc).</P>
<P>
- cr route: dname_id = j, assoc_id = i;</P>
<P>Make the link between a Destination(GT/Name) and a association. Destination dname_id j can be reached via the association assoc_id i.</P>
<P>Make the link between a Destination(GT/Name) and a association. Destination dname_id j(created via cr destname) can be reached via the association assoc_id i(created via cr assoc).</P>
<P>
<P>The Format of the IP address can be provided as an</P>
<P>- IPv4: xxx.yyy.zzz.uuu = decimal (example: 1.1.1.1)</P>
<P>- IPv6: aaa:zzz:eeee = hex (example: 20df::0001)</P>
<P>The translation type, numbering plan and Nature of address must be provided as a decimal value(example: 10)</P>
<P>
<HR>
<A HREF="index-4.html">Next</A>

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua.h,v 1.1 2003/01/14 14:15:36 p82609 Exp $
* $Id: sua.h,v 1.4 2003/09/09 08:43:25 p82609 Exp $
*
* SUA implementation according to SUA draft issue 13.
*
@ -63,8 +63,11 @@
* - terminate a association
* - Send a SUA primtive to SUA
* - Receive a SUA primitive from SUA
* - convert Hostname(string) to SUAname(Character array)
* - convert SUAname(Character array) to Hostname(Character array)
* - get the SUA destination pointcode and status
* - get the SUA origination pointcode
* - activate the SUA association
* - deactivate the SUA association
* - do a SS7 mngt audit(DAUD) on all destinations
*/
#define __EXTENSIONS__
@ -400,6 +403,33 @@ unsigned int Receive_sua_primitive( unsigned int &primitive,
);
#define SUA_GETPC_NO_ERROR 0
#define SUA_GETPC_ERROR 1
unsigned int sua_get_sourcepc_addr( unsigned int sua_id,
pointcode_str &pc
);
unsigned int sua_get_destpc_addr( unsigned int sua_id,
pointcode_str &pc,
unsigned int &sua_assoc_id,
unsigned int &status
);
#define SUA_MNGT_NO_ERROR 0
#define SUA_MNGT_ERROR 1
unsigned int sua_Activate_assoc( unsigned int sua_id
);
unsigned int sua_DeActivate_assoc( unsigned int sua_id
);
#define SUA_DAUD_NO_ERROR 0
#define SUA_DAUD_ERROR 1
unsigned int sua_send_daud();
#endif // SUA_GLOBAL_H

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_adapt.cpp,v 1.3 2003/01/31 11:36:39 p82609 Exp $
* $Id: sua_adapt.cpp,v 1.7 2003/09/09 08:43:25 p82609 Exp $
*
* SUA implementation according to SUA draft issue 13.
*
@ -54,10 +54,11 @@
* - reading the SUA configuration file
* - registering a local SUA instance
* - Setting up the association with a remote SUA node
* - get info on a certain (SUA) association
* - terminate a association
* - convert Hostname(string) to SUAname(Character array)
* - convert SUAname(Character array) to Hostname(Character array)
* - get SUA path info on a certain (SUA) association
* - get SUA destination pointcode (IP and SS7) and status
* - get SUA origination pointcode (IP and SS7)
* - deactivate a SUA association
*/
// sua_adapt.c++
@ -147,7 +148,10 @@ unsigned int sua_registerInstance ( Sua_ULP_CallBacks ulp_callback
SCTPCallbackFunctions.communicationErrorNotif = &sctp_CommunicationErrorNotif;
SCTPCallbackFunctions.restartNotif = &sctp_RestartNotif;
SCTPCallbackFunctions.shutdownCompleteNotif = &sctp_ShutDownCompleteNotif;
SCTPCallbackFunctions.peerShutdownReceivedNotif = &sctp_ShutDownCompleteNotif;
SCTPCallbackFunctions.queueStatusChangeNotif = &sctp_queueStatusChangeNotif;
SCTPCallbackFunctions.asconfStatusNotif = &sctp_asconfStatusNotif;
result = sua.local_sua.register_instance ( SCTPCallbackFunctions,
ulp_callback
);
@ -211,24 +215,39 @@ unsigned int sua_getPath( unsigned int assoc_id,
/***********************************************************************/
/* get destination pointcode address */
/***********************************************************************/
pointcode_str get_destpc_addr( unsigned int sua_id)
unsigned int sua_get_destpc_addr( unsigned int sua_id,
pointcode_str &pc,
unsigned int &sua_assoc_id,
unsigned int &status
)
{
pointcode_str pc;
pc.ipvx = sua.AssocDB.instance[sua_id].Dest.addrs[0];
pc.ss7 = sua.AssocDB.instance[sua_id].Dest.pc;
return(pc);
if (( sua_id > 0) && (sua_id <= ((unsigned int)sua.remote_sua.num_of_instance)))
{
pc.ipvx = sua.remote_sua.instance[sua_id].Dest.addrs[0];
pc.ss7 = sua.remote_sua.instance[sua_id].Dest.pc;
sua_assoc_id = sua.remote_sua.instance[sua_id].SUA_assoc_id;
status = (unsigned int ) sua.remote_sua.instance[sua_id].status;
return(SUA_GETPC_NO_ERROR);
}
else
return(SUA_GETPC_ERROR);
}
/***********************************************************************/
/* get source pointcode address */
/***********************************************************************/
pointcode_str get_sourcepc_addr( unsigned int sua_id)
unsigned int sua_get_sourcepc_addr( unsigned int sua_id,
pointcode_str &pc
)
{
pointcode_str pc;
pc.ipvx = sua.AssocDB.instance[sua_id].Source.addrs[0];
pc.ss7 = sua.AssocDB.instance[sua_id].Source.pc;
return(pc);
if (( sua_id > 0) && (sua_id <= ((unsigned int) sua.local_sua.num_of_instance)))
{
pc.ipvx = sua.local_sua.instance[sua_id].Source.addrs[0];
pc.ss7 = sua.local_sua.instance[sua_id].Source.pc;
return(SUA_GETPC_NO_ERROR);
}
else
return(SUA_GETPC_ERROR);
}
/***********************************************************************/
@ -259,6 +278,80 @@ unsigned int sua_terminate( )
}
/***********************************************************************/
/* sua_Activate_assoc */
/***********************************************************************/
unsigned int sua_Activate_assoc( unsigned int sua_assoc_id
)
{
unsigned int result = SUA_MNGT_NO_ERROR;
switch (sua.AssocDB.instance[sua_assoc_id].asp.status)
{
case(asp_inactive):
case(asp_inactive_traf_hold):
{
result = sua_send_ASPAC( sua_assoc_id,
tmt_unknown,
true,
1
);
break;
}
case( asp_active):
{
/* do nothing, association is already active */
break;
}
default:
{
result = sua_send_ASPUP( sua_assoc_id ,
false,
1
);
break;
}
}
return (result);
}
/***********************************************************************/
/* sua_DeActivate_assoc */
/***********************************************************************/
unsigned int sua_DeActivate_assoc( unsigned int sua_assoc_id
)
{
unsigned int result = SUA_MNGT_NO_ERROR;
switch (sua.AssocDB.instance[sua_assoc_id].asp.status)
{
case(asp_inactive):
case(asp_inactive_traf_hold):
{
result = sua_send_ASPDOWN( sua_assoc_id );
break;
}
case( asp_active):
{
result = sua_send_ASPINAC( sua_assoc_id,
true,
1
);
break;
}
default:
{
/* do nothing, association is already inactive(idle or down)*/
break;
}
}
return (result);
}
// end of module sua_adapt.c++

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_adapt.h,v 1.1 2003/01/14 14:15:36 p82609 Exp $
* $Id: sua_adapt.h,v 1.2 2003/08/26 11:43:57 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@ -71,9 +71,6 @@
using namespace std;
pointcode_str get_destpc_addr( unsigned int sua_id);
pointcode_str get_sourcepc_addr( unsigned int sua_id);
// end of module sua_adapt.h

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_asp_mgnt.cpp,v 1.1 2003/01/14 14:15:36 p82609 Exp $
* $Id: sua_asp_mgnt.cpp,v 1.2 2003/09/09 08:43:25 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@ -59,6 +59,7 @@
* - send a ASP-ACTIVE msg to remote node
* - send a ASP-ACTIVE ACKnowledge msg to remote node
* - send a ASP-INactive Acknowledge msg to remote node
* - send a NOTIFY msg to remote node
* - Receive/process ASP UP msg
* - Receive/process ASP UP ACKnowladge msg
* - Receive/process ASP DOWN msg
@ -94,7 +95,9 @@ extern tcb_Sua_msgqueue_pool msg_store;
/***********************************************************************/
/* sua_send_ASPUP */
/***********************************************************************/
int sua_send_ASPUP( unsigned int Sua_assoc_id
int sua_send_ASPUP( unsigned int Sua_assoc_id,
boolean ASP_id_pres,
uint32_t ASP_id
)
{
Sua_container msg;
@ -111,8 +114,10 @@ int sua_send_ASPUP( unsigned int Sua_assoc_id
// fill in the main sua header
msg.sua_prim.hdr_msg_class = sua_aspsm;
msg.sua_prim.hdr_msg_type.aspsm = aspsm_up;
msg.sua_prim.ASP_id_pres = TRUE;
msg.sua_prim.ASP_id = 1;
msg.sua_prim.ASP_id_pres = ASP_id_pres;
if ( ASP_id_pres)
msg.sua_prim.ASP_id = ASP_id;
msg.sua_prim.asp_cap_pres = FALSE;
msg.sua_prim.info_pres = FALSE;
@ -165,7 +170,7 @@ int sua_send_ASPUP( unsigned int Sua_assoc_id
}
/***********************************************************************/
/* sua_send_ASPUP_ACK */
/* sua_send_ASPUP_ACK */
/***********************************************************************/
int sua_send_ASPUP_ACK( unsigned int Sua_assoc_id,
boolean ASP_id_pres,
@ -241,6 +246,79 @@ int sua_send_ASPUP_ACK( unsigned int Sua_assoc_id,
return(error_value);
}
/***********************************************************************/
/* sua_send_ASPDOWN */
/***********************************************************************/
int sua_send_ASPDOWN( unsigned int Sua_assoc_id
)
{
Sua_container msg;
Sua_syntax_error_struct error;
int error_value = 0;
int string_size, datalen;
signed int sctp_assoc_id;
short stream_id = 0;
int delivery_type, result;
// init the message
msg.sua_init();
// fill in the main sua header
msg.sua_prim.hdr_msg_class = sua_aspsm;
msg.sua_prim.hdr_msg_type.aspsm = aspsm_down;
msg.sua_prim.asp_cap_pres = FALSE;
msg.sua_prim.info_pres = FALSE;
// encode the SUA unitdata message
error = msg.sua_encode();
string_size = msg.sua_msg.size();
delivery_type = SCTP_UNORDERED_DELIVERY;
sctp_assoc_id = sua.AssocDB.instance[Sua_assoc_id].SCTP_assoc_id;
/* does association exist? */
if (sctp_assoc_id > 0)
{
// send data to SCTP
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_asp_mgnt.c",logstring);
log_byte_array("sua_asp_mgnt.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_asp_mgnt.c:result ASPDOWN sctp send = "<< result << "\n";
#endif
}
return(error_value);
}
/***********************************************************************/
/* sua_send_ASPDOWN_ACK */
/***********************************************************************/
@ -458,7 +536,10 @@ int sua_send_BEAT_ACK( unsigned int Sua_assoc_id,
/***********************************************************************/
/* sua_send_ASPAC */
/***********************************************************************/
int sua_send_ASPAC( unsigned int Sua_assoc_id
int sua_send_ASPAC( unsigned int Sua_assoc_id,
Sua_traffic_mode_type traff_mode,
boolean routing_context_present,
uint32_t routing_context
)
{
Sua_container msg;
@ -476,11 +557,18 @@ int sua_send_ASPAC( unsigned int Sua_assoc_id
msg.sua_prim.hdr_msg_class = sua_asptm;
msg.sua_prim.hdr_msg_type.asptm = asptm_act;
/* traffic mode is optional mandatory */
msg.sua_prim.traf_mode_pres = TRUE;
msg.sua_prim.traf_mode = tmt_override;
if (traff_mode == tmt_unknown)
msg.sua_prim.traf_mode_pres = false;
else {
msg.sua_prim.traf_mode_pres = true;
msg.sua_prim.traf_mode = traff_mode;
}
/* rest is optional */
msg.sua_prim.rout_con_pres = TRUE;
msg.sua_prim.rout_con = 1;
msg.sua_prim.rout_con_pres = routing_context_present;
if (msg.sua_prim.rout_con_pres)
msg.sua_prim.rout_con = routing_context;
msg.sua_prim.info_pres = FALSE;
// encode the SUA unitdata message
@ -616,6 +704,83 @@ int sua_send_ASPAC_ACK( unsigned int Sua_assoc_id,
}
/***********************************************************************/
/* sua_send_ASPINAC */
/***********************************************************************/
int sua_send_ASPINAC( unsigned int Sua_assoc_id,
boolean routing_context_present,
uint32_t routing_context
)
{
Sua_container msg;
Sua_syntax_error_struct error;
int error_value = 0;
int string_size, datalen;
signed int sctp_assoc_id;
short stream_id = 0;
int delivery_type, result;
// init the message
msg.sua_init();
// fill in the main sua header
msg.sua_prim.hdr_msg_class = sua_asptm;
msg.sua_prim.hdr_msg_type.asptm = asptm_inact;
msg.sua_prim.rout_con_pres = routing_context_present;
if ( msg.sua_prim.rout_con_pres)
msg.sua_prim.rout_con = routing_context;
msg.sua_prim.info_pres = FALSE;
// encode the SUA unitdata message
error = msg.sua_encode();
string_size = msg.sua_msg.size();
delivery_type = SCTP_UNORDERED_DELIVERY;
sctp_assoc_id = sua.AssocDB.instance[Sua_assoc_id].SCTP_assoc_id;
/* does association exist? */
if (sctp_assoc_id > 0)
{
// send data to SCTP
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_asp_mgnt.c",logstring);
log_byte_array("sua_asp_mgnt.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_asp_mgnt.c:result ASPINAC sctp send = "<< result << "\n";
#endif
}
return(error_value);
}
/***********************************************************************/
/* sua_send_ASPINAC_ACK */
/***********************************************************************/
@ -639,7 +804,9 @@ int sua_send_ASPINAC_ACK( unsigned int Sua_assoc_id,
msg.sua_prim.hdr_msg_class = sua_asptm;
msg.sua_prim.hdr_msg_type.asptm = asptm_inact_ack;
msg.sua_prim.rout_con_pres = routing_context_present;
msg.sua_prim.rout_con = routing_context;
if ( msg.sua_prim.rout_con_pres)
msg.sua_prim.rout_con = routing_context;
msg.sua_prim.info_pres = FALSE;
// encode the SUA unitdata message
@ -690,6 +857,91 @@ int sua_send_ASPINAC_ACK( unsigned int Sua_assoc_id,
return(error_value);
}
/***********************************************************************/
/* sua_send_NOTIFY */
/***********************************************************************/
int sua_send_NOTIFY( unsigned int Sua_assoc_id,
boolean ASP_id_pres,
uint32_t ASP_id,
boolean routing_context_present,
uint32_t routing_context,
uint8_t status_type,
uint8_t status_id
)
{
Sua_container msg;
Sua_syntax_error_struct error;
int error_value = 0;
int string_size, datalen;
signed int sctp_assoc_id;
short stream_id = 0;
int delivery_type, result;
// init the message
msg.sua_init();
// fill in the main sua header
msg.sua_prim.hdr_msg_class = sua_mngt;
msg.sua_prim.hdr_msg_type.mngt = mngt_notify;
msg.sua_prim.status_pres = true;
msg.sua_prim.status.status_type = status_type ;
msg.sua_prim.status.status_ID = status_id;
msg.sua_prim.ASP_id_pres = ASP_id_pres;
msg.sua_prim.ASP_id = ASP_id;
msg.sua_prim.rout_con_pres = routing_context_present;
if (routing_context_present)
msg.sua_prim.rout_con = routing_context;
msg.sua_prim.info_pres = FALSE;
// encode the SUA notify message
error = msg.sua_encode();
string_size = msg.sua_msg.size();
delivery_type = SCTP_UNORDERED_DELIVERY;
sctp_assoc_id = sua.AssocDB.instance[Sua_assoc_id].SCTP_assoc_id;
/* does association exist? */
if (sctp_assoc_id > 0)
{
// send data to SCTP
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_asp_mgnt.c",logstring);
log_byte_array("sua_asp_mgnt.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_asp_mgnt.c:result NOTIFY sctp send = "<< result << "\n";
#endif
}
return(error_value);
}
/***********************************************************************/
/* Receiving SUA Management msg */
/***********************************************************************/
@ -749,7 +1001,11 @@ int process_ASPUP_ACK_msg ( unsigned int sua_assoc_id,
#ifndef IPSP_SINGLE
/* send activation to remote */
error_value = sua_send_ASPAC( sua_assoc_id );
error_value = sua_send_ASPAC( sua_assoc_id,
tmt_unknown,
true,
1
);
#ifdef DEBUG
cout << "sua_asp_mgnt.c:result send ASPAC = "<< error_value << "\n";
@ -1003,6 +1259,9 @@ int process_ASPINAC_ACK_msg ( unsigned int sua_assoc_id,
)
{
int error_value = 0;
sua.AssocDB.deactivate(sua_assoc_id,0);
#ifdef DEBUG
cout << "sua_asp_mgnt.c:ASPINAC_ACK received, nothing further to do.\n";
#endif
@ -1018,9 +1277,9 @@ void Asp_mngt_standby ( unsigned int sua_AS_id,
)
{
sua.ApplicServ.override_ASP( sua_asp_id,
sua_AS_id,
mode
);
sua_AS_id,
mode
);
}
/***********************************************************************/

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_asp_mgnt.h,v 1.1 2003/01/14 14:15:37 p82609 Exp $
* $Id: sua_asp_mgnt.h,v 1.2 2003/09/09 08:43:25 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@ -93,12 +93,33 @@ typedef enum { lm_override, // 0: standard loadshare: only 1 ASP
lm_share_BC // 3: Broadcasting
}asp_Sua_loadmode_set;
int sua_send_ASPUP( unsigned int Sua_assoc_id
int sua_send_ASPUP( unsigned int Sua_assoc_id,
boolean ASP_id_pres,
uint32_t ASP_id
);
int sua_send_ASPAC( unsigned int Sua_assoc_id
int sua_send_ASPDOWN( unsigned int Sua_assoc_id
);
int sua_send_ASPAC( unsigned int Sua_assoc_id,
Sua_traffic_mode_type traff_mode,
boolean routing_context_present,
uint32_t routing_context
);
int sua_send_ASPINAC( unsigned int Sua_assoc_id,
boolean routing_context_present,
uint32_t routing_context
);
int sua_send_NOTIFY( unsigned int Sua_assoc_id,
boolean ASP_id_pres,
uint32_t ASP_id,
boolean routing_context_present,
uint32_t routing_context,
uint8_t status_type,
uint8_t status_id
);
int process_ASPUP_msg ( unsigned int sua_assoc_id,
int local_sua_id,
@ -113,9 +134,9 @@ int process_ASPUP_ACK_msg ( unsigned int sua_assoc_id,
);
int process_ASPDOWN_msg ( unsigned int sua_assoc_id,
int local_sua_id,
int remote_sua_id,
Sua_container sua_asp_msg
int local_sua_id,
int remote_sua_id,
Sua_container sua_asp_msg
);
int process_ASPDOWN_ACK_msg ( unsigned int sua_assoc_id,

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_cl.cpp,v 1.4 2003/02/17 14:38:08 p82609 Exp $
* $Id: sua_cl.cpp,v 1.5 2003/09/09 08:43:25 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@ -274,9 +274,22 @@ int sua_route_Message( unsigned int &sctp_assoc_id,
cout << "routed to SCTP assoc " << sctp_assoc_id << "/SUA assoc id " << sua_assoc_id <<"\n";
#endif
/* does association exist? */
if ((msg.sua_prim.hop_count_pres) && (msg.sua_prim.hop_count <= 0))
{
sctp_assoc_id = 0;
#ifdef DEBUG
cout << "Hopcounter reach 0: drop/send response back msg\n";
#endif
}
/* does association exist? */
if (sctp_assoc_id > 0)
{
/* if hopcounter present decrement him */
if (msg.sua_prim.hop_count_pres)
msg.sua_prim.hop_count--;
/* YES, encode the SUA unitdata message and ... */
error = msg.sua_encode();
@ -412,7 +425,7 @@ int sua_send_Unitdata ( sccp_QOS_str &QOS,
msg.sua_prim.prot_class_pres = TRUE;
msg.sua_prim.prot_class.pcl = prot_class_0;
msg.sua_prim.seq_control_pres = TRUE;
msg.sua_prim.seq_control = QOS.sequence_number;
msg.sua_prim.seq_control = 0;
sctp_delivery_type = SCTP_UNORDERED_DELIVERY;
break;
case(class1):
@ -698,6 +711,8 @@ short process_unitdata_msg ( int local_sua_id,
temp.primitive = N_UNITDATA;
temp.user_ref = 0;
/* change routing context hard coded for test with CMG-logica */
/*msg.sua_prim.rout_con = 6;*/
if (msg.sua_prim.prot_class_pres)
{
@ -917,6 +932,7 @@ short process_UDTService_msg ( int local_sua_id,
sua_save_str temp;
int i, result = 0;
unsigned int sctp_assoc_id = 0;
char digit_char;
temp.primitive = N_NOTICE;
temp.user_ref = 0;
@ -976,8 +992,10 @@ short process_UDTService_msg ( int local_sua_id,
temp.calling_pty_address.name.GT.Numbering_Plan = msg.sua_prim.source_addr.gt.num_plan;
temp.calling_pty_address.name.GT.Nature_of_Address = msg.sua_prim.source_addr.gt.nat_addr;
temp.calling_pty_address.name.GT.nr_of_digits = msg.sua_prim.source_addr.gt.nr_of_digits;
for (i=0; i < temp.calling_pty_address.name.GT.nr_of_digits; i++)
temp.calling_pty_address.name.GT.digits[i] = msg.sua_prim.source_addr.gt.digits[i];
for (i=0; i < temp.calling_pty_address.name.GT.nr_of_digits; i++){
sprintf(&digit_char, "%d", msg.sua_prim.source_addr.gt.digits[i]);
temp.calling_pty_address.name.GT.digits[i] = digit_char;
}
temp.calling_pty_address.name.GT.digits[temp.calling_pty_address.name.GT.nr_of_digits] = '\0';
}
@ -1050,8 +1068,10 @@ short process_UDTService_msg ( int local_sua_id,
temp.called_pty_address.name.GT.Numbering_Plan = msg.sua_prim.dest_addr.gt.num_plan;
temp.called_pty_address.name.GT.Nature_of_Address = msg.sua_prim.dest_addr.gt.nat_addr;
temp.called_pty_address.name.GT.nr_of_digits = msg.sua_prim.dest_addr.gt.nr_of_digits;
for (i=0; i < temp.called_pty_address.name.GT.nr_of_digits; i++)
temp.called_pty_address.name.GT.digits[i] = msg.sua_prim.dest_addr.gt.digits[i];
for (i=0; i < temp.called_pty_address.name.GT.nr_of_digits; i++){
sprintf(&digit_char, "%d", msg.sua_prim.dest_addr.gt.digits[i]);
temp.called_pty_address.name.GT.digits[i] = digit_char;
}
temp.called_pty_address.name.GT.digits[temp.called_pty_address.name.GT.nr_of_digits] = '\0';
}

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_database.cpp,v 1.2 2003/01/16 15:07:56 p82609 Exp $
* $Id: sua_database.cpp,v 1.5 2003/08/28 09:30:20 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@ -410,6 +410,29 @@ return(0);
return(0);
}
/***********************************************************************/
/* Sua_LocalList::found */
/***********************************************************************/
bool db_Sua_LocalList:: found( SS7union pc ){
int i = 1;
bool found_pc = false;
while (( i <= num_of_instance ) && (!found_pc))
{
if (pc.ITU14.family == ITU14bit) // standard ITU: 14 bits
found_pc = ((pc.ITU14.pc == instance[i].Source.pc.ITU14.pc));
else if (pc.ITU24.family == ITU24bit) // chinese PC length: 24 bits
found_pc = ((pc.ITU24.pc == instance[i].Source.pc.ITU24.pc));
else if (pc.ANSI24.family == ANSI24bit) // ANSI PC length: 24 bits
found_pc = ((pc.ANSI24.pc == instance[i].Source.pc.ANSI24.pc));
else
found_pc = false;
i++;
}
return(found_pc);
}
/***********************************************************************/
/* functions of the object class SUA Remote Object */
/***********************************************************************/
@ -418,7 +441,7 @@ return(0);
/***********************************************************************/
void db_Sua_RemoteObject::initialize(){
;
status = ssnm_unavailable;
}
/***********************************************************************/
@ -460,6 +483,144 @@ void db_Sua_RemoteList:: increase_instance(){
};
/***********************************************************************/
/* Sua_RemoteList::Dest_Available */
/***********************************************************************/
void db_Sua_RemoteList:: Dest_Available( SS7union pc)
{
int i = 0;
bool found_pc = false;
while (( i < num_of_instance ) && (!found_pc))
{
i++;
if (pc.ITU14.family == ITU14bit) // standard ITU: 14 bits
found_pc = ((pc.ITU14.pc == instance[i].Dest.pc.ITU14.pc));
else if (pc.ITU24.family == ITU24bit) // chinese PC length: 24 bits
found_pc = ((pc.ITU24.pc == instance[i].Dest.pc.ITU24.pc));
else if (pc.ANSI24.family == ANSI24bit) // ANSI PC length: 24 bits
found_pc = ((pc.ANSI24.pc == instance[i].Dest.pc.ANSI24.pc));
else
found_pc = false;
};
if (found_pc)
instance[i].status = ssnm_available;
}
/***********************************************************************/
/* Sua_RemoteList::Dest_Unavailable */
/***********************************************************************/
void db_Sua_RemoteList:: Dest_Unavailable( SS7union pc)
{
int i = 0;
bool found_pc = false;
while (( i < num_of_instance ) && (!found_pc))
{
i++;
if (pc.ITU14.family == ITU14bit) // standard ITU: 14 bits
found_pc = ((pc.ITU14.pc == instance[i].Dest.pc.ITU14.pc));
else if (pc.ITU24.family == ITU24bit) // chinese PC length: 24 bits
found_pc = ((pc.ITU24.pc == instance[i].Dest.pc.ITU24.pc));
else if (pc.ANSI24.family == ANSI24bit) // ANSI PC length: 24 bits
found_pc = ((pc.ANSI24.pc == instance[i].Dest.pc.ANSI24.pc));
else
found_pc = false;
};
if (found_pc)
instance[i].status = ssnm_unavailable;
}
/***********************************************************************/
/* Sua_RemoteList::deactivate_dests */
/***********************************************************************/
void db_Sua_RemoteList:: Deactivate_dests( unsigned int sua_assoc_id)
{
int i = 0;
while (( i < num_of_instance ))
{
i++;
if (sua_assoc_id == instance[i].SUA_assoc_id) // found assoc_id
instance[i].status = ssnm_unavailable;
}
}
/***********************************************************************/
/* Sua_RemoteList::Activate_dests */
/***********************************************************************/
void db_Sua_RemoteList:: Activate_dests( unsigned int sua_assoc_id)
{
int i = 0;
while (( i < num_of_instance ))
{
i++;
if (sua_assoc_id == instance[i].SUA_assoc_id) // found assoc_id
instance[i].status = ssnm_available;
}
}
/***********************************************************************/
/* Sua_RemoteList::get_Dest_status */
/***********************************************************************/
snm_Sua_pc_state_set db_Sua_RemoteList:: get_Dest_status( SS7union pc )
{
int i = 0;
bool found_pc = false;
while (( i < num_of_instance ) && (!found_pc))
{
i++;
if (pc.ITU14.family == ITU14bit) // standard ITU: 14 bits
found_pc = ((pc.ITU14.pc == instance[i].Dest.pc.ITU14.pc));
else if (pc.ITU24.family == ITU24bit) // chinese PC length: 24 bits
found_pc = ((pc.ITU24.pc == instance[i].Dest.pc.ITU24.pc));
else if (pc.ANSI24.family == ANSI24bit) // ANSI PC length: 24 bits
found_pc = ((pc.ANSI24.pc == instance[i].Dest.pc.ANSI24.pc));
else
found_pc = false;
}
if (found_pc)
return(instance[i].status);
else
return(ssnm_unavailable);
}
/***********************************************************************/
/* Sua_RemoteList::found */
/***********************************************************************/
bool db_Sua_RemoteList:: found( SS7union pc ){
int i = 0;
bool found_pc = false;
while (( i < num_of_instance ) && (!found_pc))
{
i++;
if (pc.ITU14.family == ITU14bit) // standard ITU: 14 bits
found_pc = ((pc.ITU14.pc == instance[i].Dest.pc.ITU14.pc));
else if (pc.ITU24.family == ITU24bit) // chinese PC length: 24 bits
found_pc = ((pc.ITU24.pc == instance[i].Dest.pc.ITU24.pc));
else if (pc.ANSI24.family == ANSI24bit) // ANSI PC length: 24 bits
found_pc = ((pc.ANSI24.pc == instance[i].Dest.pc.ANSI24.pc));
else
found_pc = false;
}
return(found_pc);
}
/***********************************************************************/
/* functions of the object class SUA Application Server Process (ASP) */
/***********************************************************************/

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_database.h,v 1.4 2003/01/31 11:36:39 p82609 Exp $
* $Id: sua_database.h,v 1.7 2003/08/28 09:30:20 p82609 Exp $
*
* SUA implementation according to SUA draft issue 8.
*
@ -69,6 +69,7 @@
#include "sua.h"
#include "sua_asp_mgnt.h"
#include "sua_snm_mgnt.h"
#include <string>
@ -143,6 +144,7 @@ class db_Sua_LocalList{
);
short unregister_instance();
void increase_instance();
bool found( SS7union pc);
}; ///:~
/***********************************************************************/
@ -150,11 +152,13 @@ class db_Sua_LocalList{
/***********************************************************************/
class db_Sua_RemoteObject{
public:
db_Sua_SSNObject ssn;
db_Sua_SSNObject ssn;
/* contains the association sua id with which it is linked. */
unsigned int SUA_assoc_id;
unsigned int SUA_assoc_id;
/* status of the remote node */
snm_Sua_pc_state_set status;
/* dest address of the remote sua node */
db_Sua_AddressObject Dest;
db_Sua_AddressObject Dest;
public:
// functions of the Class
void initialize();
@ -171,6 +175,12 @@ class db_Sua_RemoteList{
void initialize();
void read_ssn(string ssn);
void increase_instance();
bool found( SS7union pc);
void Dest_Available( SS7union pc);
void Dest_Unavailable( SS7union pc);
void Activate_dests( unsigned int sua_assoc_id);
void Deactivate_dests( unsigned int sua_assoc_id);
snm_Sua_pc_state_set get_Dest_status(SS7union pc);
}; ///:~
/***********************************************************************/

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_dataname.cpp,v 1.2 2003/01/31 11:36:39 p82609 Exp $
* $Id: sua_dataname.cpp,v 1.4 2003/09/09 08:43:44 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@ -270,8 +270,9 @@ signed int db_Sua_NameList::perform_GTT ( global_title_str& cld_in,
pointcode_str& dest_pc
)
{
boolean search_gt = true, gt_entry_found = false;
int i, found_gt_entry;
boolean search_gt = true, gt_entry_found = false;
int i, found_gt_entry,res;
unsigned int sua_assoc_id, status;
/* resolving can be done via: */
/* - local global Titel database */
@ -290,9 +291,36 @@ signed int db_Sua_NameList::perform_GTT ( global_title_str& cld_in,
i++;
}
cout << "found_gt_entry = " << found_gt_entry << "\n";
cout << "tt = " << cld_in.Translation_Type << "\n";
cout << "NP = " << cld_in.Numbering_Plan << "\n";
cout << "NA = " << cld_in.Nature_of_Address << "\n";
cout << "CLD number of digits = " << cld_in.nr_of_digits << "\n";
cout << "CLD digits = " << cld_in.digits[0];
cout << cld_in.digits[1];
cout << cld_in.digits[2];
cout << cld_in.digits[3];
cout << cld_in.digits[4];
cout << cld_in.digits[5];
cout << cld_in.digits[6];
cout << cld_in.digits[7];
cout << cld_in.digits[8];
cout << cld_in.digits[9];
cout << cld_in.digits[10];
cout << cld_in.digits[11];
cout << "\n";
cout << "CLG number of digits = " << clg_in.nr_of_digits << "\n";
cout << "CLG digits = " << clg_in.digits << "\n";
if (gt_entry_found) {
/* get the association number from gt database */
dest_pc = get_destpc_addr(instance[found_gt_entry].SUA_assoc_id);
res = sua_get_destpc_addr(instance[found_gt_entry].SUA_assoc_id,
dest_pc,
sua_assoc_id,
status
);
return(0);
}
else
@ -317,3 +345,17 @@ void db_Sua_NameList:: increase_instance(){

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_datassoc.cpp,v 1.8 2003/02/17 14:38:08 p82609 Exp $
* $Id: sua_datassoc.cpp,v 1.9 2003/09/09 08:43:44 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@ -363,12 +363,22 @@ passive_associate( unsigned int sctp_assoc_id,
&status
);
#ifdef DEBUG
cout << "SCTP association " << sctp_assoc_id <<" result = " << result<< "\n";
#endif
#ifdef DEBUG
cout << "number of asoc = " << num_of_instance << "\n";
#endif
while ((i <= num_of_instance) && !(assoc_found)){
assoc_found = (instance[i].Dest.nr_of_addrs == status.numberOfAddresses);
if (assoc_found)
{
k = 0;
found_addr = false;
#ifdef DEBUG
cout << "same number of addresses\n";
#endif
while ((k < instance[i].Dest.nr_of_addrs) && (!found_addr))
{
j=0;
@ -380,6 +390,9 @@ passive_associate( unsigned int sctp_assoc_id,
k++;
}
if (found_addr){
#ifdef DEBUG
cout << "found same ip address\n";
#endif
assoc_found = ( found_addr && (instance[i].Dest.addrs[0].sin.sin_port == status.destPort));
assoc_instance_idx = i;
}
@ -393,6 +406,9 @@ passive_associate( unsigned int sctp_assoc_id,
{
/* unknown association added */
/* not allowed: drop it */
#ifdef DEBUG
cout << "not found ???\n";
#endif
assoc_instance_idx = 0;
result = sctp_abort(sctp_assoc_id);
}
@ -872,6 +888,10 @@ route_on_GTT ( global_title_str& dest_gt,
dest_pc
);
#ifdef DEBUG
cout << "result of GT translation : " << result << "\n";
cout << "dest IP address = " << dest_pc.ipvx.sa.sa_family << "\n";
#endif
sctp_assoc_id = route_on_IPpc( dest_pc.ipvx,
org_pc.ipvx,
sua_assoc_id

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_distribution.cpp,v 1.3 2003/01/27 16:47:43 p82609 Exp $
* $Id: sua_distribution.cpp,v 1.6 2003/09/09 08:43:25 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@ -466,8 +466,12 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
#ifdef DEBUG
cout << "SNM: Destination unavialable\n";
#endif
result = process_DUNA_msg ( sua_assoc_id,
local_sua_id,
remote_sua_id,
msg
);
char logstring[100];
sprintf(logstring, "Received DUNA msg");
event_log("sua_distribution.c",logstring);
@ -480,6 +484,12 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
cout << "SNM: Destination avialable message handling\n";
#endif
result = process_DAVA_msg ( sua_assoc_id,
local_sua_id,
remote_sua_id,
msg
);
char logstring[100];
sprintf(logstring, "Received DAVA msg");
event_log("sua_distribution.c",logstring);
@ -495,7 +505,8 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
local_sua_id,
remote_sua_id,
msg
);
);
char logstring[100];
sprintf(logstring, "Received DAUD msg");
event_log("sua_distribution.c",logstring);
@ -508,6 +519,12 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
cout << "SNM: Network congestion message handling\n";
#endif
result = process_SCON_msg ( sua_assoc_id,
local_sua_id,
remote_sua_id,
msg
);
char logstring[100];
sprintf(logstring, "Received SCON msg");
event_log("sua_distribution.c",logstring);
@ -520,6 +537,12 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
cout << "SNM: Destination User Part Unavialable message handling\n";
#endif
result = process_DUPU_msg ( sua_assoc_id,
local_sua_id,
remote_sua_id,
msg
);
char logstring[100];
sprintf(logstring, "Received DUPU msg");
event_log("sua_distribution.c",logstring);
@ -531,7 +554,13 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
#ifdef DEBUG
cout << "SNM: Destination restricted message handling\n";
#endif
result = process_DRST_msg ( sua_assoc_id,
local_sua_id,
remote_sua_id,
msg
);
char logstring[100];
sprintf(logstring, "Received DRST msg");
event_log("sua_distribution.c",logstring);
@ -949,7 +978,9 @@ void *sctp_CommunicationUpNotif( unsigned int sctp_assoc_id,
if (sua_assoc_id != 0)
{
/* send ASP-UP to remote to start activating local & remote ASP */
result = sua_send_ASPUP( sua_assoc_id
result = sua_send_ASPUP( sua_assoc_id,
false,
0
);
}
#endif
@ -998,10 +1029,17 @@ void sctp_RestartNotif( unsigned int sctp_assoc_id,
/* restart association: ASP state should be set to down */
sua.AssocDB.down(sua_assoc_id,0);
sua.remote_sua.Activate_dests(sua_assoc_id);
#ifdef DEBUG
cout << "All destination(s) activated for SUA association " << sua_assoc_id << "\n";
#endif
/* if we found the sua assoc then we restart the ASP bringup sequence */
/* as the sctp association has come back online */
/* send ASP-UP to remote to start activating local & remote ASP */
result = sua_send_ASPUP( sua_assoc_id
result = sua_send_ASPUP( sua_assoc_id,
false,
0
);
}
#endif
@ -1009,18 +1047,68 @@ void sctp_RestartNotif( unsigned int sctp_assoc_id,
}
/***********************************************************************/
/* sctp_ShutDownCompleteNotif */
/* sctp_ShutDownCompleteNotif */
/***********************************************************************/
void sctp_ShutDownCompleteNotif( unsigned int assoc_id,
void sctp_ShutDownCompleteNotif( unsigned int sctp_assoc_id,
void * ulp_data_ptr
)
{
unsigned int sua_assoc_id,local_sua_id, remote_sua_id;
#ifdef DEBUG
cout << "Received shutdown indication for association " << assoc_id << "\n";
cout << "Received shutdown indication for association " << sctp_assoc_id << "\n";
#endif
#ifdef SUA_MANAGEMENT
if ((sua_assoc_id = sua.AssocDB.Find_association(sctp_assoc_id, local_sua_id,remote_sua_id)) != 0)
{
/* if we found the sua assoc then the SUA ASP is marked down, */
/* as the sctp association has failed */
sua.AssocDB.down(sua_assoc_id, 0);
#ifdef DEBUG
cout << "ASP down for SUA association " << sua_assoc_id << "\n";
#endif
sua.remote_sua.Deactivate_dests(sua_assoc_id);
#ifdef DEBUG
cout << "All destination(s) blocked for SUA association " << sua_assoc_id << "\n";
#endif
}
#endif
}
/***********************************************************************/
/* sctp_queueStatusChangeNotif */
/***********************************************************************/
void sctp_queueStatusChangeNotif (unsigned int assoc_id,
int queue_type,
int queue_id,
int queue_length,
void* ulp_data_ptr
)
{
#ifdef DEBUG
cout << "Received a queuestatus change indication for association " << assoc_id << "\n";
#endif
}
/***********************************************************************/
/* sctp_asconfStatusNotif */
/***********************************************************************/
void sctp_asconfStatusNotif( unsigned int assoc_id,
unsigned int correlation_id,
int result,
void* temp,
void* ulp_data_ptr
)
{
#ifdef DEBUG
cout << "Received SCTP configuration indication for association " << assoc_id << "\n";
#endif
}
/***********************************************************************/
/* Send_sua_primitive */

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_distribution.h,v 1.1 2003/01/14 14:15:37 p82609 Exp $
* $Id: sua_distribution.h,v 1.2 2003/08/21 10:33:13 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@ -166,6 +166,28 @@ void sctp_ShutDownCompleteNotif( unsigned int assoc_id,
void * ulp_data_ptr
);
/***********************************************************************/
/* sctp_queueStatusChangeNotif */
/***********************************************************************/
void sctp_queueStatusChangeNotif (unsigned int assoc_id,
int queue_type,
int queue_id,
int queue_length,
void* ulp_data_ptr
);
/***********************************************************************/
/* sctp_asconfStatusNotif */
/***********************************************************************/
void sctp_asconfStatusNotif( unsigned int assoc_id,
unsigned int correlation_id,
int result,
void* temp,
void* ulp_data_ptr
);
#endif // SUA_DISTRIBUTION_H
// end of module sua_distribution.h

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_file.cpp,v 1.6 2003/01/31 11:36:39 p82609 Exp $
* $Id: sua_file.cpp,v 1.7 2003/09/09 08:43:25 p82609 Exp $
*
* SUA implementation according to SUA draft issue 13.
*
@ -761,6 +761,38 @@ void sua_cr_route_name( string route_parm_str,
}
/***********************************************************************/
/* create routing context parameter handling */
/***********************************************************************/
void sua_cr_routing_context( string rc_parm_str,
db_Sua_DatabaseList& sua
)
{
int rc_id;
short cpy_start, cpy_len;
/* get pc id from param string, use as index remote_sua table */
if (rc_parm_str.find("rc_id=") != rc_parm_str.npos)
{
cpy_start = (rc_parm_str.find("rc_id=")+8);
cpy_len = (rc_parm_str.find(",pc")) - cpy_start ;
string rc_id_str( rc_parm_str, cpy_start, cpy_len);
#ifdef DEBUG
cout << "Routing Context id = " << rc_id_str << "\n";
#endif
rc_id = atoi(rc_id_str.c_str());
}
else
return;
/* get destination pointcode from param string */
return;
}
/***********************************************************************/
/* read sua configuration file */
/***********************************************************************/
@ -863,6 +895,13 @@ int read_sua_conf_file( string filename,
sua.AssocDB
);
}
else if (cmdline.find("cr rc:rc_id") != cmdline.npos)
{
string parm_str( cmdline, (cmdline.find("cr rc:")+9),cmdline.length());
sua_cr_routing_context( parm_str,
sua
);
}
else if (cmdline.find("cr xxxx:") != cmdline.npos)
{
;

View File

@ -5,7 +5,6 @@
copyright : (C) 2002 by Lode Coene
email : lode.coene@siemens.atea.be
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
@ -15,7 +14,7 @@
* *
***************************************************************************/
/*
* $Id: sua_snm_mgnt.cpp,v 1.1 2003/01/14 14:15:37 p82609 Exp $
* $Id: sua_snm_mgnt.cpp,v 1.6 2003/08/28 09:30:20 p82609 Exp $
*
* SUA implementation according to SUA draft issue 14.
*
@ -52,7 +51,12 @@
* Purpose: This code-file defines the SUA management handling functions for
* sending and receiving SignallingNetwork Management(SNM) messages:
* - send a Destination avialeble (DAVA) msg to remote node
* - Receive/process Destination Unavailable(DUNA) msg
* - Receive/process Destination Available(DAVA) msg
* - Receive/process Destination State audit(DAUD) msg
* - Receive/process Network congestion(SCON) msg
* - Receive/process Destination User Part Unavailable(DUPU) msg
* - Receive/process Destination Restricted(DRST) msg
*/
#include "sua_debug.h"
@ -78,7 +82,8 @@ extern tcb_Sua_msgqueue_pool msg_store;
/***********************************************************************/
/* sua_send_DAVA */
/***********************************************************************/
int sua_send_DAVA( unsigned int Sua_assoc_id
int sua_send_DAVA( unsigned int Sua_assoc_id,
SS7union pc
)
{
Sua_container msg;
@ -95,8 +100,9 @@ int sua_send_DAVA( unsigned int Sua_assoc_id
// fill in the main sua header
msg.sua_prim.hdr_msg_class = sua_ssnm;
msg.sua_prim.hdr_msg_type.ssnm = ssnm_dava;
msg.sua_prim.aff_pc_pres = TRUE;
msg.sua_prim.aff_pc = 1;
msg.sua_prim.ssnm_parm.aff_pc_pres = TRUE;
msg.sua_prim.ssnm_parm.aff_pc.num_aff_pc = 1;
msg.sua_prim.ssnm_parm.aff_pc.pc[0] = pc.ITU24.pc;
msg.sua_prim.info_pres = FALSE;
// encode the SUA DAVA message
@ -148,32 +154,360 @@ int sua_send_DAVA( unsigned int Sua_assoc_id
}
/***********************************************************************/
/* sua_send_DUNA */
/***********************************************************************/
int sua_send_DUNA( unsigned int Sua_assoc_id,
SS7union pc
)
{
Sua_container msg;
Sua_syntax_error_struct error;
int error_value = 0;
int string_size, datalen;
signed int sctp_assoc_id;
short stream_id = 0;
int delivery_type, result;
// init the message
msg.sua_init();
// fill in the main sua header
msg.sua_prim.hdr_msg_class = sua_ssnm;
msg.sua_prim.hdr_msg_type.ssnm = ssnm_duna;
msg.sua_prim.ssnm_parm.aff_pc_pres = TRUE;
msg.sua_prim.ssnm_parm.aff_pc.num_aff_pc = 1;
msg.sua_prim.ssnm_parm.aff_pc.pc[0] = pc.ITU24.pc;
msg.sua_prim.info_pres = FALSE;
// encode the SUA DAVA message
error = msg.sua_encode();
string_size = msg.sua_msg.size();
delivery_type = SCTP_UNORDERED_DELIVERY;
sctp_assoc_id = sua.AssocDB.instance[Sua_assoc_id].SCTP_assoc_id;
/* does association exist? */
if (sctp_assoc_id > 0)
{
// send data to SCTP
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_snm_mgnt.c",logstring);
log_byte_array("sua_snm_mgnt.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_asp_mgnt.c:result DUNA sctp send = "<< result << "\n";
#endif
}
return(error_value);
}
/***********************************************************************/
/* sua_send_DAUD */
/***********************************************************************/
unsigned int sua_send_daud()
{
Sua_container msg;
Sua_syntax_error_struct error;
int i, error_value = 0;
int string_size, datalen;
signed int sctp_assoc_id, Sua_assoc_id;
short stream_id = 0;
int delivery_type, result;
SS7union pc;
i = 1;
while ( i <= sua.remote_sua.num_of_instance)
{
/* get pointcode from sua remote list */
pc = sua.remote_sua.instance[i].Dest.pc;
// init the message
msg.sua_init();
// fill in the main sua header
msg.sua_prim.hdr_msg_class = sua_ssnm;
msg.sua_prim.hdr_msg_type.ssnm = ssnm_daud;
msg.sua_prim.ssnm_parm.aff_pc_pres = TRUE;
msg.sua_prim.ssnm_parm.aff_pc.num_aff_pc = 1;
msg.sua_prim.ssnm_parm.aff_pc.pc[0] = pc.ITU24.pc;
msg.sua_prim.info_pres = FALSE;
// encode the SUA DAUD message
error = msg.sua_encode();
string_size = msg.sua_msg.size();
delivery_type = SCTP_UNORDERED_DELIVERY;
Sua_assoc_id = sua.remote_sua.instance[i].SUA_assoc_id;
sctp_assoc_id = sua.AssocDB.instance[Sua_assoc_id].SCTP_assoc_id;
/* does association exist? */
if (sctp_assoc_id > 0)
{
// send data to SCTP
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_snm_mgnt.c",logstring);
log_byte_array("sua_snm_mgnt.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 = error_value + result;
delete databuf;
#ifdef DEBUG
cout << "sua_asp_mgnt.c:result DAUD sctp send = "<< result << "\n";
#endif
}
/* go to next remote destination (if possible) */
i++;
}
return(error_value);
}
/***********************************************************************/
/* Receiving SUA Signalling Network Management msg */
/***********************************************************************/
/***********************************************************************/
/* sua_process_ASPUP_msg */
/* sua_process_DUNA_msg */
/***********************************************************************/
int process_DUNA_msg ( unsigned int sua_assoc_id,
int local_sua_id,
int remote_sua_id,
Sua_container sua_ssnm_msg
)
{
int error_value = 0;
SS7union rec_pc;
int num_rec_pc;
rec_pc.ITU14.family = ITU14bit;
num_rec_pc = sua_ssnm_msg.sua_prim.ssnm_parm.aff_pc.num_aff_pc;
for ( int k = 0; k < num_rec_pc; k++)
{
rec_pc.ITU14.pc = sua_ssnm_msg.sua_prim.ssnm_parm.aff_pc.pc[k];
sua.remote_sua.Dest_Unavailable(rec_pc);
}
#ifdef DEBUG
cout << "sua_snm_mgnt.c:DUNA received, mark internal : no traffic to this destination.\n";
#endif
return(error_value);
}
/***********************************************************************/
/* sua_process_DAVA_msg */
/***********************************************************************/
int process_DAVA_msg ( unsigned int sua_assoc_id,
int local_sua_id,
int remote_sua_id,
Sua_container sua_ssnm_msg
)
{
int error_value = 0;
SS7union rec_pc;
int num_rec_pc;
rec_pc.ITU14.family = ITU14bit;
num_rec_pc = sua_ssnm_msg.sua_prim.ssnm_parm.aff_pc.num_aff_pc;
for ( int k = 0; k < num_rec_pc; k++)
{
rec_pc.ITU14.pc = sua_ssnm_msg.sua_prim.ssnm_parm.aff_pc.pc[k];
sua.remote_sua.Dest_Available(rec_pc);
}
#ifdef DEBUG
cout << "sua_snm_mgnt.c:DAVA received, mark internal: traffic can be send to this destination.\n";
#endif
return(error_value);
}
/***********************************************************************/
/* sua_process_DAUD_msg */
/***********************************************************************/
int process_DAUD_msg ( unsigned int sua_assoc_id,
int local_sua_id,
int remote_sua_id,
Sua_container sua_ssnm_msg
)
{
int error_value = 0;
SS7union rec_pc;
int num_rec_pc;
#ifdef DEBUG
cout << "sua_snm_mgnt.c:DAUD received, send back a DAVA, DUNA or DRST.\n";
#endif
rec_pc.ITU14.family = ITU14bit;
num_rec_pc = sua_ssnm_msg.sua_prim.ssnm_parm.aff_pc.num_aff_pc;
for ( int k = 0; k < num_rec_pc; k++)
{
rec_pc.ITU14.pc = sua_ssnm_msg.sua_prim.ssnm_parm.aff_pc.pc[k];
/* find the local sua with the specific received PC */
if ( !sua.local_sua.found(rec_pc))
{
/* if no local found, go through the remote sua's for */
/* the specific received PC */
if (ssnm_available != sua.remote_sua.get_Dest_status(rec_pc))
{
/* if not found, then pc is not reachable. */
/* let it be known to the requesting side */
error_value = sua_send_DUNA( sua_assoc_id ,
rec_pc
);
}
else
{
/* found the pc and it is accessible/reachable */
/* let it be known to the requesting side */
error_value = sua_send_DAVA( sua_assoc_id ,
rec_pc
);
}
}
else
{
/* found the pc and it is accessible/reachable */
/* let it be known to the requesting side */
error_value = sua_send_DAVA( sua_assoc_id ,
rec_pc
);
}
#ifdef DEBUG
cout << "sua_asp_mgnt.c:result send DUNA/DAVA/DRST = "<< error_value << "\n";
#endif
}
#ifdef DEBUG
cout << "sua_asp_mgnt.c:DAUD completely processed: " << num_rec_pc << " pointcodes\n";
#endif
return(error_value);
}
/***********************************************************************/
/* sua_process_SCON_msg */
/***********************************************************************/
int process_SCON_msg ( unsigned int sua_assoc_id,
int local_sua_id,
int remote_sua_id,
Sua_container sua_asp_msg
)
{
int error_value;
int error_value = 0;
#ifdef DEBUG
cout << "sua_snm_mgnt.c:DAUD received, send back a DAVA, DUNA or DRST.\n";
cout << "sua_snm_mgnt.c:SCON received, ignore.\n";
#endif
/*sua.AssocDB.up(sua_assoc_id,0);*/
error_value = sua_send_DAVA( sua_assoc_id );
return(error_value);
}
/***********************************************************************/
/* sua_process_DUPU_msg */
/***********************************************************************/
int process_DUPU_msg ( unsigned int sua_assoc_id,
int local_sua_id,
int remote_sua_id,
Sua_container sua_asp_msg
)
{
int error_value = 0;
#ifdef DEBUG
cout << "sua_asp_mgnt.c:result send DUNA/DAVA/DRST = "<< error_value << "\n";
#endif
cout << "sua_snm_mgnt.c:DUPU received.\n";
#endif
return(error_value);
}
/***********************************************************************/
/* sua_process_DRST_msg */
/***********************************************************************/
int process_DRST_msg ( unsigned int sua_assoc_id,
int local_sua_id,
int remote_sua_id,
Sua_container sua_asp_msg
)
{
int error_value = 0;
#ifdef DEBUG
cout << "sua_snm_mgnt.c:DRST received.\n";
#endif
return(error_value);
}
@ -193,3 +527,6 @@ int process_DAUD_msg ( unsigned int sua_assoc_id,

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_snm_mgnt.h,v 1.1 2003/01/14 14:15:37 p82609 Exp $
* $Id: sua_snm_mgnt.h,v 1.3 2003/08/28 09:30:20 p82609 Exp $
*
* SUA implementation according to SUA draft issue 14.
*
@ -56,17 +56,55 @@
#include <string>
typedef enum { ssnm_unavailable,
ssnm_available,
ssnm_reserved
} snm_Sua_pc_state_set ;
int sua_send_DAVA( unsigned int Sua_assoc_id
int sua_send_DAVA( unsigned int Sua_assoc_id,
SS7union pc
);
int sua_send_DUNA( unsigned int Sua_assoc_id,
SS7union pc
);
int process_DUNA_msg ( unsigned int sua_assoc_id,
int local_sua_id,
int remote_sua_id,
Sua_container sua_asp_msg
);
int process_DAVA_msg ( unsigned int sua_assoc_id,
int local_sua_id,
int remote_sua_id,
Sua_container sua_asp_msg
);
int process_DAUD_msg ( unsigned int sua_assoc_id,
int local_sua_id,
int remote_sua_id,
Sua_container sua_asp_msg
);
int process_SCON_msg ( unsigned int sua_assoc_id,
int local_sua_id,
int remote_sua_id,
Sua_container sua_asp_msg
);
int process_DUPU_msg ( unsigned int sua_assoc_id,
int local_sua_id,
int remote_sua_id,
Sua_container sua_asp_msg
);
int process_DRST_msg ( unsigned int sua_assoc_id,
int local_sua_id,
int remote_sua_id,
Sua_container sua_asp_msg
);
#endif // SUA_SNM_MGNT_H
//end of module sua_snm_mgnt.h

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_syntax.cpp,v 1.5 2003/02/17 14:38:08 p82609 Exp $
* $Id: sua_syntax.cpp,v 1.10 2003/08/26 11:43:57 p82609 Exp $
*
* SUA implementation according to SUA draft issue 8.
*
@ -97,9 +97,11 @@ void Sua_container::sua_init () {
sua_prim.traf_mode_pres = FALSE;
sua_prim.err_code_pres = FALSE;
sua_prim.status_pres = FALSE;
sua_prim.cong_lvl_pres = FALSE;
sua_prim.ssnm_parm.cong_lvl_pres = FALSE;
sua_prim.ASP_id_pres = FALSE;
sua_prim.aff_pc_pres = FALSE;
sua_prim.ssnm_parm.aff_pc_pres = FALSE;
sua_prim.ssnm_parm.SSN_pres = FALSE;
sua_prim.ssnm_parm.SMI_pres = FALSE;
sua_prim.hop_count_pres = FALSE;
sua_prim.source_addr_pres = FALSE;
sua_prim.dest_addr_pres = FALSE;
@ -426,6 +428,42 @@ boolean encode_error_code (string& msg, Sua_error_code_type err_code) {
}
}
boolean encode_aff_pc (string& msg, Sua_affected_pc_struct& affected_pc) {
/* Reserve 8 bytes for affected pointcode type */
int pdu_index = msg.size();
if ((affected_pc.num_aff_pc <= 0) ||
(affected_pc.num_aff_pc > 10))
{
/* Signal error : parameter out of range */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Encoding : num_aff_pc out of range( <> 1..10) ";
return FALSE;
}
msg.resize(pdu_index + 4 + (affected_pc.num_aff_pc * 4));
/* Encode tag */
OVERLAY.dw[0] = htons(0x0012);
msg[pdu_index] = OVERLAY.db[0];
pdu_index++;
msg[pdu_index] = OVERLAY.db[1];
pdu_index++;
/* Encode length */
OVERLAY.dw[1] = htons(4 + (affected_pc.num_aff_pc * 4));
msg[pdu_index] = OVERLAY.db[2];
pdu_index++;
msg[pdu_index] = OVERLAY.db[3];
pdu_index++;
for (int k = 0; k < affected_pc.num_aff_pc; k++)
{
/* Encode value pointcode */
OVERLAY.dq = htonl(uint32_t(affected_pc.pc[k]));
for (int i = 0; i < 4; i++)
msg[pdu_index + i] = OVERLAY.db[i];
}
return TRUE;
}
/* 1.1.2 SUA specific parameters */
boolean encode_hop_count (string& msg, uint8_t hop_count) {
@ -1161,6 +1199,101 @@ boolean encode_DRN_label (string& msg, Sua_label_struct DRN_label) {
/* 1.2 Message encoding procedures */
/* 1.2.3 Signalling network management messages */
boolean encode_ssnm_duna_msg (Sua_primitive_struct& prim, string& msg) {
/* Following parameters are mandatory :
- affected pointcode(single) (list of aff. PC's is not supported yet)
Following parameters are optional :
- routing context
- subsystem number (SSN)
- (SMI)
- cause / user
- Info string
*/
boolean no_error = TRUE;
if (prim.rout_con_pres)
no_error = encode_rout_con (msg, prim.rout_con);
if (prim.ssnm_parm.aff_pc_pres && no_error)
no_error = encode_aff_pc (msg, prim.ssnm_parm.aff_pc);
else {
/* Signal error : mandatory parameter missing */
SYNTAX_ERR.error_text = "Encoding : DUNA :affected pointcode missing";
return FALSE;
}
/* no support yet for SSN in msg */
/*if (prim.ssnm_parm.ssn_pres && no_error)
no_error = encode_ssn (msg, prim.ssnm_parm.ssn);*/
/* no support yet for Cause/user */
/*if (prim.ssnm_parm._pres && no_error)
no_error = encode_affected_pc (msg, prim.aff_pc);*/
if (prim.info_pres && no_error)
no_error = encode_info (msg, prim.info_string);
return no_error;
}
boolean encode_ssnm_dava_msg (Sua_primitive_struct& prim, string& msg) {
/* Following parameters are mandatory :
- affected pointcode(single) (list of aff. PC's is not supported yet)
Following parameters are optional :
- routing context
- subsystem number (SSN)
- (SMI)
- cause / user
- Info string
*/
boolean no_error = TRUE;
if (prim.rout_con_pres)
no_error = encode_rout_con (msg, prim.rout_con);
if (prim.ssnm_parm.aff_pc_pres && no_error)
no_error = encode_aff_pc (msg, prim.ssnm_parm.aff_pc);
else {
/* Signal error : mandatory parameter missing */
SYNTAX_ERR.error_text = "Encoding : DAVA :affected pointcode missing";
return FALSE;
}
/* no support yet for SSN in msg */
/*if (prim.ssnm_parm.ssn_pres && no_error)
no_error = encode_ssn (msg, prim.ssnm_parm.ssn);*/
/* no support yet for Cause/user */
if (prim.info_pres && no_error)
no_error = encode_info (msg, prim.info_string);
return no_error;
}
boolean encode_ssnm_daud_msg (Sua_primitive_struct& prim, string& msg) {
/* Following parameters are mandatory :
- affected pointcode(single) (list of aff. PC's is not supported yet)
Following parameters are optional :
- routing context
- subsystem number (SSN)
- cause / user
- Info string
*/
boolean no_error = TRUE;
if (prim.rout_con_pres)
no_error = encode_rout_con (msg, prim.rout_con);
if (prim.ssnm_parm.aff_pc_pres && no_error)
no_error = encode_aff_pc (msg, prim.ssnm_parm.aff_pc);
else {
/* Signal error : mandatory parameter missing */
SYNTAX_ERR.error_text = "Encoding : DAUD :affected pointcode missing";
return FALSE;
}
/* no support yet for SSN in msg */
/*if (prim.ssnm_parm.ssn_pres && no_error)
no_error = encode_ssn (msg, prim.ssnm_parm.ssn);*/
/* no support yet for Cause/user */
/*if (prim.ssnm_parm._pres && no_error)
no_error = encode_affected_pc (msg, prim.aff_pc);*/
if (prim.info_pres && no_error)
no_error = encode_info (msg, prim.info_string);
return no_error;
}
/* 1.2.3 ASP Server Management messages */
boolean encode_ASP_up_msg (Sua_primitive_struct& prim, string& msg) {
@ -1171,7 +1304,7 @@ boolean encode_ASP_up_msg (Sua_primitive_struct& prim, string& msg) {
boolean no_error = TRUE;
if (prim.ASP_id_pres)
no_error = encode_ASP_id (msg, prim.ASP_id);
if (prim.info_pres)
if (prim.info_pres && no_error)
no_error = encode_info (msg, prim.info_string);
return no_error;
}
@ -1897,6 +2030,10 @@ Sua_syntax_error_struct Sua_container::sua_encode () {
/* Encode message type according to class */
switch (sua_prim.hdr_msg_class) {
case sua_ssnm :
sua_msg[pdu_index] = uint8_t(sua_prim.hdr_msg_type.ssnm);
pdu_index++;
break;
case sua_aspsm :
sua_msg[pdu_index] = uint8_t(sua_prim.hdr_msg_type.aspsm);
pdu_index++;
@ -1925,6 +2062,34 @@ Sua_syntax_error_struct Sua_container::sua_encode () {
/* The message length field is encoded at the end, pdu_index is kept at this position */
/* Start encoding of message parameters : double switch ! */
switch (sua_prim.hdr_msg_class) {
case sua_ssnm :
switch (sua_prim.hdr_msg_type.ssnm) {
case ssnm_duna :
no_error = encode_ssnm_duna_msg (sua_prim, sua_msg);
break;
case ssnm_dava :
no_error = encode_ssnm_dava_msg (sua_prim, sua_msg);
break;
case ssnm_daud :
no_error = encode_ssnm_daud_msg (sua_prim, sua_msg);
break;
case ssnm_scon :
;
break;
case ssnm_dupu :
;
break;
case ssnm_drst :
;
break;
default : {
/* Signal error : invalid message type */
SYNTAX_ERR.msg_index = 3;
SYNTAX_ERR.error_text = "Encoding : Invalid sua_ssnm message type";
no_error = FALSE;
}
} // End switch ssnm msg type
break;
case sua_aspsm :
switch (sua_prim.hdr_msg_type.aspsm) {
case aspsm_up :
@ -2258,6 +2423,38 @@ boolean decode_error_code (Sua_primitive_struct& prim, string& msg, unsigned int
}
}
boolean decode_aff_pc (Sua_primitive_struct& prim, string& msg, unsigned int& pdu_index) {
/* The parameter length should be 8 bytes */
OVERLAY.db[0] = msg[pdu_index + 2];
OVERLAY.db[1] = msg[pdu_index + 3];
uint16_t par_len = ntohs(OVERLAY.dw[0]);
if ((par_len > 4)|| (par_len <= 44)) {
/* Decode affected pointcode */
prim.ssnm_parm.aff_pc_pres = TRUE;
prim.ssnm_parm.aff_pc.num_aff_pc = ((par_len - 4) / 4);
pdu_index += 4;
for ( int k = 0; k < prim.ssnm_parm.aff_pc.num_aff_pc; k++)
{
for (int i = 0; i < 4; i++) {
OVERLAY.db[i] = msg[pdu_index + i];
}
prim.ssnm_parm.aff_pc.pc[k] = ntohl(OVERLAY.dq);
pdu_index += 4; // Next aff_pc value(if more than 1) or next tag
}
return TRUE;
}
else {
/* Signal error : invalid parameter length */
SYNTAX_ERR.msg_index = pdu_index + 2;
SYNTAX_ERR.error_text = "Decoding : Invalid affected pointcode length";
return FALSE;
}
}
/* 2.1.2 SUA specific parameters */
boolean decode_hop_count (Sua_primitive_struct& prim, string& msg, unsigned int& pdu_index) {
@ -2929,8 +3126,603 @@ boolean decode_DRN_label (Sua_primitive_struct& prim, string& msg, unsigned int&
}
}
boolean decode_SSN (Sua_primitive_struct& prim, string& msg, unsigned int& pdu_index) {
/* The parameter length should be 8 bytes */
OVERLAY.db[0] = msg[pdu_index + 2];
OVERLAY.db[1] = msg[pdu_index + 3];
uint16_t par_len = ntohs(OVERLAY.dw[0]);
if (par_len == 8) {
/* Decode SSN */
prim.ssnm_parm.SSN_pres = TRUE;
pdu_index += 4;
for (int i = 0; i < 4; i++) {
OVERLAY.db[i] = msg[pdu_index + i];
}
prim.ssnm_parm.SSN = ntohl(OVERLAY.db[3]);
pdu_index += 4; // Next tag
return TRUE;
}
else {
/* Signal error : invalid parameter length */
SYNTAX_ERR.msg_index = pdu_index + 2;
SYNTAX_ERR.error_text = "Decoding : Invalid SSN length";
return FALSE;
}
}
boolean decode_SMI (Sua_primitive_struct& prim, string& msg, unsigned int& pdu_index) {
/* The parameter length should be 8 bytes */
OVERLAY.db[0] = msg[pdu_index + 2];
OVERLAY.db[1] = msg[pdu_index + 3];
uint16_t par_len = ntohs(OVERLAY.dw[0]);
if (par_len == 8) {
/* Decode SMI */
prim.ssnm_parm.SMI_pres = TRUE;
pdu_index += 4;
for (int i = 0; i < 4; i++) {
OVERLAY.db[i] = msg[pdu_index + i];
}
prim.ssnm_parm.SMI = ntohl(OVERLAY.db[3]);
pdu_index += 4; // Next tag
return TRUE;
}
else {
/* Signal error : invalid parameter length */
SYNTAX_ERR.msg_index = pdu_index + 2;
SYNTAX_ERR.error_text = "Decoding : Invalid SMI length";
return FALSE;
}
}
boolean decode_cong_lvl (Sua_primitive_struct& prim, string& msg, unsigned int& pdu_index) {
/* The parameter length should be 8 bytes */
OVERLAY.db[0] = msg[pdu_index + 2];
OVERLAY.db[1] = msg[pdu_index + 3];
uint16_t par_len = ntohs(OVERLAY.dw[0]);
if (par_len == 8) {
/* Decode congestion level */
prim.ssnm_parm.cong_lvl_pres = TRUE;
pdu_index += 4;
for (int i = 0; i < 4; i++) {
OVERLAY.db[i] = msg[pdu_index + i];
}
prim.ssnm_parm.cong_lvl = ntohl(OVERLAY.db[3]);
pdu_index += 4; // Next tag
return TRUE;
}
else {
/* Signal error : invalid parameter length */
SYNTAX_ERR.msg_index = pdu_index + 2;
SYNTAX_ERR.error_text = "Decoding : Invalid congestion level length";
return FALSE;
}
}
/* 2.2 Message decoding procedures */
/* 2.2.2 Signalling Network Management messages */
boolean decode_ssnm_duna_msg (Sua_primitive_struct& prim, string& msg) {
boolean no_error = TRUE;
uint32_t msg_len = ntohl(OVERLAY.dq);
unsigned int pdu_index = 8;
/* Check whether further parameters are present, at least tag & length fields must be there */
uint16_t par_tag, par_len;
while ((msg_len >= (pdu_index + 3)) && no_error) {
/* Evaluate parameter length */
OVERLAY.db[2] = msg[pdu_index + 2];
OVERLAY.db[3] = msg[pdu_index + 3];
par_len = ntohs(OVERLAY.dw[1]);
if ((pdu_index + par_len) <= msg_len) {
/* Evaluate parameter tag and call corresponding decoding routine or jump over it */
OVERLAY.db[0] = msg[pdu_index];
OVERLAY.db[1] = msg[pdu_index + 1];
par_tag = ntohs(OVERLAY.dw[0]);
switch (par_tag) {
case 0x0006 :
if (!prim.rout_con_pres)
no_error = decode_rout_con (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate Routing context parameter";
return FALSE;
}
break;
case 0x0012 :
if (!prim.ssnm_parm.aff_pc_pres)
no_error = decode_aff_pc (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate affected pointcode parameter";
return FALSE;
}
break;
case 0x8003:
if (!prim.ssnm_parm.SSN_pres)
no_error = decode_SSN (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate SSN parameter";
return FALSE;
}
break;
case 0x010c:
if (!prim.SCCP_cause_pres)
no_error = decode_SCCP_cause (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate SCCP cause parameter";
return FALSE;
}
case 0x0004 :
if (!prim.info_pres)
no_error = decode_info (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate Info parameter";
return FALSE;
}
break;
default : {
/* Jump over this totally uninteresting parameter to next double word position */
par_len += (4 - (par_len % 4)) % 4;
pdu_index += par_len;
}
} // End switch parameter tag
}
else {
/* Signal error : invalid parameter length */
SYNTAX_ERR.msg_index = pdu_index + 2;
SYNTAX_ERR.error_text = "Decoding : Parameter length overflow";
return FALSE;
} // End parameter length check
} // End while parameters present
/* No checks for mandatory parameters are needed */
return no_error;
}
boolean decode_ssnm_dava_msg (Sua_primitive_struct& prim, string& msg) {
boolean no_error = TRUE;
uint32_t msg_len = ntohl(OVERLAY.dq);
unsigned int pdu_index = 8;
/* Check whether further parameters are present, at least tag & length fields must be there */
uint16_t par_tag, par_len;
while ((msg_len >= (pdu_index + 3)) && no_error) {
/* Evaluate parameter length */
OVERLAY.db[2] = msg[pdu_index + 2];
OVERLAY.db[3] = msg[pdu_index + 3];
par_len = ntohs(OVERLAY.dw[1]);
if ((pdu_index + par_len) <= msg_len) {
/* Evaluate parameter tag and call corresponding decoding routine or jump over it */
OVERLAY.db[0] = msg[pdu_index];
OVERLAY.db[1] = msg[pdu_index + 1];
par_tag = ntohs(OVERLAY.dw[0]);
switch (par_tag) {
case 0x0006 :
if (!prim.rout_con_pres)
no_error = decode_rout_con (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate Routing context parameter";
return FALSE;
}
break;
case 0x0012 :
if (!prim.ssnm_parm.aff_pc_pres)
no_error = decode_aff_pc (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate affected pointcode parameter";
return FALSE;
}
break;
case 0x8003:
if (!prim.ssnm_parm.SSN_pres)
no_error = decode_SSN (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate SSN parameter";
return FALSE;
}
break;
case 0x010c:
if (!prim.SCCP_cause_pres)
no_error = decode_SCCP_cause (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate SCCP cause parameter";
return FALSE;
}
case 0x0004 :
if (!prim.info_pres)
no_error = decode_info (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate Info parameter";
return FALSE;
}
break;
default : {
/* Jump over this totally uninteresting parameter to next double word position */
par_len += (4 - (par_len % 4)) % 4;
pdu_index += par_len;
}
} // End switch parameter tag
}
else {
/* Signal error : invalid parameter length */
SYNTAX_ERR.msg_index = pdu_index + 2;
SYNTAX_ERR.error_text = "Decoding : Parameter length overflow";
return FALSE;
} // End parameter length check
} // End while parameters present
/* No checks for mandatory parameters are needed */
return no_error;
}
boolean decode_ssnm_daud_msg (Sua_primitive_struct& prim, string& msg) {
boolean no_error = TRUE;
uint32_t msg_len = ntohl(OVERLAY.dq);
unsigned int pdu_index = 8;
/* Check whether further parameters are present, at least tag & length fields must be there */
uint16_t par_tag, par_len;
while ((msg_len >= (pdu_index + 3)) && no_error) {
/* Evaluate parameter length */
OVERLAY.db[2] = msg[pdu_index + 2];
OVERLAY.db[3] = msg[pdu_index + 3];
par_len = ntohs(OVERLAY.dw[1]);
if ((pdu_index + par_len) <= msg_len) {
/* Evaluate parameter tag and call corresponding decoding routine or jump over it */
OVERLAY.db[0] = msg[pdu_index];
OVERLAY.db[1] = msg[pdu_index + 1];
par_tag = ntohs(OVERLAY.dw[0]);
switch (par_tag) {
case 0x0006 :
if (!prim.rout_con_pres)
no_error = decode_rout_con (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate Routing context parameter";
return FALSE;
}
break;
case 0x0012 :
if (!prim.ssnm_parm.aff_pc_pres)
no_error = decode_aff_pc (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate affected pointcode parameter";
return FALSE;
}
break;
case 0x8003:
if (!prim.ssnm_parm.SSN_pres)
no_error = decode_SSN (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate SSN parameter";
return FALSE;
}
break;
case 0x010c:
if (!prim.SCCP_cause_pres)
no_error = decode_SCCP_cause (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate SCCP cause parameter";
return FALSE;
}
break;
case 0x0004 :
if (!prim.info_pres)
no_error = decode_info (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate Info parameter";
return FALSE;
}
break;
default : {
/* Jump over this totally uninteresting parameter to next double word position */
par_len += (4 - (par_len % 4)) % 4;
pdu_index += par_len;
}
} // End switch parameter tag
}
else {
/* Signal error : invalid parameter length */
SYNTAX_ERR.msg_index = pdu_index + 2;
SYNTAX_ERR.error_text = "Decoding : Parameter length overflow";
return FALSE;
} // End parameter length check
} // End while parameters present
/* No checks for mandatory parameters are needed */
return no_error;
}
boolean decode_ssnm_scon_msg (Sua_primitive_struct& prim, string& msg) {
boolean no_error = TRUE;
uint32_t msg_len = ntohl(OVERLAY.dq);
unsigned int pdu_index = 8;
/* Check whether further parameters are present, at least tag & length fields must be there */
uint16_t par_tag, par_len;
while ((msg_len >= (pdu_index + 3)) && no_error) {
/* Evaluate parameter length */
OVERLAY.db[2] = msg[pdu_index + 2];
OVERLAY.db[3] = msg[pdu_index + 3];
par_len = ntohs(OVERLAY.dw[1]);
if ((pdu_index + par_len) <= msg_len) {
/* Evaluate parameter tag and call corresponding decoding routine or jump over it */
OVERLAY.db[0] = msg[pdu_index];
OVERLAY.db[1] = msg[pdu_index + 1];
par_tag = ntohs(OVERLAY.dw[0]);
switch (par_tag) {
case 0x0006 :
if (!prim.rout_con_pres)
no_error = decode_rout_con (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate Routing context parameter";
return FALSE;
}
break;
case 0x0012 :
if (!prim.ssnm_parm.aff_pc_pres)
no_error = decode_aff_pc (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate affected pointcode parameter";
return FALSE;
}
break;
case 0x8003:
if (!prim.ssnm_parm.SSN_pres)
no_error = decode_SSN (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate SSN parameter";
return FALSE;
}
break;
case 0x0118:
if (!prim.ssnm_parm.cong_lvl_pres)
no_error = decode_cong_lvl (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate SCCP cause parameter";
return FALSE;
}
break;
case 0x0112:
if (!prim.ssnm_parm.SMI_pres)
no_error = decode_SMI (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate SCCP cause parameter";
return FALSE;
}
break;
case 0x0004 :
if (!prim.info_pres)
no_error = decode_info (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate Info parameter";
return FALSE;
}
break;
default : {
/* Jump over this totally uninteresting parameter to next double word position */
par_len += (4 - (par_len % 4)) % 4;
pdu_index += par_len;
}
} // End switch parameter tag
}
else {
/* Signal error : invalid parameter length */
SYNTAX_ERR.msg_index = pdu_index + 2;
SYNTAX_ERR.error_text = "Decoding : Parameter length overflow";
return FALSE;
} // End parameter length check
} // End while parameters present
/* No checks for mandatory parameters are needed */
return no_error;
}
boolean decode_ssnm_dupu_msg (Sua_primitive_struct& prim, string& msg) {
boolean no_error = TRUE;
uint32_t msg_len = ntohl(OVERLAY.dq);
unsigned int pdu_index = 8;
/* Check whether further parameters are present, at least tag & length fields must be there */
uint16_t par_tag, par_len;
while ((msg_len >= (pdu_index + 3)) && no_error) {
/* Evaluate parameter length */
OVERLAY.db[2] = msg[pdu_index + 2];
OVERLAY.db[3] = msg[pdu_index + 3];
par_len = ntohs(OVERLAY.dw[1]);
if ((pdu_index + par_len) <= msg_len) {
/* Evaluate parameter tag and call corresponding decoding routine or jump over it */
OVERLAY.db[0] = msg[pdu_index];
OVERLAY.db[1] = msg[pdu_index + 1];
par_tag = ntohs(OVERLAY.dw[0]);
switch (par_tag) {
case 0x0006 :
if (!prim.rout_con_pres)
no_error = decode_rout_con (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate Routing context parameter";
return FALSE;
}
break;
case 0x0012 :
if (!prim.ssnm_parm.aff_pc_pres)
no_error = decode_aff_pc (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate affected pointcode parameter";
return FALSE;
}
break;
case 0x010c:
if (!prim.SCCP_cause_pres)
no_error = decode_SCCP_cause (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate SCCP cause parameter";
return FALSE;
}
break;
case 0x0004 :
if (!prim.info_pres)
no_error = decode_info (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate Info parameter";
return FALSE;
}
break;
default : {
/* Jump over this totally uninteresting parameter to next double word position */
par_len += (4 - (par_len % 4)) % 4;
pdu_index += par_len;
}
} // End switch parameter tag
}
else {
/* Signal error : invalid parameter length */
SYNTAX_ERR.msg_index = pdu_index + 2;
SYNTAX_ERR.error_text = "Decoding : Parameter length overflow";
return FALSE;
} // End parameter length check
} // End while parameters present
/* No checks for mandatory parameters are needed */
return no_error;
}
boolean decode_ssnm_drst_msg (Sua_primitive_struct& prim, string& msg) {
boolean no_error = TRUE;
uint32_t msg_len = ntohl(OVERLAY.dq);
unsigned int pdu_index = 8;
/* Check whether further parameters are present, at least tag & length fields must be there */
uint16_t par_tag, par_len;
while ((msg_len >= (pdu_index + 3)) && no_error) {
/* Evaluate parameter length */
OVERLAY.db[2] = msg[pdu_index + 2];
OVERLAY.db[3] = msg[pdu_index + 3];
par_len = ntohs(OVERLAY.dw[1]);
if ((pdu_index + par_len) <= msg_len) {
/* Evaluate parameter tag and call corresponding decoding routine or jump over it */
OVERLAY.db[0] = msg[pdu_index];
OVERLAY.db[1] = msg[pdu_index + 1];
par_tag = ntohs(OVERLAY.dw[0]);
switch (par_tag) {
case 0x0006 :
if (!prim.rout_con_pres)
no_error = decode_rout_con (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate Routing context parameter";
return FALSE;
}
break;
case 0x0012 :
if (!prim.ssnm_parm.aff_pc_pres)
no_error = decode_aff_pc (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate affected pointcode parameter";
return FALSE;
}
break;
case 0x8003:
if (!prim.ssnm_parm.SSN_pres)
no_error = decode_SSN (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate SSN parameter";
return FALSE;
}
break;
case 0x0112:
if (!prim.ssnm_parm.SMI_pres)
no_error = decode_SMI (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate SMI parameter";
return FALSE;
}
break;
case 0x0004 :
if (!prim.info_pres)
no_error = decode_info (prim, msg, pdu_index);
else {
/* Signal error : duplicate parameter */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Duplicate Info parameter";
return FALSE;
}
break;
default : {
/* Jump over this totally uninteresting parameter to next double word position */
par_len += (4 - (par_len % 4)) % 4;
pdu_index += par_len;
}
} // End switch parameter tag
}
else {
/* Signal error : invalid parameter length */
SYNTAX_ERR.msg_index = pdu_index + 2;
SYNTAX_ERR.error_text = "Decoding : Parameter length overflow";
return FALSE;
} // End parameter length check
} // End while parameters present
/* No checks for mandatory parameters are needed */
return no_error;
}
/* 2.2.3 ASP Server Management messages */
boolean decode_ASP_up_msg (Sua_primitive_struct& prim, string& msg) {
@ -4717,6 +5509,44 @@ Sua_syntax_error_struct Sua_container::sua_decode () {
/* Check message class and type, with call to corresponding msg decoding procedure */
pdu_byte = uint8_t(sua_msg[2]);
switch (pdu_byte) {
case uint8_t(sua_ssnm) :
sua_prim.hdr_msg_class = sua_ssnm;
/* Check signalling network management msg type */
pdu_byte = uint8_t(sua_msg[3]);
switch (pdu_byte) {
case uint8_t(ssnm_duna) :
sua_prim.hdr_msg_type.ssnm = ssnm_duna;
no_error = decode_ssnm_duna_msg (sua_prim, sua_msg);
break;
case uint8_t(ssnm_dava) :
sua_prim.hdr_msg_type.ssnm = ssnm_dava;
no_error = decode_ssnm_dava_msg (sua_prim, sua_msg);
break;
case uint8_t(ssnm_daud) :
sua_prim.hdr_msg_type.ssnm = ssnm_daud;
no_error = decode_ssnm_daud_msg (sua_prim, sua_msg);
break;
case uint8_t(ssnm_scon) :
sua_prim.hdr_msg_type.ssnm = ssnm_scon;
no_error = decode_ssnm_scon_msg (sua_prim, sua_msg);
break;
case uint8_t(ssnm_dupu) :
sua_prim.hdr_msg_type.ssnm = ssnm_dupu;
no_error = decode_ssnm_dupu_msg (sua_prim, sua_msg);
break;
case uint8_t(ssnm_drst) :
sua_prim.hdr_msg_type.ssnm = ssnm_drst;
no_error = decode_ssnm_drst_msg (sua_prim, sua_msg);
break;
default : {
sua_prim.hdr_msg_type.ssnm = ssnm_reserved0;
/* Signal error : invalid message type */
SYNTAX_ERR.msg_index = 3;
SYNTAX_ERR.error_text = "Decoding : Invalid Signalling Network Management message type";
no_error = FALSE;
}
} // End switch ssnm msg
break;
case uint8_t(sua_aspsm) :
sua_prim.hdr_msg_class = sua_aspsm;
/* Check ASP server management msg type */

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: sua_syntax.h,v 1.1 2003/01/14 14:15:37 p82609 Exp $
* $Id: sua_syntax.h,v 1.3 2003/08/26 11:43:57 p82609 Exp $
*
* SUA implementation according to SUA draft issue 5.
*
@ -354,6 +354,26 @@ typedef struct {
uint16_t label_value;
} Sua_label_struct;
/* the affected Pointcode contains:
- number of aff_pc in msg(max 10 )
- pointcodes (0..n-1)
*/
typedef struct {
uint8_t num_aff_pc;
uint32_t pc[10];
} Sua_affected_pc_struct;
typedef struct {
boolean aff_pc_pres;
boolean SSN_pres;
boolean SMI_pres;
boolean cong_lvl_pres;
Sua_affected_pc_struct aff_pc;
uint8_t SSN;
uint32_t SMI;
uint8_t cong_lvl;
} Sua_ssnm_struct;
/* And now, we present to you the SUA container, mother of all interfaces */
typedef struct {
@ -370,9 +390,7 @@ typedef struct {
boolean traf_mode_pres;
boolean err_code_pres;
boolean status_pres;
boolean cong_lvl_pres;
boolean ASP_id_pres;
boolean aff_pc_pres;
/* 1. Common parameter part */
string data_string;
string info_string;
@ -382,9 +400,8 @@ typedef struct {
Sua_traffic_mode_type traf_mode;
Sua_error_code_type err_code;
Sua_status_struct status;
uint8_t cong_lvl;
Sua_ssnm_struct ssnm_parm;
uint32_t ASP_id;
uint32_t aff_pc;
/* 2. SUA specific parameter part presence */
boolean netw_app_pres;
boolean hop_count_pres;

View File

@ -1,10 +1,6 @@
####### kdevelop will overwrite this part!!! (begin)##########
noinst_LIBRARIES = libtestup.a
libtestup_a_SOURCES = testuser.cpp main.cpp
EXTRA_DIST = main.cpp testuser.cpp testuser.h
EXTRA_DIST = main.cpp testuser.cpp testuser.h pcg729.sua sigtran.sua
####### kdevelop will overwrite this part!!! (end)############
noinst_PROGRAMS = testup

View File

@ -0,0 +1,39 @@
/ pcg729.sua
/ configuration file for sua setup
/ create SUA local instantation.
cr host:host_id=1,org_ip=139.10.139.233,org_port=14001,ssn=5,streams=16;
/ create associations
cr assoc:assoc_id=1,init=true,host_id=1,dest_ip=139.10.138.159,dest_port=14001;
/ create orgination pointcode
cr orgpc:host_id=1,pc=10;
/ create origination name
cr orgname:host_id=1,name=pcg729.atea.be;
cr orggt:host_id=1,digits=10;
/ create destination pointcode
cr destpc:dest_id=1,pc=20;
cr destpc:dest_id=2,pc=30;
cr destpc:dest_id=3,pc=999;
/ create destination IP address
cr destip:dest_id=1,ip=139.10.138.159;
cr destip:dest_id=2,ip=139.10.137.223;
/ create destination name
cr destname:dname_id=1,name=pcn735.atea.be;
cr destname:dname_id=2,digits=20;
cr destname:dname_id=3,digits=30;
/ create route
cr route:dest_id=1,assoc_id=1;
cr route:dest_id=2,assoc_id=1;
cr route:dest_id=3,assoc_id=1;
cr route:dname_id=1,assoc_id=1;
cr route:dname_id=2,assoc_id=1;
cr route:dname_id=3,assoc_id=1;
/ create asp

View File

@ -0,0 +1,87 @@
/ sigtran.sua
/ configuration file for sua setup
/ create SUA local instantation.
cr host:host_id=1,org_ip=10.1.13.3,org_port=14001,ssn=8,streams=16;
/cr host:host_id=2,org_ip=10.1.13.3,org_port=14002,ssn=8,streams=16;
/ create orgination pointcode
cr orgpc:host_id=1,pc=20;
/ create origination name and origination GT
cr orgname:host_id=1,name=host3.siemens.testbed;
cr orggt:host_id=1,digits=9110;
/cr orggt:host_id=2,digits=9;
/ HSS plugtest configuration
cr assoc:assoc_id=1,init=true,host_id=1,dest_ip=10.1.6.2,dest_port=14001;
/cr assoc:assoc_id=2,init=true,host_id=2,dest_ip=10.1.6.2,dest_port=14002;
/ create destination pointcode
cr destpc:dest_id=1,pc=10;
/ create destination IP address
cr destip:dest_id=1,ip=10.1.6.2;
/ create destination name
cr destname:dname_id=1,tt=1,na=3,np=1,digits=12345;
/ create route
cr route:dest_id=1,assoc_id=1;
cr route:dname_id=1,assoc_id=1;
/ HP plugtest configuration
/cr assoc:assoc_id=1,init=true,host_id=1,dest_ip=10.1.5.10,dest_port=14001;
/cr assoc:assoc_id=2,init=true,host_id=2,dest_ip=10.1.5.10,dest_port=14001;
/ create destination pointcode
/cr destpc:dest_id=1,pc=1;
/cr destpc:dest_id=2,pc=20;
/ create destination IP address
/cr destip:dest_id=1,ip=10.1.5.10;
/ create destination name
/cr destname:dname_id=1,tt=1,na=3,np=1,digits=12345;
/ create route
/cr route:dest_id=1,assoc_id=1;
/cr route:dest_id=2,assoc_id=2;
/cr route:dname_id=1,assoc_id=1;
/ Cisco plugtest configuration
/cr assoc:assoc_id=1,init=true,host_id=1,dest_ip=10.1.3.1,dest_port=14001;
/cr assoc:assoc_id=2,init=true,host_id=1,dest_ip=10.1.3.1,dest_port=14002;
/ create destination pointcode
/cr destpc:dest_id=1,pc=6;
/cr destpc:dest_id=2,pc=7;
/ create destination IP address
/cr destip:dest_id=1,ip=10.1.3.1;
/ create destination name
/cr destname:dname_id=1,tt=1,na=3,np=1,digits=12345;
/ create route
/cr route:dest_id=1,assoc_id=1;
/cr route:dest_id=2,assoc_id=1;
/cr route:dname_id=1,assoc_id=1;
/ CMG-logica plugtest configuration
/ create associations
/cr assoc:assoc_id=1,init=false,host_id=1,dest_ip=10.1.9.1,dest_port=14001;
/ create destination pointcode
/cr destpc:dest_id=1,pc=10;
/cr destpc:dest_id=2,pc=30;
/cr destpc:dest_id=3,pc=999;
/ create destination IP address
/cr destip:dest_id=1,ip=10.1.9.1;
/ create destination name
/cr destname:dname_id=1,name=host1.logica.testbed;
/cr destname:dname_id=2,tt=0,na=4,np=1,digits=31654654321;
/cr destname:dname_id=3,tt=0,na=4,np=1,digits=31654008000;
/cr destname:dname_id=4,tt=0,na=4,np=1,digits=31655654321;
/ create route
/cr route:dest_id=1,assoc_id=1;
/cr route:dname_id=1,assoc_id=1;
/cr route:dname_id=2,assoc_id=1;
/cr route:dname_id=3,assoc_id=1;
/cr route:dname_id=4,assoc_id=1;

View File

@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
* $Id: testuser.cpp,v 1.3 2003/05/27 14:12:34 p82609 Exp $
* $Id: testuser.cpp,v 1.7 2003/09/09 08:44:40 p82609 Exp $
*
* SUA Test user part implementation.
*
@ -87,6 +87,7 @@ unsigned int sendNo = 10;
unsigned int sendcnt = 0;
unsigned int timeoutval= 1000;
unsigned int rep_timer = 0;
boolean mirror = FALSE;
sua_Path_str pathinfo;
sccp_addr_str calling_pty_addr,called_pty_addr;
@ -94,6 +95,10 @@ short network_app = 0;
short seq_control_num = 0;
boolean return_option = FALSE;
string disp_ASP_stat[6];
string disp_PC_stat[2];
/***********************************************************************/
/* Test User Part : doPingPong */
/***********************************************************************/
@ -159,6 +164,16 @@ void init_testip_stdin()
{
unsigned int xsxx;
disp_ASP_stat[0] = "ASPIDL";
disp_ASP_stat[1] = "ASPDOW";
disp_ASP_stat[2] = "ASPDHD";
disp_ASP_stat[3] = "ASPIAC";
disp_ASP_stat[4] = "ASPIHD";
disp_ASP_stat[5] = "ASPACT";
disp_PC_stat[0] = "UNAVAI";
disp_PC_stat[1] = "AVAILA";
xsxx= sua_getPath( 1,
pathinfo
);
@ -187,6 +202,258 @@ void init_testip_stdin()
called_pty_addr.network_apperance = network_app;
}
/***********************************************************************/
/* Test User Part : testip_disp_assoc_mngt */
/***********************************************************************/
void testip_disp_assoc_mngt()
{
int i, res;
char output_str[INET6_ADDRSTRLEN];
const char *ptr;
pointcode_str local_pc;
/* Display the management status of all SUA instances */
/* display the local pointcodes and IP address */
res = sua_get_sourcepc_addr(1, local_pc);
cout << "Display SUA administration and Mangagement data of all associations\n";
cout << "|----------------------------------------|\n";
cout << "| Local IP addr : ";
if (local_pc.ipvx.sa.sa_family == AF_INET)
{ /* ipv4 */
ptr = inet_ntop( local_pc.ipvx.sa.sa_family,
&local_pc.ipvx.sin.sin_addr,
output_str,
sizeof(output_str)
);
cout.width(16);
cout.fill(' ');
cout << output_str;
cout << " |";
}
else
{ /* ipv6 */
ptr = inet_ntop( local_pc.ipvx.sa.sa_family,
&local_pc.ipvx.sin6.sin6_addr,
output_str,
sizeof(output_str)
);
cout.width(16);
cout.fill(' ');
cout << output_str << " |";
}
cout <<"\n";
cout << "| Local SS7 pointcode : ";
cout.width(6);
cout.fill(' ');
cout << local_pc.ss7.ITU14.pc ;
cout << " |\n";;
cout << "|----------------------------------------|\n";
/*display the adjacend remote pointcodes and IP addresses */
cout << "|--------+--------+--------------------+-------+-----|\n";
cout << "|Assoc-ID| status | Remote IP addr | DPC | SSN |\n";
cout << "|--------+--------+--------------------+-------+-----|\n";
i = 1;
while ( SUA_PATH_NO_ERROR == sua_getPath(i,pathinfo) )
{
cout.width(3);
cout.fill(' ');
cout << "| " << i ;
cout.width(6);
cout.fill(' ');
cout <<" | "<< disp_ASP_stat[pathinfo.ASP_status] << " | ";
if (pathinfo.remote_addr.pc.ipvx.sa.sa_family == AF_INET)
{ /* ipv4 */
ptr = inet_ntop( pathinfo.remote_addr.pc.ipvx.sa.sa_family,
&pathinfo.remote_addr.pc.ipvx.sin.sin_addr,
output_str,
sizeof(output_str)
);
cout.width(16);
cout.fill(' ');
cout << output_str;
cout << " |";
cout.width(6);
cout.fill(' ');
cout << pathinfo.remote_addr.pc.ss7.ITU14.pc << " | ";
cout.width(3);
cout.fill(' ');
cout << pathinfo.remote_addr.ssn << " |\n";
}
else
{ /* ipv6 */
ptr = inet_ntop( pathinfo.remote_addr.pc.ipvx.sa.sa_family,
&pathinfo.remote_addr.pc.ipvx.sin6.sin6_addr,
output_str,
sizeof(output_str)
);
cout << "| ";
cout.width(16);
cout.fill(' ');
cout << output_str << " |";
cout.width(6);
cout.fill(' ');
cout << pathinfo.local_addr.pc.ss7.ITU14.pc << " | ";
cout.width(3);
cout.fill(' ');
cout << pathinfo.remote_addr.ssn << " |\n";
}
i++;
}
cout << "|--------+--------+--------------------+-------+-----|\n";
}
/***********************************************************************/
/* Test User Part : testip_disp_dest_mngt */
/***********************************************************************/
void testip_disp_dest_mngt()
{
int i, res;
unsigned int assoc_id, stat;
char output_str[INET6_ADDRSTRLEN];
const char *ptr;
pointcode_str local_pc, dest_pc;
res = sua_get_sourcepc_addr(1, local_pc);
/* Display the management status of all SUA destinations */
/* display the local pointcodes and IP address */
cout << "Display SUA remote destination SS7 and IP pointcodes\n";
cout << "|----------------------------------------|\n";
cout << "| Local IP addr : ";
if (local_pc.ipvx.sa.sa_family == AF_INET)
{ /* ipv4 */
ptr = inet_ntop(local_pc.ipvx.sa.sa_family,
&local_pc.ipvx.sin.sin_addr,
output_str,
sizeof(output_str)
);
cout.width(16);
cout.fill(' ');
cout << output_str;
cout << " |";
}
else
{ /* ipv6 */
ptr = inet_ntop( local_pc.ipvx.sa.sa_family,
&local_pc.ipvx.sin6.sin6_addr,
output_str,
sizeof(output_str)
);
cout.width(16);
cout.fill(' ');
cout << output_str << " | ";
}
cout <<"\n";
cout << "| Local SS7 pointcode : ";
cout.width(6);
cout.fill(' ');
cout << local_pc.ss7.ITU14.pc << " |\n";;
cout << "|----------------------------------------|\n";
/*display the adjacend remote pointcodes and IP addresses */
cout << "|------+--------+--------------------+--------+--------|\n";
cout << "|Remote| status | Remote IP addr | DPC |Assoc-ID|\n";
cout << "|------+--------+--------------------+--------+--------|\n";
i = 1;
while ( SUA_GETPC_NO_ERROR == sua_get_destpc_addr(i, dest_pc, assoc_id, stat) )
{
cout << "| " ;
cout.width(3);
cout.fill(' ');
cout << i ;
cout <<" | ";
cout.width(6);
cout.fill(' ');
cout << disp_PC_stat[stat];
cout.width(0);
cout.fill(' ');
cout << " | ";
if (dest_pc.ipvx.sa.sa_family == AF_INET)
{ /* ipv4 */
ptr = inet_ntop( dest_pc.ipvx.sa.sa_family,
&dest_pc.ipvx.sin.sin_addr,
output_str,
sizeof(output_str)
);
cout.width(18);
cout.fill(' ');
cout << output_str;
cout << " |";
}
else
{ /* ipv6 */
ptr = inet_ntop( dest_pc.ipvx.sa.sa_family,
&dest_pc.ipvx.sin6.sin6_addr,
output_str,
sizeof(output_str)
);
cout.width(18);
cout.fill(' ');
cout << output_str;
cout << " |";
}
cout.width(7);
cout.fill(' ');
cout << dest_pc.ss7.ITU14.pc ;
cout.width(0);
cout.fill(' ');
cout << " | ";
cout.width(3);
cout.fill(' ');
cout << assoc_id ;
cout <<" |\n";
i++;
}
cout << "|------+--------+--------------------+--------+--------|\n";
}
/***********************************************************************/
/* Test User Part : testip_admin_lock_asp */
/***********************************************************************/
void testip_admin_lock_asp(unsigned int sua_assoc_id)
{
unsigned int res;
res = sua_DeActivate_assoc( sua_assoc_id );
cout << "Lock " << sua_assoc_id << " Associations\n";
}
/***********************************************************************/
/* Test User Part : testip_admin_unlock_asp */
/***********************************************************************/
void testip_admin_unlock_asp(unsigned int sua_assoc_id)
{
unsigned int res;
res = sua_Activate_assoc( sua_assoc_id );
cout << "Unlock " << sua_assoc_id << " ASP\n";
}
/***********************************************************************/
/* Test User Part : testip_admin_snm_daud */
/***********************************************************************/
void testip_snm_daud()
{
int res;
cout << "Send a Destination AUDIT to all know remote destinations\n";
res = sua_send_daud();
}
/***********************************************************************/
/* Test User Part : testip_stdin_cb */
/***********************************************************************/
@ -196,15 +463,11 @@ void testip_stdin_cb( int fd,
void *dummy
)
{
int i,length;
unsigned int k, outstr_len;
int length;
char readBuffer[256];
char output_str[INET6_ADDRSTRLEN];
const char *ptr;
unsigned int xsxx;
sccp_QOS_str udt_QOS, co_QOS;
unsigned int Sua_ConnId=0;
unsigned int Sua_ConnId=0, sua_assoc_id;
cin.getline(readBuffer,256,'\n');
string cmdline(readBuffer,strlen(readBuffer));
@ -228,10 +491,15 @@ void testip_stdin_cb( int fd,
cout << " destGT: - set destination Global Title\n";
cout << " some-other-string - send this Connectionless to destaddrx\n";
cout << " co:some-other-string - send this Connection-oriented\n";
cout << " disp mngt - display ASP status of remote nodes\n";
cout << " disp assoc mngt - display status of all associations\n";
cout << " disp dest mngt - display status of all destinations\n";
cout << " lock:x - put association x in inactive/down state\n";
cout << " enable:x - put association x in activequit state\n";
cout << " mirror:act - activate testup mirror function\n";
cout << " mirror:dact - deactivate testup mirror function\\n";
cout << " return-option: - change return-option(toggle) on/off\n";
//cout << " rep:x - repeat sending x CLDT/CODT msg to remote\n";
//cout << " term - terminate all the present associations(SCTP & SUA)\n";
cout << " term - terminate all the present associations(SCTP & SUA)\n";
//cout << " restart - restart all the present associations(SCTP & SUA)\n";
}
else if ((cmdline.find("quit") != cmdline.npos) ||
@ -253,71 +521,56 @@ void testip_stdin_cb( int fd,
{
cout << "Repeat sending CL/CO data to remote end every " << rep_timer << " sec\n";
}
else if ((cmdline.find("mirror:act") != cmdline.npos))
{
mirror = TRUE;
cout << "Mirror activated!\n";
}
else if ((cmdline.find("mirror:dact") != cmdline.npos))
{
mirror = FALSE;
cout << "Mirror dactivated!\n";
}
else if ((cmdline.find("return-option:") != cmdline.npos))
{
return_option = !return_option;
cout << "Return option = " << return_option << " (0= FALSE, 1= TRUE)\n";
}
else if (cmdline.find("lock") != cmdline.npos)
else if (cmdline.find("lock:") != cmdline.npos)
{
/* lock up all SUA instances for ASP management */
cout << "SUA mgnt administratived locked\n";
/* get association id */
string associd_str( cmdline, (cmdline.find("lock:")+5),cmdline.length());
char *associd_char = new char [associd_str.length()+1];
associd_str.copy(associd_char, associd_str.length());
associd_char[associd_str.length()] = '\0';
sua_assoc_id = atoi(associd_char);
testip_admin_lock_asp(sua_assoc_id);
}
else if (cmdline.find("disp mngt") != cmdline.npos)
else if (cmdline.find("enable:") != cmdline.npos)
{
/* unlock all SUA instances for ASP management */
string associd_str( cmdline, (cmdline.find("enable:")+7),cmdline.length());
char *associd_char = new char [associd_str.length()+1];
associd_str.copy(associd_char, associd_str.length());
associd_char[associd_str.length()] = '\0';
sua_assoc_id = atoi(associd_char);
testip_admin_unlock_asp(sua_assoc_id);
}
else if (cmdline.find("snm audit") != cmdline.npos)
{
/* do a DAUD for all destinations */
testip_snm_daud();
}
else if (cmdline.find("disp assoc mngt") != cmdline.npos)
{
/* Display the management status of all SUA instances */
cout << "Display SUA administration and Mangagement data of all associations\n";
cout << "|-------+--------+--------------------+--------------------+-----|\n";
cout << "| Assoc | status | local IP addr | Remote IP addr | SSN |\n";
cout << "|-------+--------+--------------------+--------------------+-----|\n";
i = 1;
while ( SUA_PATH_NO_ERROR == sua_getPath(i,pathinfo) )
{
cout << "| " << i <<" | "<< pathinfo.ASP_status << " | ";
if (pathinfo.local_addr.pc.ipvx.sa.sa_family == AF_INET)
{ /* ipv4 */
ptr = inet_ntop( pathinfo.local_addr.pc.ipvx.sa.sa_family,
&pathinfo.local_addr.pc.ipvx.sin.sin_addr,
output_str,
sizeof(output_str)
);
cout << output_str;
outstr_len = strlen(output_str);
for(k=0; k < (20 - 3 - outstr_len); k++)
cout << " ";
cout << "| ";
ptr = inet_ntop( pathinfo.remote_addr.pc.ipvx.sa.sa_family,
&pathinfo.remote_addr.pc.ipvx.sin.sin_addr,
output_str,
sizeof(output_str)
);
cout << output_str;
for(k=0; k < /*(20 -*/ 3 /*- outstr_len)*/; k++)
cout << " ";
cout << "| ";
cout << pathinfo.remote_addr.ssn << " |\n";
}
else
{ /* ipv6 */
ptr = inet_ntop( pathinfo.local_addr.pc.ipvx.sa.sa_family,
&pathinfo.local_addr.pc.ipvx.sin6.sin6_addr,
output_str,
sizeof(output_str)
);
cout << output_str << " | ";
ptr = inet_ntop( pathinfo.remote_addr.pc.ipvx.sa.sa_family,
&pathinfo.remote_addr.pc.ipvx.sin6.sin6_addr,
output_str,
sizeof(output_str)
);
cout << output_str << " | ";
cout << pathinfo.remote_addr.ssn << " |\n";
}
i++;
}
cout << "|-------+--------+--------------------+--------------------+-----|\n";
cout << "ASP status values: see sua_asp_mgnt.h\n";
testip_disp_assoc_mngt();
}
else if (cmdline.find("disp dest mngt") != cmdline.npos)
{
/* Display the management status of all SUA instances */
testip_disp_dest_mngt();
}
else if (cmdline.find("term") != cmdline.npos)
{
@ -411,9 +664,9 @@ void testip_stdin_cb( int fd,
called_pty_addr.address_fields_present.name_gt = GT_present;
called_pty_addr.address_fields_present.ssn_port = ssn_present;
called_pty_addr.address_fields_present.field_in_header = include_nothing;
called_pty_addr.name.GT.Translation_Type = 0;
called_pty_addr.name.GT.Numbering_Plan = 0;
called_pty_addr.name.GT.Nature_of_Address = 0;
called_pty_addr.name.GT.Translation_Type = 1;
called_pty_addr.name.GT.Numbering_Plan = 1;
called_pty_addr.name.GT.Nature_of_Address = 3;
strcpy(called_pty_addr.name.GT.digits,addr_str.c_str());
called_pty_addr.name.GT.nr_of_digits= addr_str.length();
called_pty_addr.ssn = calling_pty_addr.ssn;
@ -643,6 +896,7 @@ void ulp_ClDataIndNotif( unsigned int local_sua_Id,
int length=datalen;
int index;
unsigned int Sua_ConnId;
unsigned int xsxx;
char databuffer[MAX_DATA_LENGTH];
sccp_QOS_str QOS;
sccp_addr_str clg,cld;
@ -679,7 +933,24 @@ void ulp_ClDataIndNotif( unsigned int local_sua_Id,
cout << "************************************************************\n";
cout << ">";
cout << flush;
/* check if mirror is active */
if (mirror)
{
cout << "UDT msg mirrored\n";
/* char *databuffer = new char[cmdline.length()];
cmdline.copy(databuffer, cmdline.length());
length = cmdline.length();*/
xsxx = Send_sua_primitive(N_UNITDATA,
Sua_ConnId,
QOS,
called_pty_addr,
calling_pty_addr,
databuffer,
length
);
}
}