aboutsummaryrefslogtreecommitdiffstats
path: root/sualibrary/sua/sua_adapt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sualibrary/sua/sua_adapt.cpp')
-rw-r--r--sualibrary/sua/sua_adapt.cpp129
1 files changed, 90 insertions, 39 deletions
diff --git a/sualibrary/sua/sua_adapt.cpp b/sualibrary/sua/sua_adapt.cpp
index 5dcb396..26f35a3 100644
--- a/sualibrary/sua/sua_adapt.cpp
+++ b/sualibrary/sua/sua_adapt.cpp
@@ -15,9 +15,9 @@
* *
***************************************************************************/
/*
- * $Id: sua_adapt.cpp,v 1.2 2002/02/15 16:19:46 p82609 Exp $
+ * $Id: sua_adapt.cpp,v 1.5 2002/11/12 11:02:49 p82609 Exp $
*
- * SUA implementation according to SUA draft issue 6.
+ * SUA implementation according to SUA draft issue 13.
*
* Author(s): Lode Coene
*
@@ -87,25 +87,31 @@
#include <arpa/inet.h>
using namespace std;
-/* definition of SUA local object and of remote object */
-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;
+
+/* definition of SUA database objects */
+db_Sua_DatabaseList sua;
/***********************************************************************/
/* sua_initialisation */
/***********************************************************************/
void sua_initialisation()
{
- int res;
+ int res;
+ SCTP_LibraryParameters params;
+
cout << "Initialising SCTP & SUA\n ";
res = sctp_initLibrary();
+
+ /* set checksum to CRC32C */
+ sctp_getLibraryParameters(&params);
+ params.checksumAlgorithm = SCTP_CHECKSUM_ALGORITHM_CRC32C;
+ params.supportPRSCTP = 0;
+ sctp_setLibraryParameters(&params);
+
init_logging_file();
- local_sua.initialize();
- remote_sua.initialize();
- Assoc_sua.initialize();
+ sua.local_sua.initialize();
+ sua.remote_sua.initialize();
+ sua.AssocDB.initialize();
cout << "Finished initialising SUA data\n ";
} /* end of sua_initialisation */
@@ -119,12 +125,13 @@ unsigned int sua_read_config_file( char *pConfFile)
string sua_filename;
sua_filename = pConfFile;
result = read_sua_file( sua_filename,
- local_sua,
- remote_sua,
- Assoc_sua,
- NameDB_sua,
- ApplicServ_sua
+ sua.local_sua,
+ sua.remote_sua,
+ sua.AssocDB,
+ sua.NameDB,
+ sua.ApplicServ
);
+
return(result);
}
@@ -146,12 +153,12 @@ unsigned int sua_registerInstance ( short local_ssn,
SCTPCallbackFunctions.communicationErrorNotif = &sctp_CommunicationErrorNotif;
SCTPCallbackFunctions.restartNotif = &sctp_RestartNotif;
SCTPCallbackFunctions.shutdownCompleteNotif = &sctp_ShutDownCompleteNotif;
-
- result = Assoc_sua.register_instance ( SCTPCallbackFunctions,
- ulp_callback,
- local_sua
- );
-
+
+ result = sua.AssocDB.register_instance ( SCTPCallbackFunctions,
+ ulp_callback,
+ sua.local_sua
+ );
+
return(result);
}
@@ -162,9 +169,9 @@ unsigned int sua_registerInstance ( short local_ssn,
unsigned int sua_associate ( )
{
unsigned int result = SUA_ASS_NO_ERROR;
- result = Assoc_sua.associate_instance( local_sua,
- remote_sua
- );
+ result = sua.AssocDB.associate_instance( sua.local_sua,
+ sua.remote_sua
+ );
return(result);
}
@@ -178,31 +185,75 @@ unsigned int sua_getPath( unsigned int assoc_id,
)
{
unsigned int result = SUA_PATH_NO_ERROR;
-
- if ( Assoc_sua.instance[assoc_id].Dest.nr_of_addrs > 0)
+
+ if ( sua.AssocDB.instance[assoc_id].Dest.nr_of_addrs > 0)
{
/*pathinfo.remote_addr.*/
- pathinfo.remote_addr.pc.ipvx = Assoc_sua.instance[assoc_id].Dest.addrs[0];
- /*pathinfo.remote_addr.pc.ss7 = Assoc_sua.instance[assoc_id].Dest.pc;*/
- pathinfo.remote_addr.ssn = remote_sua.instance[Assoc_sua.instance[assoc_id].remote_sua_id].ssn.ssn;
-
- pathinfo.ASP_status = Assoc_sua.instance[assoc_id].asp.status;
-
+ pathinfo.remote_addr.pc.ipvx = sua.AssocDB.instance[assoc_id].Dest.addrs[0];
+
+ /*memcpy( pathinfo.remote_addr.pc.ipvx.ch, sua.AssocDB.instance[assoc_id].Dest.addrs[0].ch, 24);*/
+
+ pathinfo.remote_addr.pc.ss7 = sua.AssocDB.instance[assoc_id].Dest.pc;
+ 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 = " << Assoc_sua.instance[assoc_id].remote_sua_id << "\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 = Assoc_sua.instance[assoc_id].Source.addrs[0];
- pathinfo.local_addr.pc.ss7 = Assoc_sua.instance[assoc_id].Source.pc;
- pathinfo.local_addr.ssn = local_sua.instance[Assoc_sua.instance[assoc_id].local_sua_id].ssn.ssn;
+
+ pathinfo.local_addr.pc.ipvx.ch = sua.AssocDB.instance[assoc_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.ssn = sua.local_sua.instance[sua.AssocDB.instance[assoc_id].local_sua_id].ssn.ssn;
+
+ return (result);
+
+}
+
+/***********************************************************************/
+/* get destination pointcode address */
+/***********************************************************************/
+pointcode_str get_destpc_addr( unsigned int sua_id)
+{
+ pointcode_str pc;
+
+ pc.ipvx = sua.AssocDB.instance[sua_id].Dest.addrs[0];
+ pc.ss7 = sua.AssocDB.instance[sua_id].Dest.pc;
+ return(pc);
+}
+
+/***********************************************************************/
+/* get source pointcode address */
+/***********************************************************************/
+pointcode_str get_sourcepc_addr( unsigned int sua_id)
+{
+ pointcode_str pc;
+ pc.ipvx = sua.AssocDB.instance[sua_id].Source.addrs[0];
+ pc.ss7 = sua.AssocDB.instance[sua_id].Source.pc;
+ return(pc);
+}
+
+/***********************************************************************/
+/* sua_shutdown */
+/***********************************************************************/
+unsigned int sua_shutdown( )
+{
+ unsigned int result = SUA_TERM_NO_ERROR;
+
+ sua.AssocDB.shutdown();
return (result);
}
+
/***********************************************************************/
/* sua_terminate */
/***********************************************************************/
@@ -210,7 +261,7 @@ unsigned int sua_terminate( )
{
unsigned int result = SUA_TERM_NO_ERROR;
- Assoc_sua.shutdown();
+ sua.AssocDB.shutdown();
close_logging_file();
return (result);