neels has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmo-sccp/+/32677 )
Change subject: add osmo_sccp_set_max_optional_data()
......................................................................
add osmo_sccp_set_max_optional_data()
So far, the optional data limit can only be modified via cs7 VTY,
because struct osmo_sccp_instance is private. Provide public API to set
this limit from C.
Change-Id: If3d22a0f65a7ed0be043027652402b32c356e322
---
M include/osmocom/sigtran/osmo_ss7.h
M src/sccp_user.c
M src/sccp_vty.c
3 files changed, 35 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/77/32677/1
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index cd1779c..e025709 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -565,6 +565,8 @@
int local_port, int remote_port,
const char *remote_ip);
+void osmo_sccp_set_max_optional_data(struct osmo_sccp_instance *inst, int val);
+
enum osmo_ss7_as_traffic_mode osmo_ss7_tmode_from_xua(uint32_t in);
int osmo_ss7_tmode_to_xua(enum osmo_ss7_as_traffic_mode tmod);
diff --git a/src/sccp_user.c b/src/sccp_user.c
index 34c663d..a04a1c3 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -827,6 +827,24 @@
return NULL;
}
+/*! Adjust the upper bound for the optional data length (the payload) for CR, CC, CREF
and RLSD messages.
+ * For any Optional Data part larger than this value in octets, send CR, CC, CREF and
RLSD messages without any payload,
+ * and send the data payload in a separate Data Form 1 message. ITU-T Q.713 sections 4.2
thru 4.5 define a limit of 130
+ * bytes for the 'Data' parameter. This limit can be adjusted here. May be useful
for interop with nonstandard SCCP
+ * peers.
+ * \param[in] sccp SCCP instance to reconfigure.
+ * \param[in] val Number of bytes to set as upper bound for the optional data length, or
pass a negative value to set
+ * the standard value of SCCP_MAX_OPTIONAL_DATA == 130, which conforms to
ITU-T Q.713.
+ */
+void osmo_sccp_set_max_optional_data(struct osmo_sccp_instance *inst, int val)
+{
+ if (!inst)
+ return;
+ if (val < 0)
+ val = SCCP_MAX_OPTIONAL_DATA;
+ inst->max_optional_data = val;
+}
+
/*! \brief get the SS7 instance that is related to the given SCCP instance
* \param[in] sccp SCCP instance
* \returns SS7 instance; NULL if sccp was NULL */
diff --git a/src/sccp_vty.c b/src/sccp_vty.c
index 90fb914..dda3ff0 100644
--- a/src/sccp_vty.c
+++ b/src/sccp_vty.c
@@ -183,7 +183,7 @@
int val;
if (!strcmp(argv[0], "standard"))
- val = SCCP_MAX_OPTIONAL_DATA;
+ val = -1;
else
val = atoi(argv[0]);
@@ -193,7 +193,7 @@
return CMD_WARNING;
}
- ss7->sccp->max_optional_data = val;
+ osmo_sccp_set_max_optional_data(ss7->sccp, val);
return CMD_SUCCESS;
}
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-sccp/+/32677
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: If3d22a0f65a7ed0be043027652402b32c356e322
Gerrit-Change-Number: 32677
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange