aboutsummaryrefslogtreecommitdiffstats
path: root/sualibrary/testup/testuser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sualibrary/testup/testuser.cpp')
-rw-r--r--sualibrary/testup/testuser.cpp84
1 files changed, 68 insertions, 16 deletions
diff --git a/sualibrary/testup/testuser.cpp b/sualibrary/testup/testuser.cpp
index 2a9d69f..0d7facf 100644
--- a/sualibrary/testup/testuser.cpp
+++ b/sualibrary/testup/testuser.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
/*
- * $Id: testuser.cpp,v 1.2 2002/02/15 16:20:29 p82609 Exp $
+ * $Id: testuser.cpp,v 1.7 2002/11/14 15:29:24 p82609 Exp $
*
* SUA Test user part implementation.
*
@@ -189,13 +189,17 @@ void init_testip_stdin()
/***********************************************************************/
/* Test User Part : testip_stdin_cb */
/***********************************************************************/
-void testip_stdin_cb( int fd,
- short int revents,
- void *dummy
+void testip_stdin_cb( int fd,
+ short int revents,
+ short int *gotevents,
+ void *dummy
)
{
int i,length;
+ unsigned int k, outstr_len;
char readBuffer[256];
+ char output_str[INET6_ADDRSTRLEN];
+ const char *ptr;
unsigned int xsxx;
sccp_QOS_str udt_QOS, co_QOS;
@@ -237,6 +241,12 @@ void testip_stdin_cb( int fd,
/* exit program */
exit(0);
}
+ else if (cmdline.find("term") != cmdline.npos)
+ {
+ /* add some cleanups */
+ sua_shutdown();
+ cout << "Closing down the SCTP & SUA associations\n";
+ }
else if ((cmdline.find("rep:") != cmdline.npos))
{
cout << "Repeat sending CL/CO data to remote end every " << rep_timer << " sec\n";
@@ -254,15 +264,57 @@ void testip_stdin_cb( int fd,
else if (cmdline.find("disp mngt") != cmdline.npos)
{
/* Display the management status of all SUA instances */
- cout << "| Association | SUA management status |\n";
- cout << "+-------------+-----------------------+\n";
+ cout << "Display SUA administration and Mangagement data of all associations\n";
+ cout << "|-------+--------+--------------------+--------------------+-----|\n";
+ cout << "| Assoc | status | local IP addr | Remote IP addr | SSN |\n";
+ cout << "|-------+--------+--------------------+--------------------+-----|\n";
i = 1;
while ( SUA_PATH_NO_ERROR == sua_getPath(i,pathinfo) )
{
- cout << "| " << i <<" | "<< pathinfo.ASP_status << " |\n";
+ cout << "| " << i <<" | "<< pathinfo.ASP_status << " | ";
+ if (pathinfo.local_addr.pc.ipvx.sa.sa_family == AF_INET)
+ { /* ipv4 */
+ ptr = inet_ntop( pathinfo.local_addr.pc.ipvx.sa.sa_family,
+ &pathinfo.local_addr.pc.ipvx.sin.sin_addr,
+ output_str,
+ sizeof(output_str)
+ );
+ cout << output_str;
+ outstr_len = strlen(output_str);
+ for(k=0; k < (20 - 3 - outstr_len); k++)
+ cout << " ";
+ cout << "| ";
+ ptr = inet_ntop( pathinfo.remote_addr.pc.ipvx.sa.sa_family,
+ &pathinfo.remote_addr.pc.ipvx.sin.sin_addr,
+ output_str,
+ sizeof(output_str)
+ );
+ cout << output_str;
+ for(k=0; k < /*(20 -*/ 3 /*- outstr_len)*/; k++)
+ cout << " ";
+ cout << "| ";
+ cout << pathinfo.remote_addr.ssn << " |\n";
+ }
+ else
+ { /* ipv6 */
+ ptr = inet_ntop( pathinfo.local_addr.pc.ipvx.sa.sa_family,
+ &pathinfo.local_addr.pc.ipvx.sin6.sin6_addr,
+ output_str,
+ sizeof(output_str)
+ );
+ cout << output_str << " | ";
+ ptr = inet_ntop( pathinfo.remote_addr.pc.ipvx.sa.sa_family,
+ &pathinfo.remote_addr.pc.ipvx.sin6.sin6_addr,
+ output_str,
+ sizeof(output_str)
+ );
+ cout << output_str << " | ";
+ cout << pathinfo.remote_addr.ssn << " |\n";
+ }
+
i++;
}
- cout << "+-------------+-----------------------+\n";
+ cout << "|-------+--------+--------------------+--------------------+-----|\n";
cout << "ASP status values: see sua_asp_mgnt.h\n";
}
else if (cmdline.find("term") != cmdline.npos)
@@ -333,7 +385,7 @@ void testip_stdin_cb( int fd,
called_pty_addr.address_fields_present.ssn_port = ssn_present;
called_pty_addr.address_fields_present.field_in_header = include_nothing;
strcpy(called_pty_addr.name.HostName,addr_str.c_str());
- called_pty_addr.ssn = 255;
+ called_pty_addr.ssn = calling_pty_addr.ssn;
called_pty_addr.routing_ind = route_on_name_gt;
cout << "DNS/SUA dest hostname = " << addr_str << "\n";
@@ -345,7 +397,7 @@ void testip_stdin_cb( int fd,
calling_pty_addr.address_fields_present.name_gt = hostname_present;
strcpy(calling_pty_addr.name.HostName, own_hostname);
- calling_pty_addr.ssn = 255;
+ calling_pty_addr.ssn = 5;
calling_pty_addr.routing_ind = route_on_name_gt;
cout << "DNS/SUA source hostname = " << addr2_str << "\n";
@@ -364,10 +416,10 @@ void testip_stdin_cb( int fd,
called_pty_addr.address_fields_present.field_in_header = include_nothing;
called_pty_addr.pc.ss7.ITU24.family = ITU24bit;
called_pty_addr.pc.ss7.ITU24.pc = atoi(addr_char);
- called_pty_addr.ssn = 255;
+ called_pty_addr.ssn = calling_pty_addr.ssn;
called_pty_addr.routing_ind = route_on_ssn;
- calling_pty_addr.ssn = 255;
+ calling_pty_addr.ssn = 5;
calling_pty_addr.routing_ind = route_on_ssn;
cout << "Address of remote end stored. Msg will be sent to this one\n";
@@ -448,8 +500,6 @@ void testip_stdin_cb( int fd,
calling_pty_addr.address_fields_present.field_in_header = called_pty_addr.address_fields_present.field_in_header;
string addr4_str = own_hostname;
- /*char *name4_char = new char [addr4_str.length()+1]; */
- /*name4_char = shost_to_suaname ( addr4_str ); */
strcpy(calling_pty_addr.name.HostName, own_hostname);
calling_pty_addr.pc.ipvx = pathinfo.local_addr.pc.ipvx;
@@ -503,7 +553,8 @@ void timer_expired(unsigned int tID,
sendcnt++;
cout << "Send a PING\n";
doPingPong(Sua_ConnId);
- timerID = sctp_startTimer( 10000,
+ timerID = sctp_startTimer( 10, /* seconds */
+ 0, /* microseconds */
&timer_expired,
NULL,
NULL
@@ -728,7 +779,8 @@ void ulp_ConnConfIndNotif( unsigned int local_sua_Id,
// received the connection confirmed msg
// this is the initiator of the connection
// start a timer for sending the data to the responder
- timerID = sctp_startTimer( 5000,
+ timerID = sctp_startTimer( 15, /* seconds */
+ 0, /* microseconds */
&timer_expired,
NULL,
NULL