pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/34348?usp=email )


Change subject: stream: Add new stream_cli parameters to set SCTP_INITMSG 
sockopt values
......................................................................

stream: Add new stream_cli parameters to set SCTP_INITMSG sockopt values

This will allow osmo_stream users (like libosmo-sccp) to set
SCTP_INITMSG related parameters, like number on inbound/outbound
streams, connect attempts, connect timeout.

Related: SYS#6558
Change-Id: I5343c7659881b29e0201e72badbc2d07e1ef2dca
---
M include/osmocom/netif/stream.h
M src/stream_cli.c
2 files changed, 46 insertions(+), 0 deletions(-)



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

diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h
index f78df8a..b2ca1ca 100644
--- a/include/osmocom/netif/stream.h
+++ b/include/osmocom/netif/stream.h
@@ -117,6 +117,10 @@
 enum osmo_stream_cli_param {
        OSMO_STREAM_CLI_PAR_SCTP_SOCKOPT_AUTH_SUPPORTED, /* uint8_t: 0 disable, 
1 enable, 2 force disable, 3 force enable */
        OSMO_STREAM_CLI_PAR_SCTP_SOCKOPT_ASCONF_SUPPORTED, /* uint8_t: 0 
disable, 1 enable, 2 force disable, 3 force enable */
+       OSMO_STREAM_CLI_PAR_SCTP_INIT_NUM_OSTREAMS,
+       OSMO_STREAM_CLI_PAR_SCTP_INIT_MAX_INSTREAMS,
+       OSMO_STREAM_CLI_PAR_SCTP_INIT_MAX_ATTEMPTS,
+       OSMO_STREAM_CLI_PAR_SCTP_INIT_TIMEOUT,
 };

 int osmo_stream_cli_set_param(struct osmo_stream_cli *cli, enum 
osmo_stream_cli_param par,
diff --git a/src/stream_cli.c b/src/stream_cli.c
index 16d033e..23e1900 100644
--- a/src/stream_cli.c
+++ b/src/stream_cli.c
@@ -1023,6 +1023,34 @@
                cli->ma_pars.sctp.sockopt_asconf_supported.abort_on_failure = 
val8 > 1;
                cli->ma_pars.sctp.sockopt_asconf_supported.value = (val8 == 1 
|| val8 == 3) ? 1 : 0;
                break;
+       case OSMO_STREAM_CLI_PAR_SCTP_INIT_NUM_OSTREAMS:
+               if (!val || val_len != sizeof(uint16_t))
+                       return -EINVAL;
+               cli->ma_pars.sctp.sockopt_initmsg.set = true;
+               cli->ma_pars.sctp.sockopt_initmsg.num_ostreams_present = true;
+               cli->ma_pars.sctp.sockopt_initmsg.num_ostreams_value = 
*(uint16_t *)val;
+               break;
+       case OSMO_STREAM_CLI_PAR_SCTP_INIT_MAX_INSTREAMS:
+               if (!val || val_len != sizeof(uint16_t))
+                       return -EINVAL;
+               cli->ma_pars.sctp.sockopt_initmsg.set = true;
+               cli->ma_pars.sctp.sockopt_initmsg.max_instreams_present = true;
+               cli->ma_pars.sctp.sockopt_initmsg.max_instreams_value = 
*(uint16_t *)val;
+               break;
+       case OSMO_STREAM_CLI_PAR_SCTP_INIT_MAX_ATTEMPTS:
+               if (!val || val_len != sizeof(uint16_t))
+                       return -EINVAL;
+               cli->ma_pars.sctp.sockopt_initmsg.set = true;
+               cli->ma_pars.sctp.sockopt_initmsg.max_attempts_present = true;
+               cli->ma_pars.sctp.sockopt_initmsg.max_attempts_value = 
*(uint16_t *)val;
+               break;
+       case OSMO_STREAM_CLI_PAR_SCTP_INIT_TIMEOUT:
+               if (!val || val_len != sizeof(uint16_t))
+                       return -EINVAL;
+               cli->ma_pars.sctp.sockopt_initmsg.set = true;
+               cli->ma_pars.sctp.sockopt_initmsg.max_init_timeo_present = true;
+               cli->ma_pars.sctp.sockopt_initmsg.max_init_timeo_value = 
*(uint16_t *)val;
+               break;
        default:
                return -ENOENT;
        };

--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/34348?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: I5343c7659881b29e0201e72badbc2d07e1ef2dca
Gerrit-Change-Number: 34348
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to