From c9c547aafe5b6c6df8714cf30d2bde0fdd4d0722 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 9 Jul 2010 20:58:12 +0200 Subject: 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 --- sualibrary/testup/Makefile.am | 3 +++ sualibrary/testup/main.cpp | 7 +++-- sualibrary/testup/testuser.cpp | 59 +++++++++++++++++++++++++++++++++++------- sualibrary/testup/testuser.h | 2 +- 4 files changed, 56 insertions(+), 15 deletions(-) (limited to 'sualibrary/testup') 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); @@ -401,6 +401,33 @@ void testip_stdin_cb( int fd, calling_pty_addr.routing_ind = route_on_name_gt; 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) { @@ -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. * -- cgit v1.2.3