aboutsummaryrefslogtreecommitdiffstats
path: root/sualibrary/sua/sua_distribution.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sualibrary/sua/sua_distribution.cpp')
-rw-r--r--sualibrary/sua/sua_distribution.cpp103
1 files changed, 64 insertions, 39 deletions
diff --git a/sualibrary/sua/sua_distribution.cpp b/sualibrary/sua/sua_distribution.cpp
index c588f49..d01b93a 100644
--- a/sualibrary/sua/sua_distribution.cpp
+++ b/sualibrary/sua/sua_distribution.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: sua_distribution.cpp,v 1.1.1.1 2002/02/04 14:30:41 p82609 Exp $
+ * $Id: sua_distribution.cpp,v 1.7 2002/11/12 11:02:49 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@@ -73,6 +73,8 @@
#include "sua_cl.h"
#include "sua_co.h"
#include "sua_distribution.h"
+#include "sua_asp_mgnt.h"
+#include "sua_snm_mgnt.h"
#include <cstdio>
@@ -92,21 +94,23 @@ Sua_container msg;
// storage for received SUA messages
vector<sua_save_str> rec_msg_pool;
-extern db_Sua_LocalList local_sua;
-extern db_Sua_RemoteList remote_sua;
-extern db_Sua_AssociationList Assoc_sua;
+extern db_Sua_DatabaseList sua;
+
extern tcb_Sua_TCB_arr tcb_pool;
extern tcb_Sua_msgqueue_pool msg_store;
+/* cvs shit */
/***********************************************************************/
/* sctp_DataArriveNotif */
/***********************************************************************/
-void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
- unsigned int stream_id,
- unsigned int len,
- unsigned int protocol_id,
- unsigned int unordered_flag,
- void * ulp_data_ptr
+void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
+ unsigned int stream_id,
+ unsigned int len,
+ unsigned short data_streamSN,
+ unsigned int data_tsn,
+ unsigned int protocol_id,
+ unsigned int unordered_flag,
+ void * ulp_data_ptr
)
{
@@ -114,6 +118,8 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
unsigned int Sua_ConnId;
unsigned int sua_assoc_id;
unsigned int local_sua_id,remote_sua_id;
+ unsigned short streamSN;
+ unsigned int tsn;
tcb_Sua_TCB_str *tcb_ptr;
Sua_syntax_error_struct error;
char databuf[BUFSIZE];
@@ -130,6 +136,8 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
stream_id,
(unsigned char *) databuf,
&len,
+ &streamSN,
+ &tsn,
flags
);
@@ -153,10 +161,10 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
char logstring[100];
sprintf(logstring, "Decoding error in received SUA message : index = %d,", error.msg_index);
event_log("sua_distribution.c",logstring);
- char *spare = new char[error.error_text.length()];
- error.error_text.copy(spare, error.error_text.length());
- sprintf(logstring, "Error string = %s,", spare);
- event_log("sua_distribution.c",logstring);
+ /*char *spare = new char[error.error_text.length()];*/
+ /*error.error_text.copy(spare, error.error_text.length());*/
+ /*sprintf(logstring, "Error string = %s,", spare);*/
+ /*event_log("sua_distribution.c",logstring);*/
cout << "Decoding error in received SUA message : "<< error.error_text << ", index = " << error.msg_index << "\n";
msg.sua_prim.hdr_msg_class = sua_max;
return;
@@ -176,11 +184,11 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
#ifdef DEBUG
cout << "CL: Unitdata message handling\n";
#endif
- unsigned int local_sua_id,remote_sua_id;
- sua_assoc_id = Assoc_sua.Find_association( sctp_assoc_id,
- local_sua_id,
- remote_sua_id
- );
+
+ sua_assoc_id = sua.AssocDB.Find_association( sctp_assoc_id,
+ local_sua_id,
+ remote_sua_id
+ );
result = process_unitdata_msg ( local_sua_id,
sua_assoc_id,
msg
@@ -197,6 +205,16 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
#ifdef DEBUG
cout << "CL: Unitdata Service message handling\n";
#endif
+
+ sua_assoc_id = sua.AssocDB.Find_association( sctp_assoc_id,
+ local_sua_id,
+ remote_sua_id
+ );
+ result = process_UDTService_msg ( local_sua_id,
+ sua_assoc_id,
+ msg
+ );
+
char logstring[100];
sprintf(logstring, "Received Unitdata Service msg");
event_log("sua_distribution.c",logstring);
@@ -232,7 +250,7 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
unsigned int local_sua_id,remote_sua_id;
- sua_assoc_id = Assoc_sua.Find_association( sctp_assoc_id,
+ sua_assoc_id = sua.AssocDB.Find_association( sctp_assoc_id,
local_sua_id,
remote_sua_id
);
@@ -386,7 +404,7 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
case (sua_mngt):
// SUA management msg
- sua_assoc_id = Assoc_sua.Find_association( sctp_assoc_id,
+ sua_assoc_id = sua.AssocDB.Find_association( sctp_assoc_id,
local_sua_id,
remote_sua_id
);
@@ -434,7 +452,7 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
case (sua_ssnm):
// Signalling Network Management(SNM) msg
- sua_assoc_id = Assoc_sua.Find_association( sctp_assoc_id,
+ sua_assoc_id = sua.AssocDB.Find_association( sctp_assoc_id,
local_sua_id,
remote_sua_id
);
@@ -471,7 +489,11 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
#ifdef DEBUG
cout << "SNM: Destination state audit message handling\n";
#endif
-
+ result = process_DAUD_msg ( sua_assoc_id,
+ local_sua_id,
+ remote_sua_id,
+ msg
+ );
char logstring[100];
sprintf(logstring, "Received DAUD msg");
event_log("sua_distribution.c",logstring);
@@ -529,7 +551,7 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
case (sua_aspsm):
// ASP State maintenance msg
- sua_assoc_id = Assoc_sua.Find_association( sctp_assoc_id,
+ sua_assoc_id = sua.AssocDB.Find_association( sctp_assoc_id,
local_sua_id,
remote_sua_id
);
@@ -653,7 +675,7 @@ void sctp_DataArriveNotif( unsigned int sctp_assoc_id,
case (sua_asptm):
// ASP Traffic maintenance msg
- sua_assoc_id = Assoc_sua.Find_association( sctp_assoc_id,
+ sua_assoc_id = sua.AssocDB.Find_association( sctp_assoc_id,
local_sua_id,
remote_sua_id
);
@@ -805,11 +827,11 @@ void sctp_CommunicationLostNotif( unsigned int sctp_assoc_id,
event_log("sua_distribution.c",logstring);
#ifdef SUA_MANAGEMENT
- if ((sua_assoc_id = Assoc_sua.Find_association(sctp_assoc_id, local_sua_id,remote_sua_id)) != 0)
+ if ((sua_assoc_id = sua.AssocDB.Find_association(sctp_assoc_id, local_sua_id,remote_sua_id)) != 0)
{
/* if we found the sua assoc then the SUA ASP is marked down, */
/* as the sctp association has failed */
- Assoc_sua.down(sua_assoc_id, 0);
+ sua.AssocDB.down(sua_assoc_id, 0);
#ifdef DEBUG
cout << "ASP down for SUA association " << sua_assoc_id << "\n";
#endif
@@ -823,10 +845,11 @@ void sctp_CommunicationLostNotif( unsigned int sctp_assoc_id,
/* sctp_CommunicationUpNotif */
/***********************************************************************/
void *sctp_CommunicationUpNotif( unsigned int sctp_assoc_id,
- unsigned short status_event,
- int nr_of_dest_addr,
+ int status_event,
+ unsigned int nr_of_dest_addr,
unsigned short nr_of_input_streams,
unsigned short nr_of_output_streams,
+ int support_PRsctp,
void * ulp_data_ptr
)
{
@@ -852,13 +875,13 @@ void *sctp_CommunicationUpNotif( unsigned int sctp_assoc_id,
- if ((sua_assoc_id = Assoc_sua.Find_association(sctp_assoc_id, local_sua_id,remote_sua_id)) == 0) {
+ if ((sua_assoc_id = sua.AssocDB.Find_association(sctp_assoc_id, local_sua_id,remote_sua_id)) == 0) {
#ifdef DEBUG
cout << "association " << sctp_assoc_id << " is not present\n";
#endif
- sua_assoc_id = Assoc_sua.passive_associate( sctp_assoc_id,
- local_sua,
- remote_sua,
+ sua_assoc_id = sua.AssocDB.passive_associate( sctp_assoc_id,
+ sua.local_sua,
+ sua.remote_sua,
nr_of_dest_addr,
nr_of_input_streams,
nr_of_output_streams
@@ -867,7 +890,7 @@ void *sctp_CommunicationUpNotif( unsigned int sctp_assoc_id,
/* code include if SUA management is NOT used */
#ifndef SUA_MANAGEMENT
- if ( Assoc_sua.instance[sua_assoc_id].status == asp_down_traf_hold)
+ if ( sua.AssocDB.instance[sua_assoc_id].status == asp_down_traf_hold)
{
/* - get the saved msg ansd send it on the association that is setup */
sua_msg = msg_store.get_msg ( sua_assoc_id );
@@ -910,7 +933,7 @@ void *sctp_CommunicationUpNotif( unsigned int sctp_assoc_id,
}
/* SUA ASP is marked down */
- Assoc_sua.down(sua_assoc_id,0);
+ sua.AssocDB.down(sua_assoc_id,0);
}
#endif
@@ -920,12 +943,14 @@ void *sctp_CommunicationUpNotif( unsigned int sctp_assoc_id,
#ifdef DEBUG
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
);
#endif
+#endif
- return NULL;
+ return NULL;
}
/***********************************************************************/
@@ -959,14 +984,14 @@ void sctp_RestartNotif( unsigned int sctp_assoc_id,
#endif
#ifdef SUA_MANAGEMENT
- if ((sua_assoc_id = Assoc_sua.Find_association(sctp_assoc_id, local_sua_id,remote_sua_id)) == 0)
+ if ((sua_assoc_id = sua.AssocDB.Find_association(sctp_assoc_id, local_sua_id,remote_sua_id)) == 0)
{
#ifdef DEBUG
- cout << "ASP status = " << Assoc_sua.instance[sua_assoc_id].asp.status <<" for SUA association " << sua_assoc_id << "\n";
+ cout << "ASP status = " << sua.AssocDB.instance[sua_assoc_id].asp.status <<" for SUA association " << sua_assoc_id << "\n";
#endif
/* restart association: ASP state should be set to down */
- Assoc_sua.down(sua_assoc_id,0);
+ sua.AssocDB.down(sua_assoc_id,0);
/* if we found the sua assoc then we restart the ASP bringup sequence */
/* as the sctp association has come back online */