aboutsummaryrefslogtreecommitdiffstats
path: root/sualibrary/sua/sua_asp_mgnt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sualibrary/sua/sua_asp_mgnt.cpp')
-rw-r--r--sualibrary/sua/sua_asp_mgnt.cpp106
1 files changed, 66 insertions, 40 deletions
diff --git a/sualibrary/sua/sua_asp_mgnt.cpp b/sualibrary/sua/sua_asp_mgnt.cpp
index 93f0b9e..15f4d17 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.1.1.1 2002/02/04 14:30:41 p82609 Exp $
+ * $Id: sua_asp_mgnt.cpp,v 1.3 2002/11/12 11:02:49 p82609 Exp $
*
* SUA implementation according to SUA draft issue 6.
*
@@ -79,12 +79,13 @@
#include "sua_tcb.h"
#include <cstdio>
+#include <iostream>
#include <string>
-extern db_Sua_LocalList local_sua;
-extern db_Sua_RemoteList remote_sua;
-extern db_Sua_AssociationList Assoc_sua;
-extern db_Sua_ASList ApplicServ_sua;
+using namespace std;
+
+extern db_Sua_DatabaseList sua;
+
extern tcb_Sua_msgqueue_pool msg_store;
/***********************************************************************/
@@ -121,7 +122,7 @@ int sua_send_ASPUP( unsigned int Sua_assoc_id
delivery_type = SCTP_UNORDERED_DELIVERY;
- sctp_assoc_id = Assoc_sua.instance[Sua_assoc_id].SCTP_assoc_id;
+ sctp_assoc_id = sua.AssocDB.instance[Sua_assoc_id].SCTP_assoc_id;
/* does association exist? */
if (sctp_assoc_id > 0)
@@ -198,7 +199,7 @@ int sua_send_ASPUP_ACK( unsigned int Sua_assoc_id,
delivery_type = SCTP_UNORDERED_DELIVERY;
- sctp_assoc_id = Assoc_sua.instance[Sua_assoc_id].SCTP_assoc_id;
+ sctp_assoc_id = sua.AssocDB.instance[Sua_assoc_id].SCTP_assoc_id;
/* does association exist? */
if (sctp_assoc_id > 0)
@@ -268,7 +269,7 @@ int sua_send_ASPDOWN_ACK( unsigned int Sua_assoc_id
delivery_type = SCTP_UNORDERED_DELIVERY;
- sctp_assoc_id = Assoc_sua.instance[Sua_assoc_id].SCTP_assoc_id;
+ sctp_assoc_id = sua.AssocDB.instance[Sua_assoc_id].SCTP_assoc_id;
/* does association exist? */
if (sctp_assoc_id > 0)
@@ -338,7 +339,7 @@ int sua_send_BEAT( unsigned int Sua_assoc_id
delivery_type = SCTP_UNORDERED_DELIVERY;
- sctp_assoc_id = Assoc_sua.instance[Sua_assoc_id].SCTP_assoc_id;
+ sctp_assoc_id = sua.AssocDB.instance[Sua_assoc_id].SCTP_assoc_id;
/* does association exist? */
if (sctp_assoc_id > 0)
@@ -412,7 +413,7 @@ int sua_send_BEAT_ACK( unsigned int Sua_assoc_id,
delivery_type = SCTP_UNORDERED_DELIVERY;
- sctp_assoc_id = Assoc_sua.instance[Sua_assoc_id].SCTP_assoc_id;
+ sctp_assoc_id = sua.AssocDB.instance[Sua_assoc_id].SCTP_assoc_id;
/* does association exist? */
if (sctp_assoc_id > 0)
@@ -476,9 +477,10 @@ int sua_send_ASPAC( unsigned int Sua_assoc_id
msg.sua_prim.hdr_msg_type.asptm = asptm_act;
/* traffic mode is optional mandatory */
msg.sua_prim.traf_mode_pres = TRUE;
- msg.sua_prim.traf_mode = tmt_loadshare;
+ msg.sua_prim.traf_mode = tmt_override;
/* rest is optional */
- msg.sua_prim.rout_con_pres = FALSE;
+ msg.sua_prim.rout_con_pres = TRUE;
+ msg.sua_prim.rout_con = 1;
msg.sua_prim.info_pres = FALSE;
// encode the SUA unitdata message
@@ -487,7 +489,7 @@ int sua_send_ASPAC( unsigned int Sua_assoc_id
delivery_type = SCTP_UNORDERED_DELIVERY;
- sctp_assoc_id = Assoc_sua.instance[Sua_assoc_id].SCTP_assoc_id;
+ sctp_assoc_id = sua.AssocDB.instance[Sua_assoc_id].SCTP_assoc_id;
/* does association exist? */
if (sctp_assoc_id > 0)
@@ -571,7 +573,7 @@ int sua_send_ASPAC_ACK( unsigned int Sua_assoc_id,
delivery_type = SCTP_UNORDERED_DELIVERY;
- sctp_assoc_id = Assoc_sua.instance[Sua_assoc_id].SCTP_assoc_id;
+ sctp_assoc_id = sua.AssocDB.instance[Sua_assoc_id].SCTP_assoc_id;
/* does association exist? */
if (sctp_assoc_id > 0)
@@ -617,7 +619,9 @@ int sua_send_ASPAC_ACK( unsigned int Sua_assoc_id,
/***********************************************************************/
/* sua_send_ASPINAC_ACK */
/***********************************************************************/
-int sua_send_ASPINAC_ACK( unsigned int Sua_assoc_id
+int sua_send_ASPINAC_ACK( unsigned int Sua_assoc_id,
+ boolean routing_context_present,
+ uint32_t routing_context
)
{
Sua_container msg;
@@ -634,7 +638,8 @@ int sua_send_ASPINAC_ACK( unsigned int Sua_assoc_id
// fill in the main sua header
msg.sua_prim.hdr_msg_class = sua_asptm;
msg.sua_prim.hdr_msg_type.asptm = asptm_inact_ack;
- msg.sua_prim.rout_con_pres = FALSE;
+ msg.sua_prim.rout_con_pres = routing_context_present;
+ msg.sua_prim.rout_con = routing_context;
msg.sua_prim.info_pres = FALSE;
// encode the SUA unitdata message
@@ -643,7 +648,7 @@ int sua_send_ASPINAC_ACK( unsigned int Sua_assoc_id
delivery_type = SCTP_UNORDERED_DELIVERY;
- sctp_assoc_id = Assoc_sua.instance[Sua_assoc_id].SCTP_assoc_id;
+ sctp_assoc_id = sua.AssocDB.instance[Sua_assoc_id].SCTP_assoc_id;
/* does association exist? */
if (sctp_assoc_id > 0)
@@ -704,7 +709,7 @@ int process_ASPUP_msg ( unsigned int sua_assoc_id,
cout << "sua_asp_mgnt.c:ASPUP received, send back a ASPUP_ACK and set state to ASP-INACTIVE.\n";
#endif
- Assoc_sua.up(sua_assoc_id,0);
+ sua.AssocDB.up(sua_assoc_id,0);
error_value = sua_send_ASPUP_ACK( sua_assoc_id ,
sua_asp_msg.sua_prim.ASP_id_pres,
@@ -712,7 +717,15 @@ int process_ASPUP_msg ( unsigned int sua_assoc_id,
);
#ifdef DEBUG
cout << "sua_asp_mgnt.c:result send ASPUP_ACK = "<< error_value << "\n";
- cout << "sua_asp_mgnt.c:ASPUP processing state = "<< Assoc_sua.instance[sua_assoc_id].asp.status << "\n";
+ cout << "sua_asp_mgnt.c:ASPUP processing state = "<< sua.AssocDB.instance[sua_assoc_id].asp.status << "\n";
+#endif
+
+#ifdef IPSP_SINGLE
+ error_value = sua_send_ASPAC( sua_assoc_id );
+#ifdef DEBUG
+ cout << "sua_asp_mgnt.c:result send ASPAC = "<< error_value << "\n";
+ cout << "sua_asp_mgnt.c:ASPAC processing state = "<< sua.AssocDB.instance[sua_assoc_id].asp.status << "\n";
+#endif
#endif
return(error_value);
@@ -732,14 +745,18 @@ int process_ASPUP_ACK_msg ( unsigned int sua_assoc_id,
cout << "sua_asp_mgnt.c:ASPUP_ACK received, looks like remote is inactive.\n";
#endif
- Assoc_sua.up(sua_assoc_id,0);
+ sua.AssocDB.up(sua_assoc_id,0);
+#ifndef IPSP_SINGLE
/* send activation to remote */
error_value = sua_send_ASPAC( sua_assoc_id );
+
#ifdef DEBUG
cout << "sua_asp_mgnt.c:result send ASPAC = "<< error_value << "\n";
- cout << "sua_asp_mgnt.c:ASPUP_ACK processing state = "<< Assoc_sua.instance[sua_assoc_id].asp.status << "\n";
+ cout << "sua_asp_mgnt.c:ASPUP_ACK processing state = "<< sua.AssocDB.instance[sua_assoc_id].asp.status << "\n";
#endif
+#endif
+
return(error_value);
}
@@ -759,7 +776,7 @@ int process_ASPDOWN_msg ( unsigned int sua_assoc_id,
cout << "sua_asp_mgnt.c:ASPDOWN received, send back a ASPDOWN_ACK and set state to ASP-DOWN.\n";
#endif
- Assoc_sua.down(sua_assoc_id,0);
+ sua.AssocDB.down(sua_assoc_id,0);
error_value = sua_send_ASPDOWN_ACK( sua_assoc_id );
@@ -784,7 +801,7 @@ int process_ASPDOWN_ACK_msg ( unsigned int sua_assoc_id,
cout << "sua_asp_mgnt.c:ASPDOWN_ACK received, remote looks down.\n";
#endif
- Assoc_sua.down(sua_assoc_id,0);
+ sua.AssocDB.down(sua_assoc_id,0);
return(error_value);
}
@@ -853,10 +870,10 @@ int process_ASPAC_msg ( unsigned int sua_assoc_id,
#endif
if (sua_asp_msg.sua_prim.traf_mode_pres)
- holdtraffic_pres = Assoc_sua.activate(sua_assoc_id,
+ holdtraffic_pres = sua.AssocDB.activate(sua_assoc_id,
sua_asp_msg.sua_prim.traf_mode);
else
- holdtraffic_pres = Assoc_sua.activate(sua_assoc_id,0);
+ holdtraffic_pres = sua.AssocDB.activate(sua_assoc_id,0);
error_value = sua_send_ASPAC_ACK( sua_assoc_id,
sua_asp_msg.sua_prim.traf_mode_pres,
@@ -867,7 +884,7 @@ int process_ASPAC_msg ( unsigned int sua_assoc_id,
#ifdef DEBUG
cout << "sua_asp_mgnt.c:result ASPAC_ACK send = "<< error_value << "\n";
- cout << "sua_asp_mgnt.c:ASPAC processing state = "<< Assoc_sua.instance[sua_assoc_id].asp.status << "\n";
+ cout << "sua_asp_mgnt.c:ASPAC processing state = "<< sua.AssocDB.instance[sua_assoc_id].asp.status << "\n";
#endif
if (holdtraffic_pres)
@@ -886,7 +903,7 @@ int process_ASPAC_msg ( unsigned int sua_assoc_id,
/* msg retrieved and copied, may now remove it from queue */
msg_store.delete_msg ( sua_assoc_id );
- sctp_assoc_id = Assoc_sua.instance[sua_assoc_id].SCTP_assoc_id;
+ sctp_assoc_id = sua.AssocDB.instance[sua_assoc_id].SCTP_assoc_id;
#ifdef DEBUG
display_byte_array(databuf , sua_msg.byte.length());
@@ -933,14 +950,14 @@ int process_ASPAC_ACK_msg ( unsigned int sua_assoc_id,
int error_value = 0;
bool holdtraffic_pres = FALSE;
-#ifdef SG_ASP_MODE
+ /*#ifdef SG_ASP_MODE*/
if (sua_asp_msg.sua_prim.traf_mode_pres)
- holdtraffic_pres = Assoc_sua.activate(sua_assoc_id,
+ holdtraffic_pres = sua.AssocDB.activate(sua_assoc_id,
sua_asp_msg.sua_prim.traf_mode);
else
- holdtraffic_pres = Assoc_sua.activate(sua_assoc_id,0);
+ holdtraffic_pres = sua.AssocDB.activate(sua_assoc_id,0);
-#endif
+ /*#endif*/
#ifdef DEBUG
cout << "sua_asp_mgnt.c:ASPAC_ACK received, nothing further to do.\n";
@@ -963,9 +980,12 @@ int process_ASPINAC_msg ( unsigned int sua_assoc_id,
#ifdef DEBUG
cout << "sua_asp_mgnt.c:ASPINAC received, send back a ASPINAC_ACK and set state to ASP-INACTIVE.\n";
#endif
- Assoc_sua.deactivate(sua_assoc_id,0);
-
- error_value = sua_send_ASPINAC_ACK( sua_assoc_id );
+ sua.AssocDB.deactivate(sua_assoc_id,0);
+
+ error_value = sua_send_ASPINAC_ACK( sua_assoc_id,
+ sua_asp_msg.sua_prim.rout_con_pres,
+ sua_asp_msg.sua_prim.rout_con
+ );
#ifdef DEBUG
cout << "sua_asp_mgnt.c:result ASPINAC_ACK send = "<< error_value << "\n";
#endif
@@ -997,20 +1017,26 @@ void Asp_mngt_standby ( unsigned int sua_AS_id,
short mode
)
{
- ApplicServ_sua.override_ASP( sua_asp_id,
- sua_AS_id,
- mode
- );
+ sua.ApplicServ.override_ASP( sua_asp_id,
+ sua_AS_id,
+ mode
+ );
}
+/***********************************************************************/
+/* Asp_activate_override */
+/***********************************************************************/
void asp_activate_override ( unsigned int asp_sua_assoc_id )
{
- Assoc_sua.activate(asp_sua_assoc_id,0);
+ sua.AssocDB.activate(asp_sua_assoc_id,0);
}
+/***********************************************************************/
+/* Asp_asp_deactivate */
+/***********************************************************************/
void asp_deactivate ( unsigned int asp_sua_assoc_id)
{
- Assoc_sua.deactivate(asp_sua_assoc_id,0);
+ sua.AssocDB.deactivate(asp_sua_assoc_id,0);
}