[S] Change in libosmo-netif[master]: examples/stream-*: Add options, to set local/remote peer

2024-02-29 Thread jolly
jolly has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/35927?usp=email )

Change subject: examples/stream-*: Add options, to set local/remote peer
..


Patch Set 5:

(1 comment)

Commit Message:

https://gerrit.osmocom.org/c/libosmo-netif/+/35927/comment/a8e3dc3d_429161df
PS2, Line 12: remove
> remote
Done



--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35927?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ie6da55ef248436e521c5d8f21f8053356c46a114
Gerrit-Change-Number: 35927
Gerrit-PatchSet: 5
Gerrit-Owner: jolly 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: jolly 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 29 Feb 2024 08:17:43 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge 
Gerrit-MessageType: comment


[S] Change in libosmo-netif[master]: examples/stream-*: Add options, to set local/remote peer

2024-02-28 Thread jolly
jolly has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/35927?usp=email )

Change subject: examples/stream-*: Add options, to set local/remote peer
..

examples/stream-*: Add options, to set local/remote peer

This helps to test connections via a network and failing connections.

The client may add "-r " to the command line, to set the address
of the remote peer.

The server may add "-l " to the command line, to select address
of local peer.

By default "127.0.0.1" is used.

Change-Id: Ie6da55ef248436e521c5d8f21f8053356c46a114
---
M examples/stream-client.c
M examples/stream-server.c
2 files changed, 33 insertions(+), 7 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve
  Jenkins Builder: Verified




diff --git a/examples/stream-client.c b/examples/stream-client.c
index e42748f..535804e 100644
--- a/examples/stream-client.c
+++ b/examples/stream-client.c
@@ -94,15 +94,19 @@
 {
struct osmo_fd *kbd_ofd;
bool use_sctp = false;
+   const char *use_remote_addr = "127.0.0.1";
int opt, rc;

-   while ((opt = getopt(argc, argv, "s")) != -1) {
+   while ((opt = getopt(argc, argv, "sr:")) != -1) {
switch (opt) {
case 's':
use_sctp = true;
break;
-   default:
+   case 'r':
+   use_remote_addr = optarg;
break;
+   default:
+   exit(0);
}
}

@@ -121,11 +125,10 @@
exit(EXIT_FAILURE);
}
osmo_stream_cli_set_name(conn, "stream_client");
-   osmo_stream_cli_set_addr(conn, "127.0.0.1");
+   osmo_stream_cli_set_addr(conn, use_remote_addr);
osmo_stream_cli_set_port(conn, 1);
if (use_sctp)
osmo_stream_cli_set_proto(conn, IPPROTO_SCTP);
-
osmo_stream_cli_set_connect_cb(conn, connect_cb);
osmo_stream_cli_set_disconnect_cb(conn, disconnect_cb);
osmo_stream_cli_set_read_cb2(conn, read_cb);
diff --git a/examples/stream-server.c b/examples/stream-server.c
index 9faf307..bfbde6d 100644
--- a/examples/stream-server.c
+++ b/examples/stream-server.c
@@ -121,15 +121,19 @@
 {
struct osmo_fd *kbd_ofd;
bool use_sctp = false;
+   const char *use_local_addr = "127.0.0.1";
int opt;

-   while ((opt = getopt(argc, argv, "s")) != -1) {
+   while ((opt = getopt(argc, argv, "sl:")) != -1) {
switch (opt) {
case 's':
use_sctp = true;
break;
-   default:
+   case 'l':
+   use_local_addr = optarg;
break;
+   default:
+   exit(0);
}
}

@@ -147,7 +151,7 @@
fprintf(stderr, "cannot create server link\n");
exit(EXIT_FAILURE);
}
-   osmo_stream_srv_link_set_addr(srv, "127.0.0.1");
+   osmo_stream_srv_link_set_addr(srv, use_local_addr);
osmo_stream_srv_link_set_port(srv, 1);
if (use_sctp)
osmo_stream_srv_link_set_proto(srv, IPPROTO_SCTP);

--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35927?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ie6da55ef248436e521c5d8f21f8053356c46a114
Gerrit-Change-Number: 35927
Gerrit-PatchSet: 5
Gerrit-Owner: jolly 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: jolly 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


[S] Change in libosmo-netif[master]: examples/stream-*: Add options, to set local/remote peer

2024-02-28 Thread pespin
Attention is currently required from: jolly, laforge.

pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/35927?usp=email )

Change subject: examples/stream-*: Add options, to set local/remote peer
..


Patch Set 5: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35927?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ie6da55ef248436e521c5d8f21f8053356c46a114
Gerrit-Change-Number: 35927
Gerrit-PatchSet: 5
Gerrit-Owner: jolly 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Attention: jolly 
Gerrit-Attention: laforge 
Gerrit-Comment-Date: Wed, 28 Feb 2024 12:56:30 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[S] Change in libosmo-netif[master]: examples/stream-*: Add options, to set local/remote peer

2024-02-28 Thread laforge
Attention is currently required from: jolly.

laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/35927?usp=email )

Change subject: examples/stream-*: Add options, to set local/remote peer
..


Patch Set 5: Code-Review+1

(1 comment)

Commit Message:

https://gerrit.osmocom.org/c/libosmo-netif/+/35927/comment/108ef916_f6d353fb
PS2, Line 12: remove
> remote
Done



--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35927?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ie6da55ef248436e521c5d8f21f8053356c46a114
Gerrit-Change-Number: 35927
Gerrit-PatchSet: 5
Gerrit-Owner: jolly 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Attention: jolly 
Gerrit-Comment-Date: Wed, 28 Feb 2024 09:29:34 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: laforge 
Gerrit-MessageType: comment


[S] Change in libosmo-netif[master]: examples/stream-*: Add options, to set local/remote peer

2024-02-28 Thread laforge
Attention is currently required from: jolly, laforge.

laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/35927?usp=email )

Change subject: examples/stream-*: Add options, to set local/remote peer
..


Set Ready For Review


--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35927?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ie6da55ef248436e521c5d8f21f8053356c46a114
Gerrit-Change-Number: 35927
Gerrit-PatchSet: 5
Gerrit-Owner: jolly 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Attention: jolly 
Gerrit-Attention: laforge 
Gerrit-Comment-Date: Wed, 28 Feb 2024 08:47:39 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


[S] Change in libosmo-netif[master]: examples/stream-*: Add options, to set local/remote peer

2024-02-09 Thread jolly
jolly has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/35927?usp=email )


Change subject: examples/stream-*: Add options, to set local/remote peer
..

examples/stream-*: Add options, to set local/remote peer

This helps to test connections via a network and failing connections.

The client may add "-r " to the command line, to set the address
of the remove peer.

The server may add "-l " to the command line, to select address
of local peer.

By default "127.0.0.1" is used.

Change-Id: Ie6da55ef248436e521c5d8f21f8053356c46a114
---
M examples/stream-client.c
M examples/stream-server.c
2 files changed, 33 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/27/35927/1

diff --git a/examples/stream-client.c b/examples/stream-client.c
index af0e38f..a7b80ab 100644
--- a/examples/stream-client.c
+++ b/examples/stream-client.c
@@ -97,15 +97,19 @@
 {
struct osmo_fd *kbd_ofd;
bool use_sctp = false;
+   const char *use_remote_addr = "127.0.0.1";
int opt, rc;

-   while ((opt = getopt(argc, argv, "s")) != -1) {
+   while ((opt = getopt(argc, argv, "sr:")) != -1) {
switch (opt) {
case 's':
use_sctp = true;
break;
-   default:
+   case 'r':
+   use_remote_addr = optarg;
break;
+   default:
+   exit(0);
}
}

@@ -124,11 +128,10 @@
exit(EXIT_FAILURE);
}
osmo_stream_cli_set_name(conn, "stream_client");
-   osmo_stream_cli_set_addr(conn, "127.0.0.1");
+   osmo_stream_cli_set_addr(conn, use_remote_addr);
osmo_stream_cli_set_port(conn, 1);
if (use_sctp)
osmo_stream_cli_set_proto(conn, IPPROTO_SCTP);
-
osmo_stream_cli_set_connect_cb(conn, connect_cb);
osmo_stream_cli_set_disconnect_cb(conn, disconnect_cb);
osmo_stream_cli_set_read_cb2(conn, read_cb);
diff --git a/examples/stream-server.c b/examples/stream-server.c
index 2dee5f6..19ef83e 100644
--- a/examples/stream-server.c
+++ b/examples/stream-server.c
@@ -124,15 +124,19 @@
 {
struct osmo_fd *kbd_ofd;
bool use_sctp = false;
+   const char *use_local_addr = "127.0.0.1";
int opt;

-   while ((opt = getopt(argc, argv, "s")) != -1) {
+   while ((opt = getopt(argc, argv, "sl:")) != -1) {
switch (opt) {
case 's':
use_sctp = true;
break;
-   default:
+   case 'l':
+   use_local_addr = optarg;
break;
+   default:
+   exit(0);
}
}

@@ -150,7 +154,7 @@
fprintf(stderr, "cannot create server link\n");
exit(EXIT_FAILURE);
}
-   osmo_stream_srv_link_set_addr(srv, "127.0.0.1");
+   osmo_stream_srv_link_set_addr(srv, use_local_addr);
osmo_stream_srv_link_set_port(srv, 1);
if (use_sctp)
osmo_stream_srv_link_set_proto(srv, IPPROTO_SCTP);

--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35927?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ie6da55ef248436e521c5d8f21f8053356c46a114
Gerrit-Change-Number: 35927
Gerrit-PatchSet: 1
Gerrit-Owner: jolly 
Gerrit-MessageType: newchange