This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9652 )
Change subject: sccp_demo_user: use point code 23 for server and 1 for client
......................................................................
sccp_demo_user: use point code 23 for server and 1 for client
Fix previous commit 4dc9088cabedc40cb9072814237ad5926b12bd35 which
broke this by using -1 for local and 23 for remote PC, for both
server and client.
Change-Id: I7432e6fc2617e0fd77a098fcd7d14abc40db7229
Related: OS#2666
---
M examples/sccp_demo_user.c
1 file changed, 48 insertions(+), 19 deletions(-)
Approvals:
Jenkins Builder: Verified
Harald Welte: Looks good to me, approved
diff --git a/examples/sccp_demo_user.c b/examples/sccp_demo_user.c
index f0b1a3e..9a9d6eb 100644
--- a/examples/sccp_demo_user.c
+++ b/examples/sccp_demo_user.c
@@ -82,12 +82,17 @@
.version = 0,
};
-#define DEFAULT_LOCAL_PC -1
-#define DEFAULT_LOCAL_ADDRESS "127.0.0.2"
-#define DEFAULT_LOCAL_PORT M3UA_PORT
-#define DEFAULT_REMOTE_PC 23
-#define DEFAULT_REMOTE_ADDRESS "127.0.0.1"
-#define DEFAULT_REMOTE_PORT M3UA_PORT
+#define DEFAULT_LOCAL_ADDRESS_SERVER "127.0.0.1"
+#define DEFAULT_LOCAL_ADDRESS_CLIENT "127.0.0.2"
+#define DEFAULT_REMOTE_ADDRESS_CLIENT DEFAULT_LOCAL_ADDRESS_SERVER
+#define DEFAULT_REMOTE_ADDRESS_SERVER DEFAULT_LOCAL_ADDRESS_CLIENT
+#define DEFAULT_LOCAL_PORT_SERVER M3UA_PORT
+#define DEFAULT_LOCAL_PORT_CLIENT M3UA_PORT
+#define DEFAULT_REMOTE_PORT_CLIENT DEFAULT_LOCAL_PORT_SERVER
+#define DEFAULT_REMOTE_PORT_SERVER DEFAULT_LOCAL_PORT_CLIENT
+#define DEFAULT_REMOTE_PORT_SERVER_STR DEFAULT_LOCAL_PORT_CLIENT_STR
+#define DEFAULT_PC_SERVER 1
+#define DEFAULT_PC_CLIENT 23
static void usage(void) {
fprintf(stderr, "sccp_demo_user [-c] [-l LOCAL_ADDRESS[:LOCAL_PORT]]\n"
@@ -95,13 +100,18 @@
" [-L LOCAL_POINT_CODE] [-R REMOTE_POINT_CODE]\n"
"Options:\n"
" -c: Run in client mode (default is server mode)\n"
- " -l: local IP address and SCTP port (default is %s:%d)\n"
- " -r: remote IP address and SCTP port (default is %s:%d)\n"
- " -L: local point code (default is %d)\n"
- " -R: remote point code (default is %d)\n",
- DEFAULT_LOCAL_ADDRESS, DEFAULT_LOCAL_PORT,
- DEFAULT_REMOTE_ADDRESS, DEFAULT_REMOTE_PORT,
- DEFAULT_LOCAL_PC, DEFAULT_REMOTE_PC);
+ " -l: local IP address and SCTP port (default is %s:%d in server mode,\n"
+ " %s:%d in client mode)\n"
+ " -r: remote IP address and SCTP port (default is %s:%d in server mode,\n"
+ " %s:%d in client mode)\n"
+ " -L: local point code (default is %d in server mode, %d in client mode)\n"
+ " -R: remote point code (default is %d in server mode, %d in client mode)\n",
+ DEFAULT_LOCAL_ADDRESS_SERVER, DEFAULT_LOCAL_PORT_SERVER,
+ DEFAULT_LOCAL_ADDRESS_CLIENT, DEFAULT_LOCAL_PORT_CLIENT,
+ DEFAULT_REMOTE_ADDRESS_SERVER, DEFAULT_REMOTE_PORT_SERVER,
+ DEFAULT_REMOTE_ADDRESS_CLIENT, DEFAULT_REMOTE_PORT_CLIENT,
+ DEFAULT_PC_SERVER, DEFAULT_PC_CLIENT,
+ DEFAULT_PC_CLIENT, DEFAULT_PC_SERVER);
exit(1);
}
@@ -151,25 +161,42 @@
{
bool client = false;
int rc, ch;
- char *local_address = DEFAULT_LOCAL_ADDRESS;
- int local_port = DEFAULT_LOCAL_PORT;
- int local_pc = DEFAULT_LOCAL_PC;
- char *remote_address = DEFAULT_REMOTE_ADDRESS;
- int remote_port = DEFAULT_LOCAL_PORT;
- int remote_pc = DEFAULT_REMOTE_PC;
+ char *local_address = DEFAULT_LOCAL_ADDRESS_SERVER;
+ int local_port = DEFAULT_LOCAL_PORT_SERVER;
+ int local_pc = DEFAULT_PC_SERVER;
+ char *remote_address = DEFAULT_REMOTE_ADDRESS_SERVER;
+ int remote_port = DEFAULT_REMOTE_PORT_SERVER;
+ int remote_pc = DEFAULT_PC_CLIENT;
+ bool lflag = false, rflag = false, Lflag = false, Rflag = false;
while ((ch = getopt(argc, argv, "cl:r:p:L:R:")) != -1) {
switch (ch) {
case 'c':
client = true;
+
+ /* Set client-mode defaults unless already overridden during option parsing. */
+ if (!lflag) {
+ local_address = DEFAULT_LOCAL_ADDRESS_CLIENT;
+ local_port = DEFAULT_LOCAL_PORT_CLIENT;
+ }
+ if (!Lflag)
+ local_pc = DEFAULT_PC_CLIENT;
+ if (!rflag) {
+ remote_address = DEFAULT_REMOTE_ADDRESS_CLIENT;
+ remote_port = DEFAULT_REMOTE_PORT_CLIENT;
+ }
+ if (!Rflag)
+ remote_pc = DEFAULT_PC_SERVER;
break;
case 'l':
if (parse_address_port(&local_address, &local_port, optarg))
exit(1);
+ lflag = true;
break;
case 'r':
if (parse_address_port(&remote_address, &remote_port, optarg))
exit(1);
+ rflag = true;
break;
case 'L':
if (!is_decimal_string(optarg)) {
@@ -177,6 +204,7 @@
exit(1);
}
local_pc = atoi(optarg);
+ Lflag = true;
break;
case 'R':
if (!is_decimal_string(optarg)) {
@@ -184,6 +212,7 @@
exit(1);
}
remote_pc = atoi(optarg);
+ Rflag = true;
break;
default:
usage();
--
To view, visit https://gerrit.osmocom.org/9652
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I7432e6fc2617e0fd77a098fcd7d14abc40db7229
Gerrit-Change-Number: 9652
Gerrit-PatchSet: 4
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Stefan Sperling <ssperling at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180721/2681bd74/attachment.htm>