aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-07-09 20:58:12 +0200
committerHarald Welte <laforge@gnumonks.org>2010-07-09 20:58:12 +0200
commitc9c547aafe5b6c6df8714cf30d2bde0fdd4d0722 (patch)
treea490a7dac9dea1408893f98dbdbfa7bbafe243fc
parent3dc72b8cff16ffcc9babab9a9892befda44d8c4e (diff)
update to sualibrary-0.1.3 released 2003-05-28
* Contains Relaying functionality using Global Titles and hostnames. * New configuration commands via configuration file. * 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 v13 * requires SCTP implementation sctplib-1.0.0-pre19 from www.sctp.de
-rw-r--r--configure.in2
-rw-r--r--sualibrary.kdevprj2
-rw-r--r--sualibrary/Makefile.am4
-rw-r--r--sualibrary/docs/en/index-1.html44
-rw-r--r--sualibrary/docs/en/index-2.html11
-rw-r--r--sualibrary/docs/en/index-3.html67
-rw-r--r--sualibrary/docs/en/index-6.html2
-rw-r--r--sualibrary/docs/en/index.html5
-rw-r--r--sualibrary/sua/sua.h5
-rw-r--r--sualibrary/sua/sua_adapt.cpp39
-rw-r--r--sualibrary/sua/sua_adapt.h2
-rw-r--r--sualibrary/sua/sua_asp_mgnt.cpp2
-rw-r--r--sualibrary/sua/sua_asp_mgnt.h2
-rw-r--r--sualibrary/sua/sua_cl.cpp60
-rw-r--r--sualibrary/sua/sua_cl.h62
-rw-r--r--sualibrary/sua/sua_co.cpp51
-rw-r--r--sualibrary/sua/sua_co.h2
-rw-r--r--sualibrary/sua/sua_database.cpp58
-rw-r--r--sualibrary/sua/sua_database.h110
-rw-r--r--sualibrary/sua/sua_dataname.cpp117
-rw-r--r--sualibrary/sua/sua_datassoc.cpp692
-rw-r--r--sualibrary/sua/sua_debug.h2
-rw-r--r--sualibrary/sua/sua_distribution.cpp13
-rw-r--r--sualibrary/sua/sua_distribution.h2
-rw-r--r--sualibrary/sua/sua_file.cpp998
-rw-r--r--sualibrary/sua/sua_file.h6
-rw-r--r--sualibrary/sua/sua_logging.cpp2
-rw-r--r--sualibrary/sua/sua_logging.h2
-rw-r--r--sualibrary/sua/sua_snm_mgnt.cpp2
-rw-r--r--sualibrary/sua/sua_snm_mgnt.h2
-rw-r--r--sualibrary/sua/sua_sual.cpp5
-rw-r--r--sualibrary/sua/sua_sual.h2
-rw-r--r--sualibrary/sua/sua_syntax.cpp144
-rw-r--r--sualibrary/sua/sua_syntax.h2
-rw-r--r--sualibrary/sua/sua_tcb.cpp2
-rw-r--r--sualibrary/sua/sua_tcb.h2
-rw-r--r--sualibrary/testup/Makefile.am3
-rw-r--r--sualibrary/testup/main.cpp7
-rw-r--r--sualibrary/testup/testuser.cpp59
-rw-r--r--sualibrary/testup/testuser.h2
40 files changed, 1578 insertions, 1018 deletions
diff --git a/configure.in b/configure.in
index 9299100..b817040 100644
--- a/configure.in
+++ b/configure.in
@@ -8,7 +8,7 @@ AC_INIT(acconfig.h)
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
-AM_INIT_AUTOMAKE(sualibrary,0.1.2)
+AM_INIT_AUTOMAKE(sualibrary,0.1.3)
AC_PREFIX_DEFAULT(/usr/local)
if test "x$prefix" = "xNONE"; then
diff --git a/sualibrary.kdevprj b/sualibrary.kdevprj
index d1e728b..779bf25 100644
--- a/sualibrary.kdevprj
+++ b/sualibrary.kdevprj
@@ -24,7 +24,7 @@ ldadd=
ldflags=
[General]
-AMChanged=false
+AMChanged=true
author=Lode Coene
configure_args=
email=lode.coene@siemens.atea.be
diff --git a/sualibrary/Makefile.am b/sualibrary/Makefile.am
index 0c03538..98c5853 100644
--- a/sualibrary/Makefile.am
+++ b/sualibrary/Makefile.am
@@ -1,5 +1,7 @@
####### kdevelop will overwrite this part!!! (begin)##########
-
+bin_PROGRAMS = sualibrary
+sualibrary_SOURCES =
+sualibrary_LDADD = ./sua/libsua.a ./testup/libtestup.a
SUBDIRS = docs sua testup
diff --git a/sualibrary/docs/en/index-1.html b/sualibrary/docs/en/index-1.html
index 22a6aa7..80114a2 100644
--- a/sualibrary/docs/en/index-1.html
+++ b/sualibrary/docs/en/index-1.html
@@ -18,7 +18,7 @@ Previous
<H2><A NAME="s1.1">1.1 General concept</A></H2>
<P>
-The sualib-0.1.0 library release is the product of a cooperation between Siemens AG (ICM), Munich, Germany and Siemens Atea, Herentals Belgium.
+The sualib-0.1.3 library release is the product of a cooperation between Siemens AG (ICM), Munich, Germany and Siemens Atea, Herentals Belgium.
It has been developed since late 2000 and has been planned to become a fairly complete prototype implementation of the SCCP User Adaptation
@@ -62,22 +62,31 @@ callbacks for SUA events are passed in a SUA_ulpCallbacks(described more closely
and 6.5).
Then the application either calls the possibly blocking function sua_eventLoop(). While calling the former, it will react to a previously scheduled timer or any file descriptor event (by executing the registered callback functions). In case a timer is scheduled at a very late point in time, and no events happen on registered file descriptors (e.g. sockets), the program will sleep (because the system call poll() is used. In this case, the control flow is handled by the library, and the user must register appropriate callbacks for events and timers before handing control over to the sua_eventLoop() function. The proper use of the sua_eventLoop() is explained in some simple example programs in section 7.
+</P>
+<P>
+See the following chapters for some general infomation on the present features of SUA.</P>
+
+<UL>
+<LI><A HREF="index-3.html#ss3.1">3.1 General usage of the SUA library</A>
+<LI><A HREF="index-3.html#ss3.2">3.2 Features of the implementation</A>
+<LI><A HREF="index-3.html#ss3.3">3.3 What is missing</A>
+<LI><A HREF="index-3.html#ss3.4">3.4 SUA configuration file commands</A>
+</UL>
+<P>
<P>
<H2><A NAME="ss1.2">1.2 Changes</A>
</H2>
-Changes in comparison with sualibrary 0.0.5:
+Changes in comparison with sualibrary 0.1.2:
+<P>
+- portable to Darwin (Mac)<P>
+- New configuration file syntax<P>
+<P>
+- Global title addressing supported<P>
+
<P>
-- portable to different UNIX versions<P>
-- tested on both Linux and FreeBSD vs 4.4<P>
-- tested with both IPv4 and IPv6 networks<P>
-- msg syntax updated to <draft-ietf-sigtran-sua-12.txt> (example: DNS names)<P><UL>
-<LI><A HREF="index-3.html#ss3.1">3.1 General usage of the SUA library</A>
-<LI><A HREF="index-3.html#ss3.2">3.2 Features of the implementation</A>
-<LI><A HREF="index-3.html#ss3.3">3.3 What is missing</A>
-</UL>
<P>
<H2><A name="ss1.3">1.3 Nomenclature </A></H2>
@@ -98,3 +107,18 @@ Previous
<A HREF="index.html#toc1">Contents</A>
</BODY>
</HTML>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sualibrary/docs/en/index-2.html b/sualibrary/docs/en/index-2.html
index 86b026b..94be033 100644
--- a/sualibrary/docs/en/index-2.html
+++ b/sualibrary/docs/en/index-2.html
@@ -51,7 +51,7 @@ autoconf
you should have not trouble
compiling it.
Should you run into problems please report them to the the author at
-<A HREF="mailto:lode.coene@siemens.atea.be">Lode Coene</A><P>
+<A HREF="mailto:lode.coene@siemens.com">Lode Coene</A><P>
<P>
<P>
@@ -61,3 +61,12 @@ Should you run into problems please report them to the the author at
<A HREF="index.html#toc2">Contents</A>
</BODY>
</HTML>
+
+
+
+
+
+
+
+
+
diff --git a/sualibrary/docs/en/index-3.html b/sualibrary/docs/en/index-3.html
index 17dc4f7..c998a4c 100644
--- a/sualibrary/docs/en/index-3.html
+++ b/sualibrary/docs/en/index-3.html
@@ -61,13 +61,13 @@ Connectionless : CLDT message transfer
<P>
Connectionoriented: CORE, COAK, RELRE, RELCO, COREF & CODT message transfer
<P>
-Adressing options: use of Ipv4 and Ipv6 addresses, SS7 pointcodes, hostname
+Adressing options: use of Ipv4 and Ipv6 addresses, SS7 pointcodes, hostname, Global titles
<P>
SUA ASP management(optional)
<P><P>
It has been tested with implementations of 4 companies in the first SUA bakeoff.
<P><P>
-The following flags are recognized when reading a configuration file for SUA:
+The following flags are recognized when running SUA:
<P>
-s : source address<P>
@@ -95,11 +95,11 @@ The following flags are recognized when reading a configuration file for SUA:
example of a association<P>
--s 10.0.1.1 -7s 1 -d 10.0.3.1 -7d 66051 -r 14001 -n 255 -a 1 -t 16<P>
+./testup -s 10.0.1.1 -7s 1 -d 10.0.3.1 -7d 66051 -r 14001 -n 255 -a 1 -t 16<P>
example of a local listener<P>
--s be.atea.sua01 n 255 a 1 t 2 <P>
+./testup -s 10.0.1.1 -n 255 -a 1 -t 2 <P>
<P>
@@ -111,8 +111,7 @@ example of a local listener<P>
<P>
Features to be included in future version:
-<P>
-- Relaying functionality<P>
+<P><P>
- SUA management: ASP , AS management, etc<P>
<P>
@@ -130,6 +129,62 @@ patches, and patches are always welcome !
<P>
<P>
<P>
+Features not to be included:
+<P>
+- NIF/interworking with classical SS7 SCCP<P>
+
+- Routing keys<P>
+
+- Registration of Applications<P>
+<P>
+<P>
+<P>
+<H2><A NAME="ss3.4">3.4 SUA configuration file commands.</A>
+</H2>
+<P>
+<P>
+
+The following Commands can be used in the SUA configuration file:
+<P>
+REMARK: Spaces are used to clarify the commands only. They are not allowed or not recognized correctly in the actual configuration file!!!! See example configuration file in the package under sualibrary/testup/pcg729.sua</P>
+<P><P>
+<P>
+- cr host:host_id = j, org_ip= t.t.t.t, org_port= yyyyy \n;</P>
+<P>Provides the IP address(ses)(v4/v6) and portnumber of your own host. In most cases only one host entry will be needed, so host_id = 1</P>
+<P>
+- cr assoc:assoc_id= i, init= false, host_id = j, dest_ip = x.x.x.x, dest_port= yyyy;</P>
+<P>Provides the IP addres(ses) and portnumber of the destination to which to set up a association. Each association requires a different association_id. The init flag indicates if the implementation should setup the association immediatly(active assoc setup) or wait for a incomming association from remote node with those particular parameters(passive assoc setup or listening mode).</P>
+<P>
+- cr orgpc: pc = cccc, host_id = j;</P>
+<P>Provides the originating SS7 pointcode for the own node with host_id j.</P>
+<P>
+- cr orggt: host_id=j,tt=tt,na=nn,np=ppp,digits= 123456789abcdef; </P>
+<P>Provides the originating Global title(=Calling party Address) for the own node with host_id j.</P>
+<P>
+- cr orgname: host_id=j,name=www.xxx.zzz; </P>
+<P>Provides the originating Hostname for the own node with host_id j.</P>
+<P>
+- cr destpc: dest_id = i,pc = cccc;</P>
+<P>Provides the Destination Pointcode for the remote node with dest_id i.</P>
+<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>
+- 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>
+- 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>
+<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>
+- 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>
+<P>
<HR>
<A HREF="index-4.html">Next</A>
<A HREF="index-2.html">Previous</A>
diff --git a/sualibrary/docs/en/index-6.html b/sualibrary/docs/en/index-6.html
index 9306197..0deb230 100644
--- a/sualibrary/docs/en/index-6.html
+++ b/sualibrary/docs/en/index-6.html
@@ -14,7 +14,7 @@ Next
<H2><A NAME="s6">6. Copyright</A></H2>
<P>
-<P>Sualibrary Copyright 2002 Lode Coene , lode.coene@siemens.atea.be
+<P>Sualibrary Copyright 2003 Lode Coene , lode.coene@siemens.atea.be
<P>
<P>This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/sualibrary/docs/en/index.html b/sualibrary/docs/en/index.html
index 61609e1..14d6bdd 100644
--- a/sualibrary/docs/en/index.html
+++ b/sualibrary/docs/en/index.html
@@ -16,9 +16,9 @@ Contents
<H2>Lode Coene <CODE>lode.coene@siemens.atea.be</CODE></H2>
<H2>Gery Verwimp <CODE>gery.verwimp@siemens.atea.be</CODE></H2>
-Version 0.1.0 , Friday Feb 15 12:01:21 CET 2002
+Version 0.1.3 , Friday May 31 12:01:21 CET 2003
<P><HR>
-<EM>This Handbook describes Sualibrary Version 0.1.0</EM>
+<EM>This Handbook describes Sualibrary Version 0.1.3</EM>
<HR>
<P>
<H2><A NAME="toc1">1.</A> <A HREF="index-1.html">Introduction</A></H2>
@@ -43,6 +43,7 @@ Version 0.1.0 , Friday Feb 15 12:01:21 CET 2002
<LI><A HREF="index-3.html#ss3.1">3.1 General usage of the SUA library</A>
<LI><A HREF="index-3.html#ss3.2">3.2 Features of the implementation</A>
<LI><A HREF="index-3.html#ss3.3">3.3 What is missing</A>
+<LI><A HREF="index-3.html#ss3.4">3.4 SUA configuration file commands</A>
</UL>
<P>
<H2><A NAME="toc4">4.</A> <A HREF="index-4.html">SUA Application Program Interface (SUA API)</A></H2>
diff --git a/sualibrary/sua/sua.h b/sualibrary/sua/sua.h
index 84514d1..dd2e658 100644
--- a/sualibrary/sua/sua.h
+++ b/sualibrary/sua/sua.h
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua.h,v 1.8 2002/11/12 11:02:49 p82609 Exp $
+ * $Id: sua.h,v 1.1 2003/01/14 14:15:36 p82609 Exp $
*
* SUA implementation according to SUA draft issue 13.
*
@@ -345,8 +345,7 @@ unsigned int sua_read_config_file
#define SUA_REG_NO_ERROR 0
unsigned int sua_registerInstance
-( short local_ssn,
- Sua_ULP_CallBacks ulp_callback
+( Sua_ULP_CallBacks ulp_callback
);
diff --git a/sualibrary/sua/sua_adapt.cpp b/sualibrary/sua/sua_adapt.cpp
index 26f35a3..2501cf6 100644
--- a/sualibrary/sua/sua_adapt.cpp
+++ b/sualibrary/sua/sua_adapt.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_adapt.cpp,v 1.5 2002/11/12 11:02:49 p82609 Exp $
+ * $Id: sua_adapt.cpp,v 1.3 2003/01/31 11:36:39 p82609 Exp $
*
* SUA implementation according to SUA draft issue 13.
*
@@ -109,9 +109,7 @@ void sua_initialisation()
sctp_setLibraryParameters(&params);
init_logging_file();
- sua.local_sua.initialize();
- sua.remote_sua.initialize();
- sua.AssocDB.initialize();
+ sua.initialize();
cout << "Finished initialising SUA data\n ";
} /* end of sua_initialisation */
@@ -124,13 +122,10 @@ unsigned int sua_read_config_file( char *pConfFile)
unsigned int result = SUA_CFG_NO_ERROR;
string sua_filename;
sua_filename = pConfFile;
- result = read_sua_file( sua_filename,
- sua.local_sua,
- sua.remote_sua,
- sua.AssocDB,
- sua.NameDB,
- sua.ApplicServ
- );
+
+ result = read_sua_conf_file( sua_filename,
+ sua
+ );
return(result);
}
@@ -138,8 +133,7 @@ unsigned int sua_read_config_file( char *pConfFile)
/***********************************************************************/
/* sua_registerInstance */
/***********************************************************************/
-unsigned int sua_registerInstance ( short local_ssn,
- Sua_ULP_CallBacks ulp_callback
+unsigned int sua_registerInstance ( Sua_ULP_CallBacks ulp_callback
)
{
unsigned int result = SUA_REG_NO_ERROR;
@@ -154,10 +148,9 @@ unsigned int sua_registerInstance ( short local_ssn,
SCTPCallbackFunctions.restartNotif = &sctp_RestartNotif;
SCTPCallbackFunctions.shutdownCompleteNotif = &sctp_ShutDownCompleteNotif;
- result = sua.AssocDB.register_instance ( SCTPCallbackFunctions,
- ulp_callback,
- sua.local_sua
- );
+ result = sua.local_sua.register_instance ( SCTPCallbackFunctions,
+ ulp_callback
+ );
return(result);
}
@@ -197,22 +190,20 @@ unsigned int sua_getPath( unsigned int assoc_id,
pathinfo.remote_addr.ssn = sua.remote_sua.instance[sua.AssocDB.instance[assoc_id].remote_sua_id].ssn.ssn;
pathinfo.ASP_status = sua.AssocDB.instance[assoc_id].asp.status;
-
-#ifdef DEBUG
- //cout << "remote ssn = " << pathinfo.remote_addr.ssn << "\n";
- //cout << "remote sua_id = " << sua.AssocDB.instance[assoc_id].remote_sua_id << "\n";
-#endif
+
}
else
result = SUA_PATH_NO_DEST_ADDR_PRESENT;
- pathinfo.local_addr.pc.ipvx.ch = sua.AssocDB.instance[assoc_id].Source.addrs[0].ch;
+ pathinfo.local_addr.pc.ipvx.ch = sua.local_sua.instance[sua.AssocDB.instance[assoc_id].local_sua_id].Source.addrs[0].ch;
/*memcpy( pathinfo.local_addr.pc.ipvx.ch, sua.AssocDB.instance[assoc_id].Source.addrs[0].ch,24);*/
- pathinfo.local_addr.pc.ss7 = sua.AssocDB.instance[assoc_id].Source.pc;
+ pathinfo.local_addr.pc.ss7 = sua.local_sua.instance[sua.AssocDB.instance[assoc_id].local_sua_id].Source.pc;
pathinfo.local_addr.ssn = sua.local_sua.instance[sua.AssocDB.instance[assoc_id].local_sua_id].ssn.ssn;
+ pathinfo.local_addr.name.GT = sua.local_sua.instance[sua.AssocDB.instance[assoc_id].local_sua_id].Name.GT;
+
return (result);
}
diff --git a/sualibrary/sua/sua_adapt.h b/sualibrary/sua/sua_adapt.h
index 6655cca..35b7aa0 100644
--- a/sualibrary/sua/sua_adapt.h
+++ b/sualibrary/sua/sua_adapt.h
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_adapt.h,v 1.2 2002/11/12 11:02:49 p82609 Exp $
+ * $Id: sua_adapt.h,v 1.1 2003/01/14 14:15:36 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
diff --git a/sualibrary/sua/sua_asp_mgnt.cpp b/sualibrary/sua/sua_asp_mgnt.cpp
index 15f4d17..2f9e1a6 100644
--- a/sualibrary/sua/sua_asp_mgnt.cpp
+++ b/sualibrary/sua/sua_asp_mgnt.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_asp_mgnt.cpp,v 1.3 2002/11/12 11:02:49 p82609 Exp $
+ * $Id: sua_asp_mgnt.cpp,v 1.1 2003/01/14 14:15:36 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
diff --git a/sualibrary/sua/sua_asp_mgnt.h b/sualibrary/sua/sua_asp_mgnt.h
index 6531d17..625d687 100644
--- a/sualibrary/sua/sua_asp_mgnt.h
+++ b/sualibrary/sua/sua_asp_mgnt.h
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_asp_mgnt.h,v 1.1.1.1 2002/02/04 14:30:41 p82609 Exp $
+ * $Id: sua_asp_mgnt.h,v 1.1 2003/01/14 14:15:37 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
diff --git a/sualibrary/sua/sua_cl.cpp b/sualibrary/sua/sua_cl.cpp
index ab873fe..6c21b39 100644
--- a/sualibrary/sua/sua_cl.cpp
+++ b/sualibrary/sua/sua_cl.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_cl.cpp,v 1.8 2002/10/29 16:00:54 p82609 Exp $
+ * $Id: sua_cl.cpp,v 1.4 2003/02/17 14:38:08 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@@ -97,15 +97,15 @@ extern vector<sua_save_str> rec_msg_pool;
/* sua_send_Message */
/***********************************************************************/
int sua_send_Message( signed int sctp_assoc_id,
- short int sctp_stream_id,
- int sctp_delivery_type,
- unsigned int sctp_loadshare,
- char *databuf,
- unsigned int datalen
- )
+ short int sctp_stream_id,
+ int sctp_delivery_type,
+ unsigned int sctp_loadshare,
+ char *databuf,
+ unsigned int datalen
+ )
{
signed int result;
- /* send data to SCTP */
+ /* send data to SCTP */
/* yes it does, continue, no problem, send the msg */
#ifdef DEBUG
/* display byte array */
@@ -245,7 +245,7 @@ int sua_send_UDTService ( Sua_container &org_msg,
/***********************************************************************/
/* sua_route_Message */
/***********************************************************************/
-int sua_route_Message( unsigned int sctp_assoc_id,
+int sua_route_Message( unsigned int &sctp_assoc_id,
unsigned int local_sua_id,
Sua_container &msg,
sccp_addr_str &called_pty_address,
@@ -691,9 +691,10 @@ short process_unitdata_msg ( int local_sua_id,
Sua_container &msg
)
{
- sua_save_str temp;
- int result = 0;
- int sctp_assoc_id = 0;
+ sua_save_str temp;
+ int result = 0;
+ unsigned int sctp_assoc_id = 0;
+ char digit_char;
temp.primitive = N_UNITDATA;
temp.user_ref = 0;
@@ -747,7 +748,19 @@ short process_unitdata_msg ( int local_sua_id,
}
if (msg.sua_prim.source_addr.gt_pres == TRUE)
{
- cout << "Global Title : unsupported address format\n";
+ temp.calling_pty_address.address_fields_present.name_gt = GT_present;
+ temp.calling_pty_address.name.GT.Translation_Type = msg.sua_prim.source_addr.gt.translation_type ;
+ 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 (int 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';
+
}
if (msg.sua_prim.source_addr.hostname_pres == TRUE)
{
@@ -811,6 +824,23 @@ short process_unitdata_msg ( int local_sua_id,
temp.called_pty_address.pc.ss7.ITU24.pc = msg.sua_prim.dest_addr.pc;
}
+ if (msg.sua_prim.dest_addr.gt_pres == TRUE)
+ {
+ temp.called_pty_address.address_fields_present.name_gt = GT_present;
+ temp.called_pty_address.name.GT.Translation_Type = msg.sua_prim.dest_addr.gt.translation_type ;
+ 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 (int 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';
+
+ }
+
if (msg.sua_prim.dest_addr.hostname_pres == TRUE)
{
temp.called_pty_address.address_fields_present.name_gt = hostname_present;
@@ -885,8 +915,8 @@ short process_UDTService_msg ( int local_sua_id,
)
{
sua_save_str temp;
- int i, result = 0;
- int sctp_assoc_id = 0;
+ int i, result = 0;
+ unsigned int sctp_assoc_id = 0;
temp.primitive = N_NOTICE;
temp.user_ref = 0;
diff --git a/sualibrary/sua/sua_cl.h b/sualibrary/sua/sua_cl.h
index bd001ea..a001644 100644
--- a/sualibrary/sua/sua_cl.h
+++ b/sualibrary/sua/sua_cl.h
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_cl.h,v 1.4 2002/04/08 15:28:06 p82609 Exp $
+ * $Id: sua_cl.h,v 1.2 2003/01/24 11:48:54 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@@ -72,42 +72,42 @@
using namespace std;
int sua_send_Message( signed int sctp_assoc_id,
- short int sctp_stream_id,
- int sctp_delivery_type,
- unsigned int sctp_loadshare,
- char *databuf,
- unsigned int datalen
- );
-
-int sua_route_Message( unsigned int sctp_assoc_id,
- unsigned int local_sua_id,
- Sua_container &msg,
- sccp_addr_str &called_pty_address,
- sccp_addr_str &calling_pty_address
- );
-
+ short int sctp_stream_id,
+ int sctp_delivery_type,
+ unsigned int sctp_loadshare,
+ char *databuf,
+ unsigned int datalen
+ );
+
+int sua_route_Message( unsigned int &sctp_assoc_id,
+ unsigned int local_sua_id,
+ Sua_container &msg,
+ sccp_addr_str &called_pty_address,
+ sccp_addr_str &calling_pty_address
+ );
+
int sua_send_Unitdata( sccp_QOS_str &QOS,
- sccp_addr_str &called_pty_address,
- sccp_addr_str &calling_pty_address,
- char *buffer,
- unsigned int len
- );
+ sccp_addr_str &called_pty_address,
+ sccp_addr_str &calling_pty_address,
+ char *buffer,
+ unsigned int len
+ );
int sua_send_UDTService( Sua_container &org_msg,
- sccp_addr_str &called_pty_address,
- sccp_addr_str &calling_pty_address,
- unsigned int UDTS_reason
- );
+ sccp_addr_str &called_pty_address,
+ sccp_addr_str &calling_pty_address,
+ unsigned int UDTS_reason
+ );
short process_unitdata_msg ( int local_sua_id,
- unsigned int sua_assoc_id,
- Sua_container &sua_msg
- );
+ unsigned int sua_assoc_id,
+ Sua_container &sua_msg
+ );
short process_UDTService_msg ( int local_sua_id,
- unsigned int sua_assoc_id,
- Sua_container &sua_msg
- );
+ unsigned int sua_assoc_id,
+ Sua_container &sua_msg
+ );
#endif // SUA_CL_H
@@ -115,3 +115,5 @@ short process_UDTService_msg ( int local_sua_id,
// end of module sua_cl.h
+
+
diff --git a/sualibrary/sua/sua_co.cpp b/sualibrary/sua/sua_co.cpp
index 607423e..bbee72a 100644
--- a/sualibrary/sua/sua_co.cpp
+++ b/sualibrary/sua/sua_co.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_co.cpp,v 1.7 2002/11/12 11:02:49 p82609 Exp $
+ * $Id: sua_co.cpp,v 1.5 2003/02/17 14:38:08 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@@ -1164,12 +1164,13 @@ short process_CORE_msg ( unsigned int sua_assoc_id,
Sua_container &msg
)
{
- int i, result = 0;
- int sctp_assoc_id = 0;
+ int result = 0;
+ unsigned int sctp_assoc_id = 0;
unsigned int local_sua_id = 0;
sua_save_str temp;
unsigned int Sua_Out_ConnId;
tcb_Sua_TCB_str *tcb_out_ptr;
+ char digit_char;
temp.primitive = N_CONNECT_IND;
temp.user_ref = Sua_ConnId;
@@ -1219,24 +1220,25 @@ short process_CORE_msg ( unsigned int sua_assoc_id,
if (msg.sua_prim.source_addr.pc_pres == TRUE)
{
temp.calling_pty_address.address_fields_present.pc = ss7_pc_present;
- temp.calling_pty_address.pc.ss7.ITU24.family = ITU24bit;
+ temp.calling_pty_address.pc.ss7.ITU24.family = sua.AssocDB.instance[sua_assoc_id].Dest.pc.ITU24.family;
temp.calling_pty_address.pc.ss7.ITU24.pc = msg.sua_prim.source_addr.pc;
}
- if (msg.sua_prim.source_addr.gt_pres == TRUE)
- {
- cout << "Global Title : unsupported address format\n";
- }
if (msg.sua_prim.source_addr.gt_pres == TRUE)
{
temp.calling_pty_address.address_fields_present.name_gt = GT_present;
- temp.calling_pty_address.name.GT.Translation_Type = msg.sua_prim.source_addr.gt.translation_type;
- 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];
+ temp.calling_pty_address.name.GT.Translation_Type = msg.sua_prim.source_addr.gt.translation_type ;
+ 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 (int 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';
+
}
if (msg.sua_prim.source_addr.hostname_pres == TRUE)
@@ -1303,7 +1305,7 @@ short process_CORE_msg ( unsigned int sua_assoc_id,
if (msg.sua_prim.dest_addr.pc_pres == TRUE)
{
temp.called_pty_address.address_fields_present.pc = ss7_pc_present;
- temp.called_pty_address.pc.ss7.ITU24.family = ITU24bit;
+ temp.called_pty_address.pc.ss7.ITU24.family = sua.AssocDB.instance[sua_assoc_id].Dest.pc.ITU24.family;
temp.called_pty_address.pc.ss7.ITU24.pc = msg.sua_prim.dest_addr.pc;
}
@@ -1314,8 +1316,12 @@ short process_CORE_msg ( unsigned int sua_assoc_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 (int 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';
}
@@ -1916,6 +1922,11 @@ short process_CORELCO_msg ( unsigned int sua_assoc_id,
);
delete databuf;
+
+ // release the incoming TCB of this connection
+ tcb_pool.release_TCB(sua_ConnId);
+ // release outgoing TCB of this connection
+ tcb_pool.release_TCB(Sua_Out_ConnId);
}
return(0);
@@ -2038,6 +2049,12 @@ short process_COREF_msg ( unsigned int sua_assoc_id,
);
delete databuf;
+
+ // release the incoming TCB of this connection
+ tcb_pool.release_TCB(sua_ConnId);
+ // release outgoing TCB of this connection
+ tcb_pool.release_TCB(Sua_Out_ConnId);
+
}
return(0);
diff --git a/sualibrary/sua/sua_co.h b/sualibrary/sua/sua_co.h
index 8f4fd11..eee0691 100644
--- a/sualibrary/sua/sua_co.h
+++ b/sualibrary/sua/sua_co.h
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_co.h,v 1.1.1.1 2002/02/04 14:30:41 p82609 Exp $
+ * $Id: sua_co.h,v 1.1 2003/01/14 14:15:37 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
diff --git a/sualibrary/sua/sua_database.cpp b/sualibrary/sua/sua_database.cpp
index 8604ee5..a8987b7 100644
--- a/sualibrary/sua/sua_database.cpp
+++ b/sualibrary/sua/sua_database.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_database.cpp,v 1.2 2002/10/30 16:04:09 p82609 Exp $
+ * $Id: sua_database.cpp,v 1.2 2003/01/16 15:07:56 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@@ -358,20 +358,55 @@ short db_Sua_LocalList:: unregister_instance(){
/* Sua_LocalList::register_instance */
/***********************************************************************/
short db_Sua_LocalList::
-register_instance( unsigned int local_sua_id,
- Sua_ULP_CallBacks SUACallbackFunctions,
- unsigned int init_association
+register_instance( SCTP_ulp_Callbacks APLCallbackFunctions,
+ Sua_ULP_CallBacks SUACallbackFunctions
){
+ int i;
+ short sua_portnumber = SUA_PORT;
+#ifdef DEBUG
+ cout << "Number of local sua instance to register = " << num_of_instance << "\n";
+#endif
- instance[local_sua_id].SUA_APLCallBack.ulp_ClDataIndNotif = SUACallbackFunctions.ulp_ClDataIndNotif;
- instance[local_sua_id].SUA_APLCallBack.ulp_ConnIndNotif = SUACallbackFunctions.ulp_ConnIndNotif;
- instance[local_sua_id].SUA_APLCallBack.ulp_ConnConfIndNotif = SUACallbackFunctions.ulp_ConnConfIndNotif;
- instance[local_sua_id].SUA_APLCallBack.ulp_ConnDataIndNotif = SUACallbackFunctions.ulp_ConnDataIndNotif;
- instance[local_sua_id].SUA_APLCallBack.ulp_DisConnIndNotif = SUACallbackFunctions.ulp_DisConnIndNotif;
-
- instance[local_sua_id].init_assoc_id = init_association;
+ for(i=1; i <= num_of_instance; i++)
+ {
+#ifdef DEBUG
+ cout << "Register SUA(& SCTP) local instance nr " << i << ", SSN = "<< instance[i].ssn.ssn <<" \n";
+#endif
+ char logstring[100];
+ sprintf(logstring, "Register SUA(& SCTP) local instance nr %d, SSN = %d",i,instance[i].ssn.ssn );
+ event_log("sua_database.c",logstring);
+
+ instance[i].SUA_APLCallBack.ulp_ClDataIndNotif = SUACallbackFunctions.ulp_ClDataIndNotif;
+ instance[i].SUA_APLCallBack.ulp_ConnIndNotif = SUACallbackFunctions.ulp_ConnIndNotif;
+ instance[i].SUA_APLCallBack.ulp_ConnConfIndNotif = SUACallbackFunctions.ulp_ConnConfIndNotif;
+ instance[i].SUA_APLCallBack.ulp_ConnDataIndNotif = SUACallbackFunctions.ulp_ConnDataIndNotif;
+ instance[i].SUA_APLCallBack.ulp_DisConnIndNotif = SUACallbackFunctions.ulp_DisConnIndNotif;
+
+ if (instance[i].Source.addrs[0].sa.sa_family == AF_INET)
+ sua_portnumber = instance[i].Source.addrs[0].sin.sin_port;
+ else if (instance[i].Source.addrs[0].sa.sa_family == AF_INET6)
+ sua_portnumber = instance[i].Source.addrs[0].sin6.sin6_port;
+
+ instance[i].SCTP_instance_name =
+ sctp_registerInstance( sua_portnumber,
+ instance[i].max_streams,
+ instance[i].max_streams,
+ instance[i].Source.nr_of_addrs,
+ instance[i].Source.address_string,
+ APLCallbackFunctions
+ );
+
+#ifdef DEBUG
+ cout << "SCTP instance name = " << instance[i].SCTP_instance_name << " \n";
+#endif
+ sprintf(logstring, "Local SCTP instance nr %d name = %d", i, instance[i].SCTP_instance_name);
+ event_log("sua_database.c",logstring);
+
+ }
+return(0);
+
return(0);
}
@@ -424,6 +459,7 @@ void db_Sua_RemoteList:: increase_instance(){
event_log("sua_database.c",logstring);
};
+
/***********************************************************************/
/* functions of the object class SUA Application Server Process (ASP) */
/***********************************************************************/
diff --git a/sualibrary/sua/sua_database.h b/sualibrary/sua/sua_database.h
index 31d1119..20505c7 100644
--- a/sualibrary/sua/sua_database.h
+++ b/sualibrary/sua/sua_database.h
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_database.h,v 1.8 2002/11/12 11:02:49 p82609 Exp $
+ * $Id: sua_database.h,v 1.4 2003/01/31 11:36:39 p82609 Exp $
*
* SUA implementation according to SUA draft issue 8.
*
@@ -76,7 +76,7 @@
typedef enum {nc_empty, nc_ipv4, nc_ipv6} db_net_class;
-const int db_MAX_MULTIHOME_ADDR = 10;
+const int db_MAX_MULTIHOME_ADDR = 2;
const int db_MAX_LOCAL_SUA = 10;
const int db_MAX_REMOTE_SUA = 1000;
const int db_MAX_SSN_SUA = 256;
@@ -95,16 +95,35 @@ class db_Sua_SSNObject {
}; ///:~
/***********************************************************************/
+/* Sua_AddressObject */
+/***********************************************************************/
+class db_Sua_AddressObject {
+ public:
+ int nr_of_addrs; // number of ip addresses used(multihoming)
+ unsigned char address_string[db_MAX_MULTIHOME_ADDR][SCTP_MAX_IP_LEN];
+ ipvxunion addrs[db_MAX_MULTIHOME_ADDR];
+ SS7union pc;
+ public:
+ void read_addr_param(string address);
+ void read_pointcode_param(string point_code);
+ void read_port_num(string port);
+}; ///:~
+
+/***********************************************************************/
/* Sua_LocalObject */
/***********************************************************************/
class db_Sua_LocalObject{
public:
- db_Sua_SSNObject ssn;
- /* contains the initial SUA association */
- unsigned int init_assoc_id;
- /* the local sua id with which it is linked. */
- unsigned int sua_id;
- Sua_ULP_CallBacks SUA_APLCallBack;
+ /* ssn supported */
+ db_Sua_SSNObject ssn;
+ /* maximum number of streams for this instance */
+ unsigned int max_streams;
+ /* SCTP registered local instance name */
+ unsigned int SCTP_instance_name;
+ Sua_ULP_CallBacks SUA_APLCallBack;
+ /* local source address(es) of instance */
+ db_Sua_AddressObject Source;
+ name_str Name;
public:
// functions of the Class
void initialize();
@@ -119,9 +138,8 @@ class db_Sua_LocalList{
db_Sua_LocalObject instance[db_MAX_LOCAL_SUA];
void initialize();
void read_ssn(string ssn);
- short register_instance( unsigned int local_sua_id,
- Sua_ULP_CallBacks SUACallbackFunctions,
- unsigned int init_assoc_id
+ short register_instance( SCTP_ulp_Callbacks APLCallbackFunctions,
+ Sua_ULP_CallBacks SUACallbackFunctions
);
short unregister_instance();
void increase_instance();
@@ -133,10 +151,10 @@ class db_Sua_LocalList{
class db_Sua_RemoteObject{
public:
db_Sua_SSNObject ssn;
- /* contains the SCTP assoc id */
- unsigned int SCTP_assoc_id;
- /* contains the local sua id with which it is linked. */
- unsigned int sua_id;
+ /* contains the association sua id with which it is linked. */
+ unsigned int SUA_assoc_id;
+ /* dest address of the remote sua node */
+ db_Sua_AddressObject Dest;
public:
// functions of the Class
void initialize();
@@ -153,23 +171,6 @@ class db_Sua_RemoteList{
void initialize();
void read_ssn(string ssn);
void increase_instance();
-
-}; ///:~
-
-
-/***********************************************************************/
-/* Sua_AddressObject */
-/***********************************************************************/
-class db_Sua_AddressObject {
- public:
- int nr_of_addrs; // number of ip addresses used(multihoming)
- unsigned char address_string[db_MAX_MULTIHOME_ADDR][SCTP_MAX_IP_LEN];
- ipvxunion addrs[db_MAX_MULTIHOME_ADDR];
- SS7union pc;
- public:
- void read_addr_param(string address);
- void read_pointcode_param(string point_code);
- void read_port_num(string port);
}; ///:~
/***********************************************************************/
@@ -190,7 +191,7 @@ class db_Sua_GlobalTitle {
class db_Sua_NameObject {
public:
unsigned int SUA_assoc_id;
- unsigned int sctp_assoc_id;
+ boolean GT_present;
db_Sua_GlobalTitle GT;
string hostname;
public:
@@ -207,11 +208,14 @@ class db_Sua_NameList{
db_Sua_NameObject instance[db_MAX_REMOTE_SUA];
public:
void initialize();
- string read_host_name( unsigned int sua_assoc_id,
- string name
+ void read_host_name( unsigned int gtname_id,
+ string name
);
- void read_Global_Title( unsigned int sua_assoc_id,
- string name
+ void read_Global_Title( unsigned int gtname_id,
+ unsigned int tt,
+ unsigned int na,
+ unsigned int np,
+ string digits
);
signed int resolve_host_name( hostname_str& dest_name,
pointcode_str& dest_pc
@@ -314,6 +318,7 @@ class db_Sua_AssociationObject {
unsigned int local_sua_id;
short nr_of_inbound_streams;
short nr_of_outbound_streams;
+ boolean init_assoc;
db_Sua_ASPObject asp;
db_net_class netw; // sort of network(v4/v6) to be used
// ip source/destination addresses , should be the same network type
@@ -339,21 +344,7 @@ class db_Sua_AssociationList{
void read_Dest_pointcode(string address);
void read_Source_port(string port);
void read_Dest_port(string port);
- void read_Source_GT( db_Sua_NameList &NameDB,
- string address
- );
- void read_Dest_GT( db_Sua_NameList &NameDB,
- string address
- );
- string read_host_name( db_Sua_NameList &NameDB,
- string address
- );
void read_stream_number(string stream_num);
- short register_instance(SCTP_ulp_Callbacks APLCallbackFunctions,
- Sua_ULP_CallBacks SUACallbackFunctions,
- db_Sua_LocalList& local_sua
- );
- short unregister_instance();
unsigned int Find_association( unsigned int sctp_assoc_id,
unsigned int &Local_sua_id,
unsigned int &Remote_sua_id
@@ -378,14 +369,6 @@ class db_Sua_AssociationList{
);
short Terminate_remote_assoc_instance();
short shutdown();
- signed int route_on_IPpc ( ipvxunion& dest_pc,
- ipvxunion& org_pc,
- int& sua_assoc_id
- );
- signed int route_on_SS7pc ( SS7union& dest_pc,
- SS7union& org_pc,
- int& sua_assoc_id
- );
void increase_instance();
bool activate( unsigned int sua_id,
short mode
@@ -413,6 +396,7 @@ class db_Sua_DatabaseList{
db_Sua_NameList NameDB;
db_Sua_ASList ApplicServ;
public:
+ void initialize();
unsigned int Find_local_sua( sccp_addr_str& local_address
);
unsigned int Dynamic_Associate( sccp_addr_str& cld,
@@ -421,6 +405,14 @@ class db_Sua_DatabaseList{
unsigned short nr_of_input_streams,
unsigned short nr_of_output_streams
);
+ signed int route_on_SS7pc ( SS7union& dest_pc,
+ SS7union& org_pc,
+ int& sua_assoc_id
+ );
+ signed int route_on_IPpc ( ipvxunion& dest_pc,
+ ipvxunion& org_pc,
+ int& sua_assoc_id
+ );
signed int route_on_GTname ( hostname_str& dest_name,
hostname_str& org_name,
int& sua_assoc_id,
diff --git a/sualibrary/sua/sua_dataname.cpp b/sualibrary/sua/sua_dataname.cpp
index 2b9d401..76737cf 100644
--- a/sualibrary/sua/sua_dataname.cpp
+++ b/sualibrary/sua/sua_dataname.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_dataname.cpp,v 1.6 2002/11/12 11:04:12 p82609 Exp $
+ * $Id: sua_dataname.cpp,v 1.2 2003/01/31 11:36:39 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@@ -89,7 +89,7 @@ void db_Sua_NameObject::initialize(){
// initialise to point to a invalid SUA association
SUA_assoc_id = 0;
- sctp_assoc_id = 0;
+
GT.Translation_Type = 0;
GT.Numbering_Plan = 0;
GT.Nature_of_Address = 0;
@@ -119,9 +119,9 @@ void db_Sua_NameList::initialize(){
/***********************************************************************/
/* Sua_NameList::read_host_name */
/***********************************************************************/
-string db_Sua_NameList::read_host_name( unsigned int sua_assoc_id,
- string name
- ){
+void db_Sua_NameList::read_host_name( unsigned int gtname_id,
+ string name
+ ){
char *hostname;
const char *ip_addr_ptr;
@@ -137,74 +137,66 @@ string db_Sua_NameList::read_host_name( unsigned int sua_assoc_id,
if ((hptr = gethostbyname(hostname)) == NULL){
cout << "Determination of hostname failed\n";
- return("127.0.0.1");
}
-
+ else
+ {
#ifdef DEBUG
- cout << "Hostname " << hptr->h_name << " has the following IP address(es)\n";
+ cout << "Hostname " << hptr->h_name << " has the following IP address(es)\n";
#endif
-
- pptr = hptr->h_addr_list;
- for ( ; *pptr != NULL;pptr++)
- {
- ip_addr_ptr = inet_ntop(hptr->h_addrtype, *pptr, str,sizeof(str));
- addr_str = addr_str + ip_addr_ptr;
- if ((*(pptr+1)) != NULL)
- /* another ip address is comming after the present one */
- addr_str = addr_str + ",";
- /*else this is the last ip address */
+
+ pptr = hptr->h_addr_list;
+ for ( ; *pptr != NULL;pptr++)
+ {
+ ip_addr_ptr = inet_ntop(hptr->h_addrtype, *pptr, str,sizeof(str));
+ addr_str = addr_str + ip_addr_ptr;
+ if ((*(pptr+1)) != NULL)
+ /* another ip address is comming after the present one */
+ addr_str = addr_str + ",";
+ /*else this is the last ip address */
#ifdef DEBUG
- cout << ip_addr_ptr << "\n";
+ cout << ip_addr_ptr << "\n";
#endif
- }
-
+ }
+
#ifdef DEBUG
- cout << "output IP list = " << addr_str << "\n";
+ cout << "output IP list = " << addr_str << "\n";
#endif
+
+ }
+
+ /* initialise */
+ instance[gtname_id].SUA_assoc_id = 0;
- instance[num_of_instance].SUA_assoc_id = sua_assoc_id;
-
- instance[num_of_instance].hostname = name;
+ /* no GT present -> hostname present */
+ instance[gtname_id].GT_present = false;
+ instance[gtname_id].hostname = name;
- return(addr_str);
+ return;
}
/***********************************************************************/
/* Sua_NameList::read_Global_Title */
/***********************************************************************/
-void db_Sua_NameList::read_Global_Title( unsigned int sua_assoc_id,
- string gt
+void db_Sua_NameList::read_Global_Title( unsigned int gtname_id,
+ unsigned int tt,
+ unsigned int na,
+ unsigned int np,
+ string digits
)
{
- string GT_TT_str, GT_NP_str, GT_NA_str, GT_Digits_str;
- unsigned int first = 0, last = 0;
- unsigned int current = gt.find('-', first);
-
- first = 1;
- last = current - 1;
- GT_TT_str = gt.substr( first, last);
-
- first = current + 1;
- current = gt.find('-', first);
- last = current - 1;
- GT_NP_str = gt.substr( first , last);
-
- first = current + 1;
- current = gt.find('-', first);
- last = current - 1;
- GT_NA_str = gt.substr( first , last);
-
- first = current + 1;
- last = gt.size();
- GT_Digits_str = gt.substr( first , last);
-
- instance[num_of_instance].SUA_assoc_id = sua_assoc_id;
+ /*unsigned short i;*/
+
+ instance[gtname_id].SUA_assoc_id = 0;
- instance[num_of_instance].GT.Translation_Type = atoi(GT_TT_str.c_str());
- instance[num_of_instance].GT.Numbering_Plan = atoi(GT_NP_str.c_str());
- instance[num_of_instance].GT.Nature_of_Address = atoi(GT_NA_str.c_str());
- instance[num_of_instance].GT.digits = GT_Digits_str;
+ /* GT present */
+ instance[gtname_id].GT_present = true;
+ instance[gtname_id].GT.Translation_Type = tt;
+ instance[gtname_id].GT.Numbering_Plan = np;
+ instance[gtname_id].GT.Nature_of_Address = na;
+ instance[gtname_id].GT.digits.resize( digits.length());
+ instance[gtname_id].GT.digits= "";
+ instance[gtname_id].GT.digits = digits;
}
@@ -283,7 +275,7 @@ signed int db_Sua_NameList::perform_GTT ( global_title_str& cld_in,
/* resolving can be done via: */
/* - local global Titel database */
- i= 0;
+ i= 1;
while (search_gt){
gt_entry_found = ((instance[i].GT.Translation_Type == cld_in.Translation_Type) &&
(instance[i].GT.Numbering_Plan == cld_in.Numbering_Plan) &&
@@ -291,6 +283,9 @@ signed int db_Sua_NameList::perform_GTT ( global_title_str& cld_in,
(instance[i].GT.digits == cld_in.digits));
found_gt_entry = i;
+
+ search_gt = ((!gt_entry_found) && ( i < num_of_instance));
+
/* next entry of name table */
i++;
}
@@ -305,6 +300,16 @@ signed int db_Sua_NameList::perform_GTT ( global_title_str& cld_in,
};
+/***********************************************************************/
+/* db_Sua_NameList::increase_instance */
+/***********************************************************************/
+void db_Sua_NameList:: increase_instance(){
+
+ num_of_instance++;
+
+}
+
+
// end of module sua_dataname.c
diff --git a/sualibrary/sua/sua_datassoc.cpp b/sualibrary/sua/sua_datassoc.cpp
index bec142d..8530b5e 100644
--- a/sualibrary/sua/sua_datassoc.cpp
+++ b/sualibrary/sua/sua_datassoc.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_datassoc.cpp,v 1.11 2002/11/12 11:04:12 p82609 Exp $
+ * $Id: sua_datassoc.cpp,v 1.8 2003/02/17 14:38:08 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@@ -240,98 +240,6 @@ void db_Sua_AssociationList:: read_stream_number(string stream_num){
}
}
-/***********************************************************************/
-/* Sua_AssociationList::read_Source_GT */
-/***********************************************************************/
-void db_Sua_AssociationList::read_Source_GT( db_Sua_NameList &NameDB,
- string address
- )
-{
- ;
-}
-
-/***********************************************************************/
-/* Sua_AssociationList::read_Dest_GT */
-/***********************************************************************/
-void db_Sua_AssociationList::read_Dest_GT( db_Sua_NameList &NameDB,
- string address
- )
-{
- unsigned int sua_assoc_id = num_of_instance;
-
- NameDB.read_Global_Title( sua_assoc_id,
- address
- );
-
- NameDB.num_of_instance++;
-
-}
-
-/***********************************************************************/
-/* Sua_AssociationList::read_hostname */
-/***********************************************************************/
-string db_Sua_AssociationList::read_host_name( db_Sua_NameList &NameDB,
- string address )
-{
- unsigned int sua_assoc_id = num_of_instance;
- string host_ip_addr;
-
- host_ip_addr = NameDB.read_host_name( sua_assoc_id,
- address
- );
-
- return(host_ip_addr);
-}
-
-/***********************************************************************/
-/* Sua_AssociationList::register_instance */
-/***********************************************************************/
-short db_Sua_AssociationList::
-register_instance( SCTP_ulp_Callbacks APLCallbackFunctions,
- Sua_ULP_CallBacks SUACallbackFunctions,
- db_Sua_LocalList& local_sua
- ){
-
- int i;
- unsigned int local_sua_idx;
- short sua_portnumber = SUA_PORT;
-
- for(i=1; i <= num_of_instance; i++)
- {
- local_sua_idx = instance[i].local_sua_id;
-#ifdef DEBUG
- cout << "Register SUA(& SCTP) local instance nr " << local_sua_idx << " with association " << i << " ,SSN = "<< local_sua.instance[local_sua_idx].ssn.ssn <<" \n";
-#endif
- char logstring[100];
- sprintf(logstring, "Register SUA(& SCTP) local instance nr %d with association %d, SSN = %d", local_sua_idx,i,local_sua.instance[local_sua_idx].ssn.ssn );
- event_log("sua_database.c",logstring);
- local_sua.register_instance( instance[i].local_sua_id,
- SUACallbackFunctions,
- i
- );
- if (instance[i].Source.addrs[0].sa.sa_family == AF_INET)
- sua_portnumber = instance[i].Source.addrs[0].sin.sin_port;
- else if (instance[i].Source.addrs[0].sa.sa_family == AF_INET6)
- sua_portnumber = instance[i].Source.addrs[0].sin6.sin6_port;
-
- instance[i].SCTP_instance_name =
- sctp_registerInstance( sua_portnumber,
- instance[i].nr_of_inbound_streams,
- instance[i].nr_of_outbound_streams,
- instance[i].Source.nr_of_addrs,
- instance[i].Source.address_string,
- APLCallbackFunctions
- );
-
-#ifdef DEBUG
- cout << "SCTP instance name = " << instance[i].SCTP_instance_name << " \n";
-#endif
- sprintf(logstring, "Local SCTP instance nr %d name = %d", i, instance[i].SCTP_instance_name);
- event_log("sua_database.c",logstring);
-
- }
-return(0);
-};
/***********************************************************************/
/* Sua_AssociationList::associate_instance */
@@ -359,41 +267,43 @@ associate_instance( db_Sua_LocalList& local_sua,
res = sctp_setAssocDefaults( instance[1].SCTP_assoc_id,
SCTP_assoc_status
);
-
+
for(i=1; i <= num_of_instance; i++)
{
- if (instance[i].Dest.nr_of_addrs != 0) {
+ /* init association from this node */
+ if ((instance[i].init_assoc) && (instance[i].Dest.nr_of_addrs != 0)) {
#ifdef DEBUG
- cout << "Associate remote SUA(& SCTP) instance nr " << i << " with local SUA(& SCTP) instance nr " << instance[i].local_sua_id <<" \n";
+ cout << "Associate remote SUA(& SCTP) instance nr " << i << " with local SUA(& SCTP) instance nr " << instance[i].local_sua_id <<" \n";
#endif
- char logstring[100];
- sprintf(logstring, "Associate Remote SUA(& SCTP) instance nr %d with local SUA(& SCTP) instance nr %d", i, instance[i].local_sua_id );
- event_log("sua_database.c",logstring);
-
- if (instance[i].Dest.addrs[0].sa.sa_family == AF_INET)
- sua_portnumber = instance[i].Dest.addrs[0].sin.sin_port;
- else if (instance[i].Dest.addrs[0].sa.sa_family == AF_INET6)
- sua_portnumber = instance[i].Dest.addrs[0].sin6.sin6_port;
-
- ULPData[0].maximumStreamID = -1;
-
- short unsigned instance_name = instance[i].SCTP_instance_name ;
- instance[i].SCTP_assoc_id =
- sctp_associate( instance_name,
- instance[i].nr_of_outbound_streams,
- instance[i].Dest.address_string[0],
- sua_portnumber,
- NULL
- );
-
- /* no msg queued, mark assoc down(from sua management viewpoint)*/
- instance[i].asp.status = asp_down;
-
+ char logstring[100];
+ sprintf(logstring, "Associate Remote SUA(& SCTP) instance nr %d with local SUA(& SCTP) instance nr %d", i, instance[i].local_sua_id );
+ event_log("sua_database.c",logstring);
+
+ if (instance[i].Dest.addrs[0].sa.sa_family == AF_INET)
+ sua_portnumber = instance[i].Dest.addrs[0].sin.sin_port;
+ else if (instance[i].Dest.addrs[0].sa.sa_family == AF_INET6)
+ sua_portnumber = instance[i].Dest.addrs[0].sin6.sin6_port;
+
+ ULPData[0].maximumStreamID = -1;
+
+ instance[i].SCTP_instance_name = local_sua.instance[instance[i].local_sua_id].SCTP_instance_name ;
+ instance[i].SCTP_assoc_id =
+ sctp_associate( instance[i].SCTP_instance_name,
+ instance[i].nr_of_outbound_streams,
+ instance[i].Dest.address_string[0],
+ sua_portnumber,
+ NULL
+ );
+
+ /* no msg queued, mark assoc down(from sua management viewpoint)*/
+ instance[i].asp.status = asp_down;
+
#ifdef DEBUG
- cout << "SCTP association result = " << instance[i].SCTP_assoc_id <<" \n";
+ cout << "SCTP association result = " << instance[i].SCTP_assoc_id <<" \n";
#endif
-
- }
+
+ remote_sua.instance[instance[i].remote_sua_id].ssn.ssn = local_sua.instance[instance[i].local_sua_id].ssn.ssn;
+ }
}
return(0);
};
@@ -420,7 +330,7 @@ Find_association( unsigned int sctp_assoc_id,
result = (instance[i].SCTP_assoc_id == sctp_assoc_id);
if (result) {
Local_sua_id = instance[i].local_sua_id;
- Remote_sua_id = instance[i].remote_sua_id;
+ /*Remote_sua_id = instance[i].remote_sua_id;*/
sua_assoc_id = i;
}
i++;
@@ -434,109 +344,75 @@ Find_association( unsigned int sctp_assoc_id,
/* Sua_AssociationList::passive_associate */
/***********************************************************************/
unsigned int db_Sua_AssociationList::
-passive_associate( unsigned int assoc_id,
+passive_associate( unsigned int sctp_assoc_id,
db_Sua_LocalList &local_sua,
db_Sua_RemoteList &remote_sua,
unsigned short nr_of_dest_addr,
unsigned short nr_of_input_streams,
unsigned short nr_of_output_streams
- ){
-
+ )
+{
SCTP_AssociationStatus status;
- SCTP_Path_Status path_x_status;
int result;
- short k;
- int bla;
- short i = 1, assoc_instance_idx = 1;
- bool cont, partial_assoc_found = FALSE;
-
- while ((i <= num_of_instance) && !(partial_assoc_found)){
- partial_assoc_found = (instance[i].Dest.nr_of_addrs == 0);
- if (partial_assoc_found)
- assoc_instance_idx = i;
-
- i++;
- }
-
- if (!(partial_assoc_found))
- {
- /* new association added */
- num_of_instance++;
- assoc_instance_idx = num_of_instance;
- instance[assoc_instance_idx].Source = instance[assoc_instance_idx-1].Source;
-
- instance[assoc_instance_idx].nr_of_inbound_streams = nr_of_input_streams ;
- instance[assoc_instance_idx].nr_of_outbound_streams = nr_of_input_streams ;
- }
-
- remote_sua.increase_instance();
-
- instance[assoc_instance_idx].SCTP_assoc_id = assoc_id;
- instance[assoc_instance_idx].remote_sua_id = remote_sua.num_of_instance;
- remote_sua.instance[remote_sua.num_of_instance].ssn.ssn = local_sua.instance[local_sua.num_of_instance].ssn.ssn;
- // should search for the correct sua local instance(future)
- instance[assoc_instance_idx].local_sua_id = local_sua.num_of_instance;
-#ifdef DEBUG
- cout << "Associate remote SUA(& SCTP) instance nr " << assoc_id << " with local SUA(& SCTP) instance nr " << assoc_instance_idx << " \n";
-#endif
- char logstring[100];
- sprintf(logstring, "Associate Remote SUA(& SCTP) instance nr %d with local SUA(& SCTP) instance nr %d", assoc_id, assoc_instance_idx );
- event_log("sua_database.c",logstring);
-
-
- result = sctp_getAssocStatus( instance[assoc_instance_idx].SCTP_assoc_id,
+ short k, j;
+ short i = 1, assoc_instance_idx = 0;
+ bool assoc_found = FALSE;
+ bool found_addr;
+
+ result = sctp_getAssocStatus( sctp_assoc_id,
&status
);
- /* conversion and fill in the destination address */
- instance[assoc_instance_idx].Dest.nr_of_addrs = nr_of_dest_addr;
- for(k=0; k < instance[assoc_instance_idx].Dest.nr_of_addrs ; k++)
- {
- result = sctp_getPathStatus( instance[assoc_instance_idx].SCTP_assoc_id,
- k,
- &path_x_status
- );
- instance[assoc_instance_idx].Dest.address_string[k] = path_x_status.destinationAddress;
- instance[assoc_instance_idx].Dest.addrs[k].sin.sin_port = status.destPort;
- }
- /* try to figure out ipv4 or v6 address family: get it from the source address */
- k = 0;
- instance[assoc_instance_idx].Dest.addrs[0].sa.sa_family = AF_LOCAL;
- cont = true;
- while ((k < 24) && (cont))
- {
- if (instance[assoc_instance_idx].Dest.address_string[0][k] == '.')
- {
- cont = false;
- instance[assoc_instance_idx].Dest.addrs[0].sa.sa_family = AF_INET;
- }
- if (instance[assoc_instance_idx].Dest.address_string[0][k] == ':')
- {
- cont = false;
- instance[assoc_instance_idx].Dest.addrs[0].sa.sa_family = AF_INET6;
+ 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;
+ while ((k < instance[i].Dest.nr_of_addrs) && (!found_addr))
+ {
+ j=0;
+ found_addr = true;
+ while (instance[i].Dest.address_string[k][j] != '\0'){
+ found_addr = found_addr && (instance[i].Dest.address_string[k][j] == status.primaryDestinationAddress[j]) ;
+ j++;
+ }
+ k++;
+ }
+ if (found_addr){
+ assoc_found = ( found_addr && (instance[i].Dest.addrs[0].sin.sin_port == status.destPort));
+ assoc_instance_idx = i;
}
- k++;
- }
+ else
+ assoc_found = false;
+ }
+ i++;
+ }
- for(k=0; k < instance[assoc_instance_idx].Dest.nr_of_addrs ; k++)
+ if (!(assoc_found))
{
- if (instance[assoc_instance_idx].Dest.addrs[k].sa.sa_family == AF_INET)
- bla = inet_pton( instance[assoc_instance_idx].Dest.addrs[k].sa.sa_family,
- (char *)instance[assoc_instance_idx].Dest.address_string[k],
- &instance[assoc_instance_idx].Dest.addrs[k].sin.sin_addr
- );
- else if (instance[assoc_instance_idx].Dest.addrs[k].sa.sa_family == AF_INET6)
- bla = inet_pton( instance[assoc_instance_idx].Dest.addrs[k].sa.sa_family,
- (char *)instance[assoc_instance_idx].Dest.address_string[k],
- &instance[assoc_instance_idx].Dest.addrs[k].sin6.sin6_addr
- );
- else
- cout << "Unsupported address family in passive associate\n";
-
+ /* unknown association added */
+ /* not allowed: drop it */
+ assoc_instance_idx = 0;
+ result = sctp_abort(sctp_assoc_id);
}
+ else
+ {
+ /* known association: no problemo */
+ instance[assoc_instance_idx].SCTP_assoc_id = sctp_assoc_id;
+ instance[assoc_instance_idx].remote_sua_id = 0;
+ remote_sua.instance[remote_sua.num_of_instance].ssn.ssn = local_sua.instance[instance[assoc_instance_idx].local_sua_id].ssn.ssn;
+ /* no msg queued, mark assoc down(from sua management viewpoint)*/
+ instance[assoc_instance_idx].asp.status = asp_down;
+
+#ifdef DEBUG
+ cout << "Associate remote SUA(& SCTP) instance nr " << sctp_assoc_id << " with local SUA(& SCTP) instance nr " << assoc_instance_idx << " \n";
+#endif
+ char logstring[100];
+ sprintf(logstring, "Associate Remote SUA(& SCTP) instance nr %d with local SUA(& SCTP) instance nr %d", sctp_assoc_id, assoc_instance_idx );
+ event_log("sua_database.c",logstring);
- /* no msg queued, mark assoc down(from sua management viewpoint)*/
- instance[assoc_instance_idx].asp.status = asp_down;
+ }
return(assoc_instance_idx);
}
@@ -566,150 +442,6 @@ short db_Sua_AssociationList:: shutdown(){
};
/***********************************************************************/
-/* Sua_AssociationList::route_on_IPpc */
-/***********************************************************************/
-signed int db_Sua_AssociationList::
-route_on_IPpc ( ipvxunion& dest_pc,
- ipvxunion& org_pc,
- int& sua_assoc_id
- )
-{
- int j=0,i=1,count, addr_start, addr_stop;
- unsigned int sctp_assoc_id = 0;
-
- sua_assoc_id = 0;
- bool cont = (i <= num_of_instance);
- bool found_assoc = false;
-
- while (cont)
- {
- found_assoc = false;
- j = 0;
- while ((j < instance[i].Dest.nr_of_addrs) && (!found_assoc))
- {
- found_assoc = (dest_pc.sa.sa_family == instance[i].Dest.addrs[j].sa.sa_family);
- if (dest_pc.sa.sa_family == AF_INET)
- {
- addr_start = 4;
- addr_stop = addr_start + 4;
- }
- else if (dest_pc.sa.sa_family == AF_INET6)
- {
- addr_start = 8;
- addr_stop = addr_start + 16;
- }
- else
- {
- addr_start = 0;
- addr_stop = 0;
- found_assoc = false;
- cout << "ERROR route_on_IPpc: Unknown addresstype\n";
- }
- /* compare the address family field */
- found_assoc = found_assoc && (dest_pc.ch[1] == instance[i].Dest.addrs[j].ch[1]);
-
- /* compare the ipv4/ipv6 address field */
- for (count = addr_start; count < addr_stop; count++)
- {
- found_assoc = found_assoc
- && (dest_pc.ch[count] == instance[i].Dest.addrs[j].ch[count]);
- }
- j++;
- }
-
- if (found_assoc)
- {
- cont = false;
- sctp_assoc_id = instance[i].SCTP_assoc_id;
- sua_assoc_id = i;
-#ifdef DEBUG
- cout << "Found Sua association " << i << " with SCTP assoc " << sctp_assoc_id << "\n";
-
- if (dest_pc.sa.sa_family == AF_INET)
- {
- cout << "CLD ip v4 = " << dest_pc.sin.sin_addr.s_addr << "\n";
- cout << "Remote IP = " << instance[i].Dest.addrs[0].sin.sin_addr.s_addr << "\n";
- }
- else if (dest_pc.sa.sa_family == AF_INET6)
- {
- cout << "CLD ip v6 = " << dest_pc.sin6.sin6_addr.s6_addr << "\n";
- cout << "Remote IP = " << instance[i].Dest.addrs[0].sin6.sin6_addr.s6_addr << "\n";
- }
- else
- cout << "Unknown CLD IP address type format\n";
-#endif
- }
- else
- {
- i++;
- cont = (i <= num_of_instance);
- }
- }
-
- return(sctp_assoc_id);
-};
-
-
-/***********************************************************************/
-/* Sua_AssociationList::route_on_SS7pc */
-/***********************************************************************/
-signed int db_Sua_AssociationList::
-route_on_SS7pc ( SS7union& dest_pc,
- SS7union& org_pc,
- int& sua_assoc_id
- )
-{
- int i=1;
- unsigned int sctp_assoc_id = 0;
-
-#ifdef DEBUG
- cout << "route on SS7 PC\n";
- cout << "PC family = " << dest_pc.ITU24.family << "\n";
- cout << "PC value = " << dest_pc.ITU24.pc << "\n";
-#endif
-
- sua_assoc_id = 0;
- bool cont = (i <= num_of_instance);
- bool found_assoc = false;
-
- while (cont)
- {
-
- if (dest_pc.ITU14.family == ITU14bit) // standard ITU: 14 bits
- found_assoc = ((dest_pc.ITU14.pc == instance[i].Dest.pc.ITU14.pc));
- else if (dest_pc.ITU24.family == ITU24bit) // chinese PC length: 24 bits
- found_assoc = ((dest_pc.ITU24.pc == instance[i].Dest.pc.ITU24.pc));
- else if (dest_pc.ANSI24.family == ANSI24bit) // ANSI PC length: 24 bits
- found_assoc = ((dest_pc.ANSI24.pc == instance[i].Dest.pc.ANSI24.pc));
- else
- found_assoc = false;
-
-
- if (found_assoc)
- {
- cont = false;
- sctp_assoc_id = instance[i].SCTP_assoc_id;
- sua_assoc_id = i;
-#ifdef DEBUG
- cout << "Found Sua association " << i << " with SCTP assoc " << sctp_assoc_id << "\n";
-
- cout << "CLD SS7 PC = " << dest_pc.ITU24.pc << "\n";
- cout << "Remote PC = " << instance[i].Dest.pc.ITU24.pc << "\n";
-
-#endif
- }
- else
- {
- i++;
- cont = (i <= num_of_instance);
- }
- }
-
- return(sctp_assoc_id);
-};
-
-
-/***********************************************************************/
/* Sua_AssociationList::increase_instance */
/***********************************************************************/
void db_Sua_AssociationList:: increase_instance(){
@@ -771,6 +503,21 @@ void db_Sua_AssociationList::up( unsigned int sua_assoc_id,
/* Sua_DatabaseList */
/***********************************************************************/
/***********************************************************************/
+/* Sua_DatabaseList::initalize */
+/***********************************************************************/
+void db_Sua_DatabaseList::
+initialize( )
+{
+ /* init all parts of the SUA database */
+ local_sua.initialize();
+ remote_sua.initialize();
+ AssocDB.initialize();
+ NameDB.initialize();
+ ApplicServ.initialize();
+
+}
+
+/***********************************************************************/
/* Sua_DatabaseList::Find_local_sua */
/***********************************************************************/
unsigned int db_Sua_DatabaseList::
@@ -778,21 +525,19 @@ Find_local_sua( sccp_addr_str& local_address
)
{
pointcode_str dest_pc;
- short i = 1, j = 0, count, addr_start, addr_stop;
+ short i = 1, j = 0, k, count, addr_start, addr_stop;
unsigned int Local_sua_id = 0;
bool result = FALSE;
- while ((i < db_MAX_REMOTE_SUA) && !(result) && (AssocDB.instance[i].Source.nr_of_addrs != 0))
+ while ((i < db_MAX_LOCAL_SUA) && !(result))
{
j = 0;
- while ((j < AssocDB.instance[i].Source.nr_of_addrs) && !(result))
+ while ((j < local_sua.instance[i].Source.nr_of_addrs) && !(result))
{
- /*result = ((AssocDB.instance[i].Source.addrs[j].sin.sin_addr.s_addr == local_address.pc.ipvx.sin.sin_addr.s_addr) ||
- (AssocDB.instance[i].Source.addrs[j].sin6.sin6_addr.s6_addr == local_address.pc.ipvx.sin6.sin6_addr.s6_addr));
- */
+ /* check IP address */
if (local_address.address_fields_present.pc == ipvx_pc_present)
{
- result = (local_address.pc.ipvx.sa.sa_family == AssocDB.instance[i].Source.addrs[j].sa.sa_family);
+ result = (local_address.pc.ipvx.sa.sa_family == local_sua.instance[i].Source.addrs[j].sa.sa_family);
if (local_address.pc.ipvx.sa.sa_family == AF_INET)
{
addr_start = 4;
@@ -812,25 +557,26 @@ Find_local_sua( sccp_addr_str& local_address
}
/* compare the address family field */
result = result &&
- (local_address.pc.ipvx.ch[1] == AssocDB.instance[i].Source.addrs[j].ch[1]);
+ (local_address.pc.ipvx.ch[1] == local_sua.instance[i].Source.addrs[j].ch[1]);
/* compare the ipv4/ipv6 address field */
for (count = addr_start; count < addr_stop; count++)
{
result = result &&
- (local_address.pc.ipvx.ch[count] == AssocDB.instance[i].Source.addrs[j].ch[count]);
+ (local_address.pc.ipvx.ch[count] == local_sua.instance[i].Source.addrs[j].ch[count]);
}
}
+ /* check SS7 pointcode */
else if (local_address.address_fields_present.pc == ss7_pc_present)
{
- result = (local_address.pc.ss7.ITU14.family == AssocDB.instance[i].Source.pc.ITU14.family);
+ result = (local_address.pc.ss7.ITU14.family == local_sua.instance[i].Source.pc.ITU14.family);
if (((local_address.pc.ss7.ITU14.family == ITU14bit) ||
(local_address.pc.ss7.ITU14.family == ITU24bit)) ||
(local_address.pc.ss7.ITU14.family == ANSI24bit))
{
/* compare the ITU 14/24bit or ANSI 24bit PC address field */
result = result &&
- (local_address.pc.ss7.ITU14.pc == AssocDB.instance[i].Source.pc.ITU14.pc);
+ (local_address.pc.ss7.ITU14.pc == local_sua.instance[i].Source.pc.ITU14.pc);
}
else
{
@@ -838,6 +584,7 @@ Find_local_sua( sccp_addr_str& local_address
cout << "ERROR Find_local_sua: Unknown SS7 pointcode addresstype\n";
}
}
+ /* check hostname */
else if (local_address.address_fields_present.name_gt == hostname_present)
{
count = 0;
@@ -845,7 +592,7 @@ Find_local_sua( sccp_addr_str& local_address
dest_pc
);
- result = (dest_pc.ipvx.sa.sa_family == AssocDB.instance[i].Source.addrs[j].sa.sa_family);
+ result = (dest_pc.ipvx.sa.sa_family == local_sua.instance[i].Source.addrs[j].sa.sa_family);
if (dest_pc.ipvx.sa.sa_family == AF_INET)
{
@@ -870,14 +617,26 @@ Find_local_sua( sccp_addr_str& local_address
for (count = addr_start; count < addr_stop; count++)
{
result = result &&
- (dest_pc.ipvx.ch[count] == AssocDB.instance[i].Source.addrs[j].ch[count]);
+ (dest_pc.ipvx.ch[count] == local_sua.instance[i].Source.addrs[j].ch[count]);
k++;
}
}
+ /* check global title */
else if (local_address.address_fields_present.name_gt == GT_present)
{
- cout << "ERROR Find_local_sua: GT code not implemented yet\n";
+ cout << "Find_local_sua: Global Title\n";
+ result =
+ (local_address.name.GT.nr_of_digits == local_sua.instance[i].Name.GT.nr_of_digits) &&
+ ( local_address.name.GT.Translation_Type == local_sua.instance[i].Name.GT.Translation_Type) &&
+ ( local_address.name.GT.Numbering_Plan == local_sua.instance[i].Name.GT.Numbering_Plan) &&
+ ( local_address.name.GT.Nature_of_Address == local_sua.instance[i].Name.GT.Nature_of_Address) ;
+ for (k = 0; k < local_address.name.GT.nr_of_digits; k++)
+ {
+ result = result &&
+ ( local_address.name.GT.digits[k] == local_sua.instance[i].Name.GT.digits[k]);
+ }
+ cout << "i = " << i << " Find_local_sua = " << result << "\n";
}
else
{
@@ -887,9 +646,9 @@ Find_local_sua( sccp_addr_str& local_address
if (result)
{
- Local_sua_id = AssocDB.instance[i].local_sua_id;
+ Local_sua_id = i;
#ifdef DEBUG
- cout << "Find_local_sua: local_sua_id = " << Local_sua_id << " , instance "<< i << "\n";
+ cout << "Find_local_sua: local_sua_id = " << Local_sua_id << "\n";
#endif
}
j++;
@@ -900,6 +659,154 @@ Find_local_sua( sccp_addr_str& local_address
return(Local_sua_id);
};
+
+/***********************************************************************/
+/* Sua_DatabaseList::route_on_IPpc */
+/***********************************************************************/
+signed int db_Sua_DatabaseList::
+route_on_IPpc ( ipvxunion& dest_pc,
+ ipvxunion& org_pc,
+ int& sua_assoc_id
+ )
+{
+ int j=0,i=1,count, addr_start, addr_stop;
+ unsigned int sctp_assoc_id = 0;
+
+ sua_assoc_id = 0;
+ bool cont = (i <= remote_sua.num_of_instance);
+ bool found_assoc = false;
+
+ while (cont)
+ {
+ found_assoc = false;
+ j = 0;
+ while ((j < remote_sua.instance[i].Dest.nr_of_addrs) && (!found_assoc))
+ {
+ found_assoc = (dest_pc.sa.sa_family == remote_sua.instance[i].Dest.addrs[j].sa.sa_family);
+ if (dest_pc.sa.sa_family == AF_INET)
+ {
+ addr_start = 4;
+ addr_stop = addr_start + 4;
+ }
+ else if (dest_pc.sa.sa_family == AF_INET6)
+ {
+ addr_start = 8;
+ addr_stop = addr_start + 16;
+ }
+ else
+ {
+ addr_start = 0;
+ addr_stop = 0;
+ found_assoc = false;
+ cout << "ERROR route_on_IPpc: Unknown addresstype\n";
+ }
+ /* compare the address family field */
+ found_assoc = found_assoc && (dest_pc.ch[1] == remote_sua.instance[i].Dest.addrs[j].ch[1]);
+
+ /* compare the ipv4/ipv6 address field */
+ for (count = addr_start; count < addr_stop; count++)
+ {
+ found_assoc = found_assoc
+ && (dest_pc.ch[count] == remote_sua.instance[i].Dest.addrs[j].ch[count]);
+ }
+ j++;
+ }
+
+ if (found_assoc)
+ {
+ cont = false;
+
+ sua_assoc_id = remote_sua.instance[i].SUA_assoc_id;
+ sctp_assoc_id = AssocDB.instance[remote_sua.instance[i].SUA_assoc_id].SCTP_assoc_id;
+
+#ifdef DEBUG
+ cout << "Remote sua " << i << " Sua association " << sua_assoc_id << " with SCTP assoc " << sctp_assoc_id << "\n";
+
+ if (dest_pc.sa.sa_family == AF_INET)
+ {
+ cout << "CLD ip v4 = " << dest_pc.sin.sin_addr.s_addr << "\n";
+ cout << "Remote IP = " << remote_sua.instance[i].Dest.addrs[0].sin.sin_addr.s_addr << "\n";
+ }
+ else if (dest_pc.sa.sa_family == AF_INET6)
+ {
+ cout << "CLD ip v6 = " << dest_pc.sin6.sin6_addr.s6_addr << "\n";
+ cout << "Remote IP = " << remote_sua.instance[i].Dest.addrs[0].sin6.sin6_addr.s6_addr << "\n";
+ }
+ else
+ cout << "Unknown CLD IP address type format\n";
+#endif
+ }
+ else
+ {
+ i++;
+ cont = (i <= remote_sua.num_of_instance);
+ }
+ }
+
+ return(sctp_assoc_id);
+}
+
+/***********************************************************************/
+/* Sua_DatabaseList::route_on_SS7pc */
+/***********************************************************************/
+signed int db_Sua_DatabaseList::
+route_on_SS7pc ( SS7union& dest_pc,
+ SS7union& org_pc,
+ int& sua_assoc_id
+ )
+{
+ int i=1;
+ unsigned int sctp_assoc_id = 0;
+
+#ifdef DEBUG
+ cout << "route on SS7 PC\n";
+ cout << "PC family = " << dest_pc.ITU24.family << "\n";
+ cout << "PC value = " << dest_pc.ITU24.pc << "\n";
+#endif
+
+ sua_assoc_id = 0;
+ bool cont = (i <= remote_sua.num_of_instance);
+ bool found_assoc = false;
+
+ while (cont)
+ {
+
+ if (dest_pc.ITU14.family == ITU14bit) // standard ITU: 14 bits
+ found_assoc = ((dest_pc.ITU14.pc == remote_sua.instance[i].Dest.pc.ITU14.pc));
+ else if (dest_pc.ITU24.family == ITU24bit) // chinese PC length: 24 bits
+ found_assoc = ((dest_pc.ITU24.pc == remote_sua.instance[i].Dest.pc.ITU24.pc));
+ else if (dest_pc.ANSI24.family == ANSI24bit) // ANSI PC length: 24 bits
+ found_assoc = ((dest_pc.ANSI24.pc == remote_sua.instance[i].Dest.pc.ANSI24.pc));
+ else
+ found_assoc = false;
+
+
+ if (found_assoc)
+ {
+ cont = false;
+
+ sua_assoc_id = remote_sua.instance[i].SUA_assoc_id;
+ sctp_assoc_id = AssocDB.instance[remote_sua.instance[i].SUA_assoc_id].SCTP_assoc_id;
+
+#ifdef DEBUG
+ cout << "Remote sua " << i << " Sua association " << sua_assoc_id << " with SCTP assoc " << sctp_assoc_id << "\n";
+
+ cout << "CLD SS7 PC = " << dest_pc.ITU24.pc << "\n";
+ cout << "Remote PC = " << remote_sua.instance[i].Dest.pc.ITU24.pc << "\n";
+
+#endif
+ }
+ else
+ {
+ i++;
+ cont = (i <= remote_sua.num_of_instance);
+ }
+ }
+
+ return(sctp_assoc_id);
+}
+
+
/***********************************************************************/
/* Sua_DatabaseList::route_on_GTname */
/***********************************************************************/
@@ -927,10 +834,10 @@ route_on_GTname ( hostname_str& dest_name,
org_pc
); */
- sctp_assoc_id = AssocDB.route_on_IPpc( dest_pc.ipvx,
- org_pc.ipvx,
- sua_assoc_id
- );
+ sctp_assoc_id = route_on_IPpc( dest_pc.ipvx,
+ org_pc.ipvx,
+ sua_assoc_id
+ );
if (sctp_assoc_id != 0 )
return(sctp_assoc_id);
@@ -965,10 +872,10 @@ route_on_GTT ( global_title_str& dest_gt,
dest_pc
);
- sctp_assoc_id = AssocDB.route_on_IPpc( dest_pc.ipvx,
- org_pc.ipvx,
- sua_assoc_id
- );
+ sctp_assoc_id = route_on_IPpc( dest_pc.ipvx,
+ org_pc.ipvx,
+ sua_assoc_id
+ );
if (sctp_assoc_id != 0 )
return(sctp_assoc_id);
@@ -992,16 +899,17 @@ route_msg( sccp_addr_str& cld,
sua_assoc_id = 0;
#ifdef DEBUG
- cout << "num_of_instance : "<< AssocDB.num_of_instance << "\n";
+ cout << "number of associations instances= : "<< AssocDB.num_of_instance << "\n";
+ cout << "number of remote sua instances= : "<< remote_sua.num_of_instance << "\n";
#endif
if ((cld.address_fields_present.pc == ipvx_pc_present) &&
(cld.routing_ind == route_on_ssn))
{
- sctp_assoc_id = AssocDB.route_on_IPpc( cld.pc.ipvx,
- clg.pc.ipvx,
- sua_assoc_id
- );
+ sctp_assoc_id = route_on_IPpc( cld.pc.ipvx,
+ clg.pc.ipvx,
+ sua_assoc_id
+ );
}
else if ((cld.address_fields_present.name_gt == hostname_present) &&
(cld.routing_ind == route_on_name_gt))
@@ -1027,18 +935,18 @@ route_msg( sccp_addr_str& cld,
(cld.address_fields_present.pc == ipvx_pc_present) &&
(cld.routing_ind == route_on_name_gt_next_office))
{
- sctp_assoc_id = AssocDB.route_on_IPpc( cld.pc.ipvx,
- clg.pc.ipvx,
- sua_assoc_id
- );
+ sctp_assoc_id = route_on_IPpc( cld.pc.ipvx,
+ clg.pc.ipvx,
+ sua_assoc_id
+ );
}
else if ((cld.address_fields_present.pc == ss7_pc_present) &&
(cld.routing_ind == route_on_ssn))
{
- sctp_assoc_id = AssocDB.route_on_SS7pc( cld.pc.ss7,
- clg.pc.ss7,
- sua_assoc_id
- );
+ sctp_assoc_id = route_on_SS7pc( cld.pc.ss7,
+ clg.pc.ss7,
+ sua_assoc_id
+ );
}
else
{
diff --git a/sualibrary/sua/sua_debug.h b/sualibrary/sua/sua_debug.h
index a2eb436..3127a7e 100644
--- a/sualibrary/sua/sua_debug.h
+++ b/sualibrary/sua/sua_debug.h
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_debug.h,v 1.5 2002/11/12 11:02:49 p82609 Exp $
+ * $Id: sua_debug.h,v 1.1 2003/01/14 14:15:37 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
diff --git a/sualibrary/sua/sua_distribution.cpp b/sualibrary/sua/sua_distribution.cpp
index d01b93a..99b3ecc 100644
--- a/sualibrary/sua/sua_distribution.cpp
+++ b/sualibrary/sua/sua_distribution.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_distribution.cpp,v 1.7 2002/11/12 11:02:49 p82609 Exp $
+ * $Id: sua_distribution.cpp,v 1.3 2003/01/27 16:47:43 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@@ -287,6 +287,7 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
else
cout << "ERROR: TCB " << Sua_ConnId << " was not retrieved?!!\n";
+ break;
}
case co_data /*data*/:
{
@@ -389,6 +390,7 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
else
cout << "ERROR: TCB " << Sua_ConnId << " was not retrieved?!!\n";
+ break;
}
default:
{
@@ -944,9 +946,12 @@ void *sctp_CommunicationUpNotif( unsigned int sctp_assoc_id,
cout << "sua_distribution.c:should send ASPUP\n";
#endif
#ifndef SG_MODE
- /* send ASP-UP to remote to start activating local & remote ASP */
- result = sua_send_ASPUP( sua_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
+ );
+ }
#endif
#endif
diff --git a/sualibrary/sua/sua_distribution.h b/sualibrary/sua/sua_distribution.h
index 6a62f50..f33b531 100644
--- a/sualibrary/sua/sua_distribution.h
+++ b/sualibrary/sua/sua_distribution.h
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_distribution.h,v 1.2 2002/10/15 14:53:48 p82609 Exp $
+ * $Id: sua_distribution.h,v 1.1 2003/01/14 14:15:37 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
diff --git a/sualibrary/sua/sua_file.cpp b/sualibrary/sua/sua_file.cpp
index a901992..5573810 100644
--- a/sualibrary/sua/sua_file.cpp
+++ b/sualibrary/sua/sua_file.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_file.cpp,v 1.3 2002/11/12 11:02:49 p82609 Exp $
+ * $Id: sua_file.cpp,v 1.6 2003/01/31 11:36:39 p82609 Exp $
*
* SUA implementation according to SUA draft issue 13.
*
@@ -128,373 +128,644 @@ string get_argument(string line,
}
/***********************************************************************/
-/* read sua file */
+/* create host parameter handling */
/***********************************************************************/
-int read_sua_file(string filename,
- db_Sua_LocalList& local_sua,
- db_Sua_RemoteList& remote_sua,
- db_Sua_AssociationList& Assoc_sua,
- db_Sua_NameList& NameDB_sua,
- db_Sua_ASList& ApplicServ_sua
- )
+void sua_cr_host( string host_parm_str,
+ db_Sua_LocalList& local_sua
+ )
{
- string sua_filename;
- string sua_arg;
- string address_str,ip_addr_str;
- char ch1, ch2;
- string sua_line;
- int num_of_char = 0;
- int num_of_arg = 0;
- int num_of_lines = 0;
- int present_local_instance = 0;
- int present_remote_instance = 0;
-
+ int host_id;
+ short cpy_start, cpy_len;
+
+ /* get host id from param string, use as index in local_sua table */
+ if (host_parm_str.find("host_id=") != host_parm_str.npos)
+ {
+ cpy_start = (host_parm_str.find("host_id=")+8);
+ cpy_len = (host_parm_str.find(",org_ip")) - cpy_start ;
+ string host_id_str( host_parm_str, cpy_start, cpy_len);
#ifdef DEBUG
- cout << "file to read = " << filename << " \n";
+ /*cout << "Host id = " << host_id_str << "\n";*/
#endif
- cout << "SUA local sua instantation parameters(mandatory) \n";
- cout << "-s[n] x.x.x.x -l yyy [-7s 7777] [-gs tt-nat-np-digits][-u] \n";
- cout << "-s : source address \n";
- cout << "-l : source local sua portnumber \n";
- cout << "-sn: source name \n";
- cout << "-7s: source SS7 pointcode\n";
- cout << "-u : listen on local port number \n";
- cout << "SUA parameters of the sua tester (optional)\n";
- cout << "Not supported yet (-b 1000 -o -v) \n";
- cout << "SUA parameters of the SUA remote instantation(s) (optional)\n";
- cout << "-d[n] x.x.x.x -r yyy [-7d 7777] [-gd tt-nat-np-digits] [-a ASnumber] \n";
- cout << "-d : destination address \n";
- cout << "-r : destination sua portnumber \n";
- cout << "-dn: destination name \n";
- cout << "-7d: destination SS7 pointcode\n";
- cout << "-gs: source global title(TTID-NAT-NUMPLAN-Digits) linked to -s address or -sn name \n";
- cout << "-gd: destination global title(TTID-NAT-NUMPLAN-Digits) linked to -d address or -dn name\n";
- cout << "-a : Application Server(AS) this address belongs to \n";
+ host_id = atoi(host_id_str.c_str());
+ }
+ else
+ return;
- ifstream infile(filename.c_str());
- while (getline(infile, sua_line))
+ /* get all(=multihomed) addresses till next parameter */
+ /* fill in IP address as string in local_sua */
+ if (host_parm_str.find("org_ip=") != host_parm_str.npos)
{
- num_of_lines++;
- // analyse input line and split up in arguments according to
- // the spaces in the line: each argument is then processed
- unsigned int num_of_char_in_line = 0;
- int b=0, e=0;
- bool next_arg;
-
- sua_arg = get_argument(sua_line,b,e,num_of_char_in_line);
- next_arg = false;
-
- // make selection on cmd argument
- while (num_of_char_in_line < sua_line.length())
- {
- ch2 = ' ';
- if (sua_arg[0] == '-')
- {
- ch1 = sua_arg[1];
- ch2 = sua_arg[2];
- }
- else if (sua_arg[0] == '/')
- ch1 = sua_arg[0];
- else
- {
- cout << "weird option \n";
- ch1 = ' ';
- }
-
- switch (ch1)
- {
- case 's': // read source addresses for sua
- {
- num_of_arg++;
- address_str = get_argument(sua_line,b,e,num_of_char_in_line);
- if (present_local_instance > 0) {
- present_local_instance= 0;
- }
- local_sua.increase_instance();
- Assoc_sua.increase_instance();
- present_remote_instance = 0;
- Assoc_sua.instance[Assoc_sua.num_of_instance].local_sua_id = local_sua.num_of_instance;
- Assoc_sua.instance[Assoc_sua.num_of_instance].nr_of_inbound_streams = 1;
- Assoc_sua.instance[Assoc_sua.num_of_instance].nr_of_outbound_streams = 1;
-
- if (ch2 == 'n') {
- ip_addr_str = Assoc_sua.read_host_name(NameDB_sua, address_str);
- Assoc_sua.read_Source_addr(ip_addr_str);
- }
- else {
- Assoc_sua.read_Source_addr(address_str);
- }
-
- present_local_instance++;
- break;
- }
- case 'd':
- { // read destination addresses for sua
- num_of_arg++;
- address_str = get_argument(sua_line,b,e,num_of_char_in_line);
- remote_sua.increase_instance();
- if (present_remote_instance > 0) {
- Assoc_sua.increase_instance();
- Assoc_sua.instance[Assoc_sua.num_of_instance].Source =
- Assoc_sua.instance[Assoc_sua.num_of_instance-1].Source;
- Assoc_sua.instance[Assoc_sua.num_of_instance].local_sua_id =
- Assoc_sua.instance[Assoc_sua.num_of_instance-1].local_sua_id;
- Assoc_sua.instance[Assoc_sua.num_of_instance].nr_of_inbound_streams = 1;
- Assoc_sua.instance[Assoc_sua.num_of_instance].nr_of_outbound_streams = 1;
- present_remote_instance = 0;
- }
- if (ch2 == 'n') {
- ip_addr_str = Assoc_sua.read_host_name(NameDB_sua, address_str);
- Assoc_sua.read_Dest_addr(ip_addr_str);
- }
- else {
- Assoc_sua.read_Dest_addr(address_str);
- }
- Assoc_sua.instance[Assoc_sua.num_of_instance].remote_sua_id = remote_sua.num_of_instance;
-
- present_remote_instance++;
-
- break;
- }
- case 'l':
- { // read local portnumber for sua
- num_of_arg++;
- address_str = get_argument(sua_line,b,e,num_of_char_in_line);
- Assoc_sua.read_Source_port(address_str);
-
- break;
- }
- case 'r':
- { // read remote portnumber for sua
- num_of_arg++;
- address_str = get_argument(sua_line,b,e,num_of_char_in_line);
- Assoc_sua.read_Dest_port(address_str);
-
- break;
- }
- case 'a':
- { // read Application Server number this remote ASP belongs to
- num_of_arg++;
- address_str = get_argument(sua_line,b,e,num_of_char_in_line);
-
- Assoc_sua.instance[Assoc_sua.num_of_instance].asp.linked_to_AS[0] = ApplicServ_sua.read_AS(address_str, Assoc_sua.num_of_instance );
-
- break;
- }
- case 'b':
- {
- num_of_arg++;
- address_str = get_argument(sua_line,b,e,num_of_char_in_line);
+ cpy_start = (host_parm_str.find("org_ip=")+7);
+ cpy_len = (host_parm_str.find(",org_port")) - cpy_start ;
+ string ip_addr_str( host_parm_str, cpy_start, cpy_len);
#ifdef DEBUG
- cout << "discard option b \n";
-#endif
-
-
- }
- case 'n':
- { // read sybsytem number = SSN (valid for both local and remote)
- num_of_arg++;
- address_str = get_argument(sua_line,b,e,num_of_char_in_line);
- remote_sua.read_ssn(address_str);
- local_sua.read_ssn(address_str);
-
- break;
- }
- case 'q': // read QOS fields for sua
- {
- num_of_arg++;
- address_str = get_argument(sua_line,b,e,num_of_char_in_line);
-
-
- break;
- }
- case 'u':
- { //
- break;
- }
- case 'm':
- { //
- break;
- }
- case 'o':
- { //
- break;
- }
- case 't':
- { // number of streams incoming AND outgoing
- num_of_arg++;
- address_str = get_argument(sua_line,b,e,num_of_char_in_line);
- Assoc_sua.read_stream_number(address_str);
- break;
- }
- case 'v':
- { //
- break;
- }
- case 'f':
- { // file option: we are in file mode could later be used for
- // recursive filereading. Ignore for the moment
- num_of_arg++;
- break;
- }
- case 'g':
- {
- /* read global title */
- switch (ch2)
- {
- case 's': // read source Global Title for sua
- {
- num_of_arg++;
- address_str = get_argument(sua_line,b,e,num_of_char_in_line);
-
- Assoc_sua.read_Source_GT(NameDB_sua, address_str);
-
- break;
- }
- case 'd':
- { // read destination Global Title for sua
- num_of_arg++;
- address_str = get_argument(sua_line,b,e,num_of_char_in_line);
-
- Assoc_sua.read_Dest_GT(NameDB_sua, address_str);
-
- break;
- }
- default:
- {
- break;
- }
- }
- break;
- }
- case 'i':
- {
- // ignore character, is not a error, go to next argument
- break;
- }
- case '7':
- { /* read SS7 pointcodes */
- switch (ch2)
- {
- case 's': // read source pointcode for sua
- {
- num_of_arg++;
- address_str = get_argument(sua_line,b,e,num_of_char_in_line);
-
- Assoc_sua.read_Source_pointcode(address_str);
-
- break;
- }
- case 'd':
- { // read destination pointcode for sua
- num_of_arg++;
- address_str = get_argument(sua_line,b,e,num_of_char_in_line);
-
- Assoc_sua.read_Dest_pointcode(address_str);
-
- break;
- }
- default:
- {
- break;
- }
- }
- break;
- }
- case '/':
- {
- // comment: skip this line
- num_of_char_in_line = num_of_char_in_line + sua_line.length();
- b=0;
- e=0;
- break;
- }
- default:
- {
- break;
- }
- }
- sua_arg = get_argument(sua_line,b,e,num_of_char_in_line);
- num_of_arg++;
- }
- // finished reading the whole line
- num_of_char = num_of_char + num_of_char_in_line;
- cout << "Line " << num_of_lines << " : " << sua_line << "\n";
+ /*cout << "org ip addr = " << ip_addr_str << "\n";*/
+#endif
+ local_sua.instance[host_id].Source.read_addr_param(ip_addr_str);
}
+ else
+ return;
+ /* get the local port number for this instance */
+ if (host_parm_str.find("org_port=") != host_parm_str.npos)
+ {
+ cpy_start = (host_parm_str.find("org_port=")+9);
+ cpy_len = (host_parm_str.find(",ssn")) - cpy_start ;
+ string portnumber_str( host_parm_str, cpy_start, cpy_len);
#ifdef DEBUG
- cout << "End of file: statistics \n";
- cout << "Number of lines = " << num_of_lines <<"\n";
- cout << "Number of characters in file = " << num_of_char << "\n";
+ /*cout << "org portnumber = " << portnumber_str << "\n";*/
+#endif
+ local_sua.instance[host_id].Source.read_port_num(portnumber_str);
+ }
+ else
+ local_sua.instance[host_id].Source.read_port_num("14001");
+ /* get the local ssn for this local sua host instantiation */
+ if (host_parm_str.find("ssn=") != host_parm_str.npos)
+ {
+ cpy_start = (host_parm_str.find("ssn=")+4);
+ cpy_len = (host_parm_str.find(",streams")) - cpy_start ;
+ string ssn_str( host_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ /*cout << "org ssn = " << ssn_str << "\n";*/
#endif
+ local_sua.instance[host_id].ssn.ssn = atoi(ssn_str.c_str());
+ }
+ else
+ local_sua.instance[host_id].ssn.ssn = 255;
- return (0);
+ /* get the number of streams supported for this sua instantiation */
+ if (host_parm_str.find("streams=") != host_parm_str.npos)
+ {
+ cpy_start = (host_parm_str.find("streams=")+8);
+ cpy_len = (host_parm_str.find(";")) - cpy_start ;
+ string max_streams_str( host_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ /*cout << "Max number of streams = " << max_streams_str << "\n";*/
+#endif
+ local_sua.instance[host_id].max_streams= atoi(max_streams_str.c_str());
+ }
+ else
+ local_sua.instance[host_id].max_streams= 16;
-} /* end of read_sua_file */
+ local_sua.increase_instance();
+
+ return;
+
+}
/***********************************************************************/
-/* create host parameter handling */
+/* create association parameter handling */
/***********************************************************************/
-void sua_cr_host( string host_parm_str,
- db_Sua_LocalList& local_sua
- )
+void sua_cr_assoc( string assoc_parm_str,
+ db_Sua_AssociationList& Assoc_sua,
+ db_Sua_LocalList& local_sua
+ )
{
+ int assoc_id;
int host_id;
- /* get host id from param string, use as index in local_sua table */
+ short cpy_start, cpy_len;
+
+ /* get assoc id from param string, use as index in Assoc_sua table */
+ if (assoc_parm_str.find("assoc_id=") != assoc_parm_str.npos)
+ {
+ cpy_start = (assoc_parm_str.find("assoc_id=")+9);
+ cpy_len = (assoc_parm_str.find(",init")) - cpy_start ;
+ string assoc_id_str( assoc_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ /*cout << "Assoc id = " << assoc_id_str << "\n";*/
+#endif
+ assoc_id = atoi(assoc_id_str.c_str());
+ }
+ else
+ return;
+
+ /* get init from param string */
+ /* indicates pasive or active association setup*/
+ if (assoc_parm_str.find("init=") != assoc_parm_str.npos)
+ {
+ cpy_start = (assoc_parm_str.find("init=")+5);
+ cpy_len = (assoc_parm_str.find(",host_id")) - cpy_start ;
+ string init_str( assoc_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ /*cout << "Init = " << init_str << "\n";*/
+#endif
+ if (init_str.find("true") != init_str.npos)
+ Assoc_sua.instance[assoc_id].init_assoc = true;
+ else
+ Assoc_sua.instance[assoc_id].init_assoc = false;
+ }
+ else
+ Assoc_sua.instance[assoc_id].init_assoc = false;
+
+ /* get host id from param string, use as index */
+ if (assoc_parm_str.find("host_id=") != assoc_parm_str.npos)
+ {
+ cpy_start = (assoc_parm_str.find("host_id=")+8);
+ cpy_len = (assoc_parm_str.find(",dest_ip")) - cpy_start ;
+ string host_id_str( assoc_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ /*cout << "Host id = " << host_id_str << "\n";*/
+#endif
+ host_id = atoi(host_id_str.c_str());
+ }
+ else
+ return;
+
+ /* fill in the local_sua instance = host_id */
+ Assoc_sua.instance[assoc_id].local_sua_id = host_id;
- host_id = 1;
+ /* fill in the source address */
+ Assoc_sua.instance[assoc_id].Source = local_sua.instance[host_id].Source;
- string ip_addr_str( host_parm_str, (host_parm_str.find("org_ip=")+7),host_parm_str.length());
/* get all(=multihomed) addresses till next parameter */
- /* fill in IP address as string in local_sua */
- /*local_sua.instance[host_id].ip_addr_str = ip_addr_str;*/
+ /* fill in IP address as string & network in assoc_sua */
+ if (assoc_parm_str.find("dest_ip=") != assoc_parm_str.npos)
+ {
+ cpy_start = (assoc_parm_str.find("dest_ip=")+8);
+ cpy_len = (assoc_parm_str.find(",dest_port")) - cpy_start ;
+ string ip_addr_str( assoc_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ /*cout << "org ip addr = " << ip_addr_str << "\n";*/
+#endif
+ Assoc_sua.instance[assoc_id].Dest.read_addr_param(ip_addr_str);
+ }
+ else
+ return;
- /* get the local port number for this instance */
- /* local_sua.instance[host_id].portnumber=14001 */
+ /* get the remote port number for this assoc instance */
+ if (assoc_parm_str.find("dest_port=") != assoc_parm_str.npos)
+ {
+ cpy_start = (assoc_parm_str.find("dest_port=")+10);
+ cpy_len = (assoc_parm_str.find(";")) - cpy_start ;
+ string portnumber_str( assoc_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ /*cout << "org portnumber = " << portnumber_str << "\n";*/
+#endif
+ Assoc_sua.instance[assoc_id].Dest.read_port_num(portnumber_str);
+ }
+ else
+ Assoc_sua.instance[assoc_id].Dest.read_port_num("14001");
+
+ /* fill in the outgoing and incoming stream number */
+ Assoc_sua.instance[assoc_id].nr_of_inbound_streams = local_sua.instance[host_id].max_streams;
+ Assoc_sua.instance[assoc_id].nr_of_outbound_streams = local_sua.instance[host_id].max_streams;
- /* get the local ssn for this local sua host instantiation */
- /* local_sua.instance[host_id].ssn = 5 */
+ /* fill in the remote_sua instance = assoc_id */
+ Assoc_sua.instance[assoc_id].remote_sua_id = assoc_id;
- /* get the number of streams supported for this sua instantiation */
- /* local_sua.instance[host_id].streams=16 */
+ Assoc_sua.increase_instance();
+
+ return;
}
-
+
/***********************************************************************/
-/* create association parameter handling */
+/* create origination pointcode parameter handling */
/***********************************************************************/
-void sua_cr_assoc( string assoc_parm_str,
- db_Sua_AssociationList& Assoc_sua,
+void sua_cr_orgpc( string orgpc_parm_str,
db_Sua_LocalList& local_sua
- )
+ )
{
- int assoc_id;
- /* get assoc id from param string, use as index in assoc_sua table */
+ int host_id, pc;
+ short cpy_start, cpy_len;
- assoc_id = 1;
+ /* get host id from param string, use as index local_sua table */
+ if (orgpc_parm_str.find("host_id=") != orgpc_parm_str.npos)
+ {
+ cpy_start = (orgpc_parm_str.find("host_id=")+8);
+ cpy_len = (orgpc_parm_str.find(",pc")) - cpy_start ;
+ string host_id_str( orgpc_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "Host id = " << host_id_str << "\n";
+#endif
+ host_id = atoi(host_id_str.c_str());
+ }
+ else
+ return;
- string ip_addr_str( assoc_parm_str, (assoc_parm_str.find("dest_ip=")+8),assoc_parm_str.length());
- /* get all(=multihomed) addresses till next parameter */
- /* fill in IP address as string & network in assoc_sua */
- /* Assoc_sua.instance[assoc_id].ip_addr_str = ip_addr_str;*/
+ /* get origination pointcode from param string */
+ if (orgpc_parm_str.find("pc=") != orgpc_parm_str.npos)
+ {
+ cpy_start = (orgpc_parm_str.find("pc=")+3);
+ cpy_len = (orgpc_parm_str.find(";")) - cpy_start ;
+ string orgpc_str( orgpc_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "Pointcode = " << orgpc_str << "\n";
+#endif
+ pc = atoi(orgpc_str.c_str());
+ }
+ else
+ return;
- /* get the local port number for this instance */
- /* Assoc_sua.instance[assoc_id].portnumber=14001 */
+ /* fill in the local_sua instance pointcode */
+ local_sua.instance[host_id].Source.pc.ITU24.family = ITU14bit;
+ local_sua.instance[host_id].Source.pc.ITU24.pc = pc;
+
+ return;
- /* get the local ssn for this local sua host instantiation */
- /* local_sua.instance[host_id].ssn = 5 */
+}
- /* get the number of streams supported for this sua instantiation */
- /* local_sua.instance[host_id].streams=16 */
+/***********************************************************************/
+/* create origination Global title handling */
+/***********************************************************************/
+void sua_cr_orgGT( string orggt_parm_str,
+ db_Sua_LocalList& local_sua
+ )
+{
+ int host_id;
+ unsigned int nature_of_addr, number_plan,translation_type;
+ short cpy_start, cpy_len;
+
+ /* get host id from param string, use as index local_sua table */
+ if (orggt_parm_str.find("host_id=") != orggt_parm_str.npos)
+ {
+ cpy_start = (orggt_parm_str.find("host_id=")+8);
+ cpy_len = (orggt_parm_str.find(",")) - cpy_start ;
+ string host_id_str( orggt_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "Host id = " << host_id_str << "\n";
+#endif
+ host_id = atoi(host_id_str.c_str());
+ }
+ else
+ return;
+
+ /* get origination Global Title from param string */
+ /* default translation type number = 0 */
+ translation_type = 0;
+ /* default nature of address = 0 */
+ nature_of_addr = 0;
+ /* default number plan(E164) = 0 */
+ number_plan = 0;
+
+ if (orggt_parm_str.find("tt=") != orggt_parm_str.npos)
+ {
+ cpy_start = (orggt_parm_str.find("tt=")+3);
+ cpy_len = (orggt_parm_str.find(",na")) - cpy_start ;
+ string ttn_str( orggt_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "tt = " << ttn_str << "\n";
+#endif
+ translation_type = atoi(ttn_str.c_str());
+ }
+
+ /* get nature of address from param string */
+ if (orggt_parm_str.find("na=") != orggt_parm_str.npos)
+ {
+ cpy_start = (orggt_parm_str.find("na=")+3);
+ cpy_len = (orggt_parm_str.find(",np")) - cpy_start ;
+ string nature_addr_str( orggt_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "Nature of address = " << nature_addr_str << "\n";
+#endif
+ nature_of_addr = atoi(nature_addr_str.c_str());
+ }
+
+ /* get numbering plan from param string */
+ if (orggt_parm_str.find("np=") != orggt_parm_str.npos)
+ {
+ cpy_start = (orggt_parm_str.find("np=")+3);
+ cpy_len = (orggt_parm_str.find(",digits")) - cpy_start ;
+ string number_plan_str( orggt_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ /*cout << "Nature of address = " << number_plan_str << "\n";*/
+#endif
+ number_plan = atoi(number_plan_str.c_str());
+ }
+
+ /* get digits from param string */
+ if (orggt_parm_str.find("digits=") != orggt_parm_str.npos)
+ {
+ cpy_start = (orggt_parm_str.find("digits=")+7);
+ cpy_len = (orggt_parm_str.find(";")) - cpy_start ;
+ string digit_str( orggt_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "Number of digits = " << digit_str.length() << ", Digits = " << digit_str << "\n";
+#endif
+ /* fill in the local_sua instance Global Title */
+ local_sua.instance[host_id].Name.GT.nr_of_digits = digit_str.length() ;
+ digit_str.copy(local_sua.instance[host_id].Name.GT.digits, digit_str.length());
+
+ }
+ else
+ return;
+
+ local_sua.instance[host_id].Name.GT.Translation_Type = translation_type;
+ local_sua.instance[host_id].Name.GT.Numbering_Plan = number_plan;
+ local_sua.instance[host_id].Name.GT.Nature_of_Address = nature_of_addr;
+
+ return;
+
+}
+
+/***********************************************************************/
+/* create destination pointcode parameter handling */
+/***********************************************************************/
+void sua_cr_destpc( string destpc_parm_str,
+ db_Sua_RemoteList& remote_sua
+ )
+{
+ int dest_id, pc;
+ short cpy_start, cpy_len;
+
+ /* get pc id from param string, use as index remote_sua table */
+ if (destpc_parm_str.find("dest_id=") != destpc_parm_str.npos)
+ {
+ cpy_start = (destpc_parm_str.find("dest_id=")+8);
+ cpy_len = (destpc_parm_str.find(",pc")) - cpy_start ;
+ string dest_id_str( destpc_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "Destination id = " << dest_id_str << "\n";
+#endif
+ dest_id = atoi(dest_id_str.c_str());
+ }
+ else
+ return;
+
+ /* get destination pointcode from param string */
+ if (destpc_parm_str.find("pc=") != destpc_parm_str.npos)
+ {
+ cpy_start = (destpc_parm_str.find("pc=")+3);
+ cpy_len = (destpc_parm_str.find(";")) - cpy_start ;
+ string pc_str( destpc_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "Pointcode = " << pc_str << "\n";
+#endif
+ pc = atoi(pc_str.c_str());
+ }
+ else
+ return;
+
+ /* fill in the remote_sua instance pointcode */
+ remote_sua.instance[dest_id].Dest.pc.ITU24.family = ITU14bit;
+ remote_sua.instance[dest_id].Dest.pc.ITU24.pc = pc;
+
+ if (dest_id > remote_sua.num_of_instance)
+ remote_sua.num_of_instance++;
+
+ return;
+
+}
+
+
+/***********************************************************************/
+/* create destination IP address parameter handling */
+/***********************************************************************/
+void sua_cr_destip( string destip_parm_str,
+ db_Sua_RemoteList& remote_sua
+ )
+{
+ int dest_id;
+ short cpy_start, cpy_len;
+
+ /* get pc id from param string, use as index remote_sua table */
+ if (destip_parm_str.find("dest_id=") != destip_parm_str.npos)
+ {
+ cpy_start = (destip_parm_str.find("dest_id=")+8);
+ cpy_len = (destip_parm_str.find(",ip")) - cpy_start ;
+ string dest_id_str( destip_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "Destination id = " << dest_id_str << "\n";
+#endif
+ dest_id = atoi(dest_id_str.c_str());
+ }
+ else
+ return;
+
+ /* get destination IP address from param string */
+ if (destip_parm_str.find("ip=") != destip_parm_str.npos)
+ {
+ cpy_start = (destip_parm_str.find("ip=")+3);
+ cpy_len = (destip_parm_str.find(";")) - cpy_start ;
+ string ip_str( destip_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "IP address = " << ip_str << "\n";
+#endif
+
+ /* fill in the remote_sua instance ip address */
+ remote_sua.instance[dest_id].Dest.read_addr_param(ip_str);
+ }
+ else
+ return;
+
+ if (dest_id > remote_sua.num_of_instance)
+ remote_sua.num_of_instance++;
+
+ return;
+
+}
+
+/***********************************************************************/
+/* create hostname parameter handling */
+/***********************************************************************/
+void sua_cr_destname( string name_parm_str,
+ db_Sua_NameList& Sua_NameDB
+ )
+{
+ int dname_id;
+ unsigned int nature_of_addr, number_plan,translation_type;
+ short cpy_start, cpy_len;
+
+ /* get namegt id from param string, use as index in sua.NameDB table */
+ if (name_parm_str.find("dname_id=") != name_parm_str.npos)
+ {
+ cpy_start = (name_parm_str.find("dname_id=")+9);
+ cpy_len = (name_parm_str.find(",")) - cpy_start ;
+ string dname_id_str( name_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "Namegt id = " << dname_id_str << "\n";
+#endif
+ dname_id = atoi(dname_id_str.c_str());
+ }
+ else
+ return;
+
+ /* get hostname from param string */
+ if (name_parm_str.find("name=") != name_parm_str.npos)
+ {
+ cpy_start = (name_parm_str.find("name=")+5);
+ cpy_len = (name_parm_str.find(";")) - cpy_start ;
+ string name_str( name_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "Hostname = " << name_str << "\n";
+#endif
+ Sua_NameDB.read_host_name( dname_id,
+ name_str
+ );
+ Sua_NameDB.increase_instance();
+
+ }
+ else
+ {
+ /* default translation type number = 0 */
+ translation_type = 0;
+ /* default nature of address = 0 */
+ nature_of_addr = 0;
+ /* default number plan(E164) = 0 */
+ number_plan = 0;
+
+ if (name_parm_str.find("tt=") != name_parm_str.npos)
+ {
+ cpy_start = (name_parm_str.find("tt=")+3);
+ cpy_len = (name_parm_str.find(",na")) - cpy_start ;
+ string ttn_str( name_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "tt = " << ttn_str << "\n";
+#endif
+ translation_type = atoi(ttn_str.c_str());
+ }
+
+ /* get nature of address from param string */
+ if (name_parm_str.find("na=") != name_parm_str.npos)
+ {
+ cpy_start = (name_parm_str.find("na=")+3);
+ cpy_len = (name_parm_str.find(",np")) - cpy_start ;
+ string nature_addr_str( name_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "Nature of address = " << nature_addr_str << "\n";
+#endif
+ nature_of_addr = atoi(nature_addr_str.c_str());
+ }
+
+ /* get numbering plan from param string */
+ if (name_parm_str.find("np=") != name_parm_str.npos)
+ {
+ cpy_start = (name_parm_str.find("np=")+3);
+ cpy_len = (name_parm_str.find(",digits")) - cpy_start ;
+ string number_plan_str( name_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ /*cout << "Nature of address = " << number_plan_str << "\n";*/
+#endif
+ number_plan = atoi(number_plan_str.c_str());
+ }
+
+ /* get digits from param string */
+ if (name_parm_str.find("digits=") != name_parm_str.npos)
+ {
+ cpy_start = (name_parm_str.find("digits=")+7);
+ cpy_len = (name_parm_str.find(";")) - cpy_start ;
+ string digit_str( name_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "Number of digits = " << digit_str.length() << ", Digits = " << digit_str << "\n";
+#endif
+ Sua_NameDB.read_Global_Title( dname_id,
+ translation_type,
+ nature_of_addr,
+ number_plan,
+ digit_str
+ );
+ Sua_NameDB.increase_instance();
+ }
+ else
+ cout << "Unknown cr name cmd parameters\n";
+
+ }
+
+ return;
+
+}
+
+/***********************************************************************/
+/* create route pointcode parameter handling */
+/***********************************************************************/
+void sua_cr_route_PC( string route_parm_str,
+ db_Sua_RemoteList& remote_sua,
+ db_Sua_AssociationList& assoc_sua
+ )
+{
+ int dest_id, sua_assoc_id;
+ short cpy_start, cpy_len;
+
+ /* get pc id from param string, use as index remote sua table */
+ if (route_parm_str.find("dest_id=") != route_parm_str.npos)
+ {
+ cpy_start = (route_parm_str.find("dest_id=")+8);
+ cpy_len = (route_parm_str.find(",assoc_id")) - cpy_start ;
+ string dest_id_str( route_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "destination id = " << dest_id_str << "\n";
+#endif
+ dest_id = atoi(dest_id_str.c_str());
+ }
+ else
+ return;
+
+ /* get destination assoc id from param string */
+ if (route_parm_str.find("assoc_id=") != route_parm_str.npos)
+ {
+ cpy_start = (route_parm_str.find("assoc_id=")+9);
+ cpy_len = (route_parm_str.find(";")) - cpy_start ;
+ string assoc_id_str( route_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "Association Id = " << assoc_id_str << "\n";
+#endif
+ sua_assoc_id = atoi(assoc_id_str.c_str());
+ }
+ else
+ return;
+
+ if (dest_id > 0){
+ remote_sua.instance[dest_id].SUA_assoc_id = sua_assoc_id;
+ }
+
+
+ return;
+
+}
+
+/***********************************************************************/
+/* create route global title parameter handling */
+/***********************************************************************/
+void sua_cr_route_name( string route_parm_str,
+ db_Sua_NameList& Sua_NameDB,
+ db_Sua_AssociationList& Sua_AssocDB
+ )
+{
+ int dname_id, sua_assoc_id;
+ short cpy_start, cpy_len;
+
+ /* get namegt id from param string, use as index name-gt table */
+ if (route_parm_str.find("dname_id=") != route_parm_str.npos)
+ {
+ cpy_start = (route_parm_str.find("dname_id=")+9);
+ cpy_len = (route_parm_str.find(",")) - cpy_start ;
+ string dname_id_str( route_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "routename id = " << dname_id_str << "\n";
+#endif
+ dname_id = atoi(dname_id_str.c_str());
+ }
+ else
+ return;
+
+ /* get destination assoc id from param string */
+ if (route_parm_str.find("assoc_id=") != route_parm_str.npos)
+ {
+ cpy_start = (route_parm_str.find("assoc_id=")+9);
+ cpy_len = (route_parm_str.find(";")) - cpy_start ;
+ string assoc_id_str( route_parm_str, cpy_start, cpy_len);
+#ifdef DEBUG
+ cout << "Association Id = " << assoc_id_str << "\n";
+#endif
+ sua_assoc_id = atoi(assoc_id_str.c_str());
+ }
+ else
+ return;
+
+
+ if (dname_id > 0)
+ Sua_NameDB.instance[dname_id].SUA_assoc_id = sua_assoc_id;
+
+ return;
}
/***********************************************************************/
/* read sua configuration file */
/***********************************************************************/
-int read_sua_conf_file( string filename,
- db_Sua_DatabaseList sua
+int read_sua_conf_file( string filename,
+ db_Sua_DatabaseList& sua
)
{
string sua_filename;
@@ -507,10 +778,11 @@ int read_sua_conf_file( string filename,
cout << "cr host:host_id = j, org_ip= t.t.t.t, org_port= yyyyy \n";
cout << "cr assoc:assoc_id= i, init= false, host_id = j, dest_ip = x.x.x.x, dest_port= yyyy \n";
cout << "cr orgpc: pc = wwww, host_id = j\n";
- cout << "cr destpc: pc = wwww, rc = x \n";
- cout << "cr hostname: namegt_id= k name= www.sctp.be \n";
- cout << "cr gt:namegt_id = k,tt= tt, na= nn, np= ppp, digits= 123456789abcdef \n";
- cout << "cr route: dpc= www, assoc_id = i AND/OR\n";
+ cout << "cr orggt: host_id=j,tt=tt,na=nn,np=ppp,digits= 123456789abcdef \n";
+ cout << "cr destpc: pc_id = i,pc = wwww, rc = x \n";
+ cout << "cr name: namegt_id=k,host= www.sctp.be \n";
+ cout << "cr name: namegt_id=k,tt=tt,na=nn,np=ppp,digits= 123456789abcdef \n";
+ cout << "cr route: pc_id = j, assoc_id = i AND/OR\n";
cout << "cr route: dest_ip = x.x.x.x, assoc_id = i AND/OR\n";
cout << "cr route: namegt_id= k, assoc_id = i \n";
@@ -520,11 +792,7 @@ int read_sua_conf_file( string filename,
{
string cmdline(readBuffer,strlen(readBuffer));
- if (cmdline.length() == 0)
- {
- cout << "empty line?\n";
- }
- else if (cmdline.find("/") != cmdline.npos)
+ if (cmdline.find("/") != cmdline.npos)
{
/* comment line: do not execute */
}
@@ -543,24 +811,72 @@ int read_sua_conf_file( string filename,
sua.local_sua
);
}
+ else if (cmdline.find("cr orgpc:") != cmdline.npos)
+ {
+ string parm_str( cmdline, (cmdline.find("cr orgpc:")+9),cmdline.length());
+ sua_cr_orgpc( parm_str,
+ sua.local_sua
+ );
+ }
+ else if (cmdline.find("cr orggt:") != cmdline.npos)
+ {
+ string parm_str( cmdline, (cmdline.find("cr orggt:")+9),cmdline.length());
+ sua_cr_orgGT( parm_str,
+ sua.local_sua
+ );
+ }
else if (cmdline.find("cr destpc:") != cmdline.npos)
{
-
+ string parm_str( cmdline, (cmdline.find("cr destpc:")+10),cmdline.length());
+ sua_cr_destpc( parm_str,
+ sua.remote_sua
+ );
+ }
+ else if (cmdline.find("cr destip:") != cmdline.npos)
+ {
+ string parm_str( cmdline, (cmdline.find("cr destip:")+10),cmdline.length());
+ sua_cr_destip( parm_str,
+ sua.remote_sua
+ );
+ }
+ else if (cmdline.find("cr destname:") != cmdline.npos)
+ {
+ string parm_str( cmdline, (cmdline.find("cr destname:")+12),cmdline.length());
+ sua_cr_destname( parm_str,
+ sua.NameDB
+ );
+ parm_str.erase();
}
- else if (cmdline.find("cr hostname:") != cmdline.npos)
+ else if (cmdline.find("cr route:dest_id") != cmdline.npos)
{
-
+ string parm_str( cmdline, (cmdline.find("cr route:")+9),cmdline.length());
+ sua_cr_route_PC( parm_str,
+ sua.remote_sua,
+ sua.AssocDB
+ );
}
- else if (cmdline.find("cr gt:") != cmdline.npos)
+ else if (cmdline.find("cr route:dname_id") != cmdline.npos)
{
-
+ string parm_str( cmdline, (cmdline.find("cr route:")+9),cmdline.length());
+ sua_cr_route_name( parm_str,
+ sua.NameDB,
+ sua.AssocDB
+ );
}
else if (cmdline.find("cr xxxx:") != cmdline.npos)
{
-
+ ;
}
+ else if (cmdline.length() == 0)
+
+ ;
+
else
+
cout << "ERROR: Unknown " << cmdline << "command\n";
+
+ cout << cmdline << "\n";
+
}
} /* end of read_sua_conf_file */
diff --git a/sualibrary/sua/sua_file.h b/sualibrary/sua/sua_file.h
index eb77381..3c4e25d 100644
--- a/sualibrary/sua/sua_file.h
+++ b/sualibrary/sua/sua_file.h
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_file.h,v 1.2 2002/11/12 11:02:49 p82609 Exp $
+ * $Id: sua_file.h,v 1.1 2003/01/14 14:15:37 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@@ -70,8 +70,8 @@ int read_sua_file(string filename,
);
-int read_sua_conf_file( string filename,
- db_Sua_DatabaseList sua
+int read_sua_conf_file( string filename,
+ db_Sua_DatabaseList &sua
);
#endif // SUA_FILE_H
diff --git a/sualibrary/sua/sua_logging.cpp b/sualibrary/sua/sua_logging.cpp
index 7a1ce96..a3a2a84 100644
--- a/sualibrary/sua/sua_logging.cpp
+++ b/sualibrary/sua/sua_logging.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_logging.cpp,v 1.1.1.1 2002/02/04 14:30:41 p82609 Exp $
+ * $Id: sua_logging.cpp,v 1.1 2003/01/14 14:15:37 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
diff --git a/sualibrary/sua/sua_logging.h b/sualibrary/sua/sua_logging.h
index 850be1e..7f396df 100644
--- a/sualibrary/sua/sua_logging.h
+++ b/sualibrary/sua/sua_logging.h
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_logging.h,v 1.1.1.1 2002/02/04 14:30:41 p82609 Exp $
+ * $Id: sua_logging.h,v 1.1 2003/01/14 14:15:37 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
diff --git a/sualibrary/sua/sua_snm_mgnt.cpp b/sualibrary/sua/sua_snm_mgnt.cpp
index fadd04d..f4c20b0 100644
--- a/sualibrary/sua/sua_snm_mgnt.cpp
+++ b/sualibrary/sua/sua_snm_mgnt.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_snm_mgnt.cpp,v 1.1 2002/11/12 11:04:12 p82609 Exp $
+ * $Id: sua_snm_mgnt.cpp,v 1.1 2003/01/14 14:15:37 p82609 Exp $
*
* SUA implementation according to SUA draft issue 14.
*
diff --git a/sualibrary/sua/sua_snm_mgnt.h b/sualibrary/sua/sua_snm_mgnt.h
index 8634035..d3f67e6 100644
--- a/sualibrary/sua/sua_snm_mgnt.h
+++ b/sualibrary/sua/sua_snm_mgnt.h
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_snm_mgnt.h,v 1.1 2002/11/12 11:04:12 p82609 Exp $
+ * $Id: sua_snm_mgnt.h,v 1.1 2003/01/14 14:15:37 p82609 Exp $
*
* SUA implementation according to SUA draft issue 14.
*
diff --git a/sualibrary/sua/sua_sual.cpp b/sualibrary/sua/sua_sual.cpp
index b26c5a3..7381859 100644
--- a/sualibrary/sua/sua_sual.cpp
+++ b/sualibrary/sua/sua_sual.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_sual.cpp,v 1.2 2002/04/11 14:13:34 p82609 Exp $
+ * $Id: sua_sual.cpp,v 1.1 2003/01/14 14:15:37 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@@ -422,8 +422,7 @@ extern sual_InstId_t sual_RegisterSUAL_instance ( sual_port_t local_ssn,
ULP_CallbackFunctions.ulp_DisConnIndNotif = &SUAL_DisConnIndNotif;
// register all the local SUA together with their SCTP instances
- res = sua_registerInstance( local_ssn,
- ULP_CallbackFunctions
+ res = sua_registerInstance( ULP_CallbackFunctions
);
return(0);
diff --git a/sualibrary/sua/sua_sual.h b/sualibrary/sua/sua_sual.h
index dd92084..5bfca2b 100644
--- a/sualibrary/sua/sua_sual.h
+++ b/sualibrary/sua/sua_sual.h
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_sual.h,v 1.1.1.1 2002/02/04 14:30:41 p82609 Exp $
+ * $Id: sua_sual.h,v 1.1 2003/01/14 14:15:37 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
diff --git a/sualibrary/sua/sua_syntax.cpp b/sualibrary/sua/sua_syntax.cpp
index 2b5b755..feb331a 100644
--- a/sualibrary/sua/sua_syntax.cpp
+++ b/sualibrary/sua/sua_syntax.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_syntax.cpp,v 1.2 2002/11/12 11:02:49 p82609 Exp $
+ * $Id: sua_syntax.cpp,v 1.5 2003/02/17 14:38:08 p82609 Exp $
*
* SUA implementation according to SUA draft issue 8.
*
@@ -467,7 +467,8 @@ boolean encode_addr (string& msg, Sua_address_struct& address) {
/* Routing indicator : in this version only route on IP, hostname and SSN is allowed */
if ((address.rout_ind != ri_route_IP_SSN) &&
(address.rout_ind != ri_route_PC_SSN) &&
- (address.rout_ind != ri_route_hostname)) {
+ (address.rout_ind != ri_route_hostname) &&
+ (address.rout_ind != ri_route_GT)) {
/* Signal error : invalid routing indicator used */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Encoding : Invalid routing indicator";
@@ -586,7 +587,8 @@ boolean encode_addr (string& msg, Sua_address_struct& address) {
} // Endif
else if (address.hostname_pres){
- msg.resize(pdu_index + address.hostname.length() + 2 + 4);
+ short padding = (4 - ((pdu_index + address.hostname.length() + 6 ) % 4)) % 4;
+ msg.resize(pdu_index + address.hostname.length() + 2 + 4 + padding);
OVERLAY.dw[0] = htons(0x8005);
msg[pdu_index] = OVERLAY.db[0];
pdu_index++;
@@ -637,8 +639,75 @@ boolean encode_addr (string& msg, Sua_address_struct& address) {
int mod_nr = 0;
if ((mod_nr = pdu_index % 4) != 0)
{
+ OVERLAY.dw[0] = htons(0x0000);;
+ for (i=0; i < (4 - mod_nr); i++) {
+ msg[pdu_index] = OVERLAY.db[0];
+ pdu_index++;
+ }
+ }
+ }
+ // Endif
+ else if (address.gt_pres){
+ short gt_length = ((address.gt.nr_of_digits/2) + (address.gt.nr_of_digits % 2) + 4 + 4 + 4);
+ short padding = (4 - ((pdu_index + gt_length) % 4)) % 4;
+ msg.resize(pdu_index + gt_length + padding);
+ OVERLAY.dw[0] = htons(0x8001);
+ msg[pdu_index] = OVERLAY.db[0];
+ pdu_index++;
+ msg[pdu_index] = OVERLAY.db[1];
+ pdu_index++;
+ OVERLAY.dw[1] = htons(gt_length);
+ msg[pdu_index] = OVERLAY.db[2];
+ pdu_index++;
+ msg[pdu_index] = OVERLAY.db[3];
+ pdu_index++;
+ /* GTI */
+ OVERLAY.dw[0] = htons(0x0000);
+ msg[pdu_index] = OVERLAY.db[0];
+ pdu_index++;
+ msg[pdu_index] = OVERLAY.db[1];
+ pdu_index++;
+ OVERLAY.dw[1] = htons(0x0004);
+ msg[pdu_index] = OVERLAY.db[2];
+ pdu_index++;
+ msg[pdu_index] = OVERLAY.db[3];
+ pdu_index++;
+ /* nr of digits , TT, NP and NA */
+ OVERLAY.dw[0] = address.gt.nr_of_digits;
+ msg[pdu_index] = OVERLAY.db[0];
+ pdu_index++;
+ OVERLAY.dw[0] = address.gt.translation_type;
+ msg[pdu_index] = OVERLAY.db[0];
+ pdu_index++;
+ OVERLAY.dw[0] = address.gt.num_plan;
+ msg[pdu_index] = OVERLAY.db[0];
+ pdu_index++;
+ OVERLAY.dw[0] = address.gt.nat_addr;
+ msg[pdu_index] = OVERLAY.db[0];
+ pdu_index++;
+ /* put digits in msg */
+ int i;
+ int last= (address.gt.nr_of_digits/2) + (address.gt.nr_of_digits%2);
+ for (i= 0; i < last; i++)
+ {
+ /* put in digit N + 1 and digit N */
+ if (((2*i)+1) >= address.gt.nr_of_digits)
+ OVERLAY.dw[0] = htons(0x0000);
+ else
+ OVERLAY.dw[0] = 16 * (address.gt.digits[(2*i)+1] % 16);
+ OVERLAY.dw[0] = OVERLAY.dw[0] + (address.gt.digits[(2*i)] % 16);
+ msg[pdu_index] = OVERLAY.db[0];
+ pdu_index++;
+ }
+
+ /* end of Global Title */
+
+ /* padding out up a 32 bit boundary */
+ int mod_nr = 0;
+ if ((mod_nr = pdu_index % 4) != 0)
+ {
+ OVERLAY.dw[0] = htons(0x0000);
for (i=0; i < (4 - mod_nr); i++) {
- OVERLAY.dw[0] = htons(0x0000);;
msg[pdu_index] = OVERLAY.db[0];
pdu_index++;
}
@@ -2220,7 +2289,7 @@ boolean decode_hop_count (Sua_primitive_struct& prim, string& msg, unsigned int&
boolean decode_addr (Sua_address_struct& addr, string& msg, unsigned int& pdu_index) {
unsigned int next_tag_pdu_idx = 0;
- int j = 0;
+ int j = 0, last = 0;
unsigned int numchar = 0;
bool look_for_next_label = FALSE;
/* Get the parameter length */
@@ -2238,7 +2307,8 @@ boolean decode_addr (Sua_address_struct& addr, string& msg, unsigned int& pdu_in
/* Check validity of routing indicator, only route on IP and SSN is supported */
if ((pdu_word != uint16_t(ri_route_IP_SSN)) &&
(pdu_word != uint16_t(ri_route_PC_SSN)) &&
- (pdu_word != uint16_t(ri_route_hostname))){
+ (pdu_word != uint16_t(ri_route_hostname)) &&
+ (pdu_word != uint16_t(ri_route_GT))){
/* Signal error : routing indicator not supported */
SYNTAX_ERR.msg_index = pdu_index;
SYNTAX_ERR.error_text = "Decoding : Routing Indicator not supported";
@@ -2274,13 +2344,51 @@ boolean decode_addr (Sua_address_struct& addr, string& msg, unsigned int& pdu_in
addr_par_tag = ntohs(OVERLAY.dw[0]);
switch (addr_par_tag) {
case 0x8001 :
- /* Global Title not supported, so we jump over it */
+ /* Global Title */
addr_par_len += (4 - (addr_par_len % 4)) % 4; // don't forget padding bytes
- pdu_index += addr_par_len; // next tag
+ addr.gt_pres = TRUE;
+ next_tag_pdu_idx = pdu_index + addr_par_len; // next tag
+ pdu_index += 4;
+
+ /* get GTI format */
+ OVERLAY.dq = 0;
+ OVERLAY.db[3] = msg[pdu_index + 3];
+ pdu_index += 4;
+
+ /* get nr-of-digits, translation type, */
+ /* numbering plan and nature-of-address */
+ OVERLAY.dq = 0;
+ OVERLAY.db[0] = msg[pdu_index + 0];
+ OVERLAY.db[1] = msg[pdu_index + 1];
+ OVERLAY.db[2] = msg[pdu_index + 2];
+ OVERLAY.db[3] = msg[pdu_index + 3];
+ addr.gt.nr_of_digits = OVERLAY.db[0];
+ addr.gt.translation_type = OVERLAY.db[1];
+ addr.gt.num_plan = OVERLAY.db[2];
+ addr.gt.nat_addr = OVERLAY.db[3];
+ pdu_index += 4;
+
+ /* put digits in msg */
+ OVERLAY.dq = 0;
+ last = (addr.gt.nr_of_digits/2) + (addr.gt.nr_of_digits%2);
+ for (int i= 0; i < last; i++)
+ {
+ OVERLAY.db[0] = msg[pdu_index];
+ /* get digit N + 1 and digit N out from msg */
+ addr.gt.digits[(2*i)+1] = (uint8_t) OVERLAY.db[0] / 16;
+ addr.gt.digits[(2*i)] = (uint8_t) OVERLAY.db[0] % 16;
+ pdu_index++;
+ }
+ /* end of Global Title */
+
+ /* set pdu_index onto next following tag of sua msg */
+ pdu_index = next_tag_pdu_idx;
+
if (par_len >= addr_par_len)
par_len -= addr_par_len; // adjust remaining parameter length
else
par_len = 0;
+
break;
case 0x8002 :
/* SS7 Point code , length 8 bytes */
@@ -3772,6 +3880,16 @@ boolean decode_co_conn_req_msg (Sua_primitive_struct& prim, string& msg) {
return FALSE;
}
break;
+ case 0x0116 :
+ if (!prim.seq_control_pres)
+ no_error = decode_seq_ctrl (prim, msg, pdu_index);
+ else {
+ /* Signal error : duplicate parameter */
+ SYNTAX_ERR.msg_index = pdu_index;
+ SYNTAX_ERR.error_text = "Decoding : Duplicate Sequence ccontrol parameter";
+ return FALSE;
+ }
+ break;
default : {
/* Jump over this totally uninteresting parameter to next double word position */
par_len += (4 - (par_len % 4)) % 4;
@@ -3905,6 +4023,16 @@ boolean decode_co_conn_ack_msg (Sua_primitive_struct& prim, string& msg) {
return FALSE;
}
break;
+ case 0x0116 :
+ if (!prim.seq_control_pres)
+ no_error = decode_seq_ctrl (prim, msg, pdu_index);
+ else {
+ /* Signal error : duplicate parameter */
+ SYNTAX_ERR.msg_index = pdu_index;
+ SYNTAX_ERR.error_text = "Decoding : Duplicate Sequence ccontrol parameter";
+ return FALSE;
+ }
+ break;
default : {
/* Jump over this totally uninteresting parameter to next double word position */
par_len += (4 - (par_len % 4)) % 4;
diff --git a/sualibrary/sua/sua_syntax.h b/sualibrary/sua/sua_syntax.h
index 0295a8f..f1890fb 100644
--- a/sualibrary/sua/sua_syntax.h
+++ b/sualibrary/sua/sua_syntax.h
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_syntax.h,v 1.1.1.1 2002/02/04 14:30:41 p82609 Exp $
+ * $Id: sua_syntax.h,v 1.1 2003/01/14 14:15:37 p82609 Exp $
*
* SUA implementation according to SUA draft issue 5.
*
diff --git a/sualibrary/sua/sua_tcb.cpp b/sualibrary/sua/sua_tcb.cpp
index b4bb7b8..27a06c8 100644
--- a/sualibrary/sua/sua_tcb.cpp
+++ b/sualibrary/sua/sua_tcb.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_tcb.cpp,v 1.2 2002/10/24 16:12:06 p82609 Exp $
+ * $Id: sua_tcb.cpp,v 1.1 2003/01/14 14:15:37 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
diff --git a/sualibrary/sua/sua_tcb.h b/sualibrary/sua/sua_tcb.h
index ef9f0ce..34c00c7 100644
--- a/sualibrary/sua/sua_tcb.h
+++ b/sualibrary/sua/sua_tcb.h
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_tcb.h,v 1.2 2002/10/24 16:12:06 p82609 Exp $
+ * $Id: sua_tcb.h,v 1.1 2003/01/14 14:15:37 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
diff --git a/sualibrary/testup/Makefile.am b/sualibrary/testup/Makefile.am
index 27b0159..43d3b1c 100644
--- a/sualibrary/testup/Makefile.am
+++ b/sualibrary/testup/Makefile.am
@@ -1,4 +1,7 @@
####### 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
diff --git a/sualibrary/testup/main.cpp b/sualibrary/testup/main.cpp
index fbcd983..35ffd9f 100644
--- a/sualibrary/testup/main.cpp
+++ b/sualibrary/testup/main.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: main.cpp,v 1.2 2002/10/15 14:37:59 p82609 Exp $
+ * $Id: main.cpp,v 1.1 2003/01/14 13:47:56 p82609 Exp $
*
* SUA Test user part implementation.
*
@@ -174,7 +174,7 @@ int sua_get_arguments(int argc, char **argv)
num_of_arg++;
sua_filename = argv[num_of_arg];
result = sua_read_config_file( argv[num_of_arg]);
-
+
break;
}
case 'i':
@@ -292,8 +292,7 @@ int main(int argc, char **argv )
// register sua and its users
// register all the local SUA together with their SCTP instances
- res = sua_registerInstance( 255,
- SUACallbackFunctions
+ res = sua_registerInstance( SUACallbackFunctions
);
// initiate all the SUA associations with their respective peers
res = sua_associate();
diff --git a/sualibrary/testup/testuser.cpp b/sualibrary/testup/testuser.cpp
index 0d7facf..7e3a45e 100644
--- a/sualibrary/testup/testuser.cpp
+++ b/sualibrary/testup/testuser.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: testuser.cpp,v 1.7 2002/11/14 15:29:24 p82609 Exp $
+ * $Id: testuser.cpp,v 1.3 2003/05/27 14:12:34 p82609 Exp $
*
* SUA Test user part implementation.
*
@@ -171,6 +171,7 @@ void init_testip_stdin()
calling_pty_addr.address_fields_present.field_in_header = include_nothing;
calling_pty_addr.pc.ipvx = pathinfo.local_addr.pc.ipvx;
calling_pty_addr.pc.ss7 = pathinfo.local_addr.pc.ss7;
+ /*calling_pty_addr.name.GT = pathinfo.local_addr.name.GT;*/
calling_pty_addr.ssn = pathinfo.local_addr.ssn;
calling_pty_addr.routing_ind = route_on_ssn;
calling_pty_addr.network_apperance = network_app;
@@ -224,6 +225,7 @@ void testip_stdin_cb( int fd,
cout << " destaddr4: - set destination ipv4 address \n";
cout << " destname: - set destination hostname\n";
cout << " destpc: - set destination SS7 pointcode(decimal)\n";
+ 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";
@@ -392,8 +394,6 @@ void testip_stdin_cb( int fd,
cout << "Address of remote end stored. Msg will be sent to this one\n";
string addr2_str = own_hostname;
- /*char *name2_char = new char [addr2_str.length()+1]; */
- /*name2_char = shost_to_suaname ( addr2_str ); */
calling_pty_addr.address_fields_present.name_gt = hostname_present;
strcpy(calling_pty_addr.name.HostName, own_hostname);
@@ -402,6 +402,33 @@ void testip_stdin_cb( int fd,
cout << "DNS/SUA source hostname = " << addr2_str << "\n";
}
+ else if (cmdline.find("destGT:") != cmdline.npos)
+ {
+ /* get destination Global Title, convert it and store in cld */
+ string addr_str(cmdline, (cmdline.find("destGT:")+7),cmdline.length());
+
+ called_pty_addr.address_fields_present.pc = no_pc_present;
+ 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;
+ 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;
+ called_pty_addr.routing_ind = route_on_name_gt;
+
+ cout << "DNS/SUA dest Global Title = " << addr_str << "\n";
+ cout << "Address of remote end stored. Msg will be sent to this one\n";
+
+ calling_pty_addr.address_fields_present.name_gt = GT_present;
+
+ calling_pty_addr.ssn = 5;
+ calling_pty_addr.routing_ind = route_on_name_gt;
+ cout << "DNS/SUA source Global Title = " << calling_pty_addr.name.GT.digits << "\n";
+
+ }
else if (cmdline.find("destpc:") != cmdline.npos)
{
/* get destination address, convert it and store in cld */
@@ -445,10 +472,15 @@ void testip_stdin_cb( int fd,
calling_pty_addr.address_fields_present.ssn_port = called_pty_addr.address_fields_present.ssn_port;
calling_pty_addr.address_fields_present.field_in_header = called_pty_addr.address_fields_present.field_in_header ;
- string addr3_str = own_hostname;
- /*char *name3_char = new char [addr3_str.length()+1];*/
- /*name3_char = shost_to_suaname ( addr3_str );*/
- strcpy(calling_pty_addr.name.HostName, own_hostname);
+ if (calling_pty_addr.address_fields_present.name_gt == hostname_present)
+ {
+ string addr4_str = own_hostname;
+ strcpy(calling_pty_addr.name.HostName, own_hostname);
+ }
+ else if (calling_pty_addr.address_fields_present.name_gt == GT_present)
+ {
+ calling_pty_addr.name.GT = pathinfo.local_addr.name.GT;
+ }
calling_pty_addr.pc.ipvx = pathinfo.local_addr.pc.ipvx;
@@ -498,13 +530,20 @@ void testip_stdin_cb( int fd,
calling_pty_addr.routing_ind = called_pty_addr.routing_ind;
calling_pty_addr.address_fields_present.ssn_port = called_pty_addr.address_fields_present.ssn_port;
calling_pty_addr.address_fields_present.field_in_header = called_pty_addr.address_fields_present.field_in_header;
-
- string addr4_str = own_hostname;
- strcpy(calling_pty_addr.name.HostName, own_hostname);
+ if (calling_pty_addr.address_fields_present.name_gt == hostname_present)
+ {
+ string addr4_str = own_hostname;
+ strcpy(calling_pty_addr.name.HostName, own_hostname);
+ }
+ else if (calling_pty_addr.address_fields_present.name_gt == GT_present)
+ {
+ calling_pty_addr.name.GT = pathinfo.local_addr.name.GT;
+ }
calling_pty_addr.pc.ipvx = pathinfo.local_addr.pc.ipvx;
calling_pty_addr.ssn = pathinfo.local_addr.ssn;
calling_pty_addr.pc.ss7 = pathinfo.local_addr.pc.ss7 ;
+
char *databuffer = new char[cmdline.length()];
cmdline.copy(databuffer, cmdline.length());
diff --git a/sualibrary/testup/testuser.h b/sualibrary/testup/testuser.h
index 105b018..4c04cd0 100644
--- a/sualibrary/testup/testuser.h
+++ b/sualibrary/testup/testuser.h
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: testuser.h,v 1.2 2002/10/22 13:45:11 p82609 Exp $
+ * $Id: testuser.h,v 1.1 2003/01/14 13:47:56 p82609 Exp $
*
* SUA Test user part implementation.
*