pespin has uploaded this change for review.

View Change

mtp: Improve Network Indicator definitions

Change-Id: I0a7e113ac89946e5cf3bec8bec07ad10ee38723d
---
M TODO-RELEASE
M include/osmocom/sigtran/mtp_sap.h
M include/osmocom/sigtran/protocol/mtp.h
M src/ss7_vty.c
4 files changed, 19 insertions(+), 9 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/02/41402/1
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 2d94ad1..a89255b 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -8,3 +8,4 @@
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
libosmo-netif >1.6.0 stream OSMO_STREAM_{CLI,SRV}_TCP_SOCKOPT_KEEP*
+libosmo-sigtran add enum mtp_network_indicator, mtp_network_indicator_vals
diff --git a/include/osmocom/sigtran/mtp_sap.h b/include/osmocom/sigtran/mtp_sap.h
index 0ae8592..05308c2 100644
--- a/include/osmocom/sigtran/mtp_sap.h
+++ b/include/osmocom/sigtran/mtp_sap.h
@@ -31,6 +31,7 @@
OSMO_MTP_PRIM_STATUS,
};

+/* ITU Q.704 14.2 Service information octet. See enum mtp_si_ni00 in mtp.h. */
#define MTP_SIO(service, net_ind) (((net_ind & 0x3) << 6) | (service & 0xF))

struct osmo_mtp_transfer_param {
diff --git a/include/osmocom/sigtran/protocol/mtp.h b/include/osmocom/sigtran/protocol/mtp.h
index 9654a66..21e3d60 100644
--- a/include/osmocom/sigtran/protocol/mtp.h
+++ b/include/osmocom/sigtran/protocol/mtp.h
@@ -21,9 +21,17 @@
MTP_SI_BICC = 13,
MTP_SI_GCP = 14,
};
-
extern const struct value_string mtp_si_vals[];

+/* Q.704 14.2.2 Sub-service field (Network Indicator) */
+enum mtp_network_indicator {
+ MTP_NI_INTERNATIONAL = 0,
+ MTP_NI_SPARE_INTERNATIONAL = 1,
+ MTP_NI_NATIONAL = 2,
+ MTP_NI_RESERVED_NATIONAL = 3
+};
+extern const struct value_string mtp_network_indicator_vals[];
+

/* Q.704 15.17.5 */
enum mtp_unavail_cause {
diff --git a/src/ss7_vty.c b/src/ss7_vty.c
index b333c7f..cfc658d 100644
--- a/src/ss7_vty.c
+++ b/src/ss7_vty.c
@@ -107,11 +107,11 @@
return CMD_SUCCESS;
}

-static const struct value_string ss7_network_indicator_vals[] = {
- { 0, "international" },
- { 1, "spare" },
- { 2, "national" },
- { 3, "reserved" },
+const struct value_string mtp_network_indicator_vals[] = {
+ { MTP_NI_INTERNATIONAL, "international" },
+ { MTP_NI_SPARE_INTERNATIONAL, "spare" },
+ { MTP_NI_NATIONAL, "national" },
+ { MTP_NI_RESERVED_NATIONAL, "reserved" },
{ 0, NULL }
};

@@ -126,7 +126,7 @@
CMD_ATTR_IMMEDIATE)
{
struct osmo_ss7_instance *inst = vty->index;
- int ni = get_string_value(ss7_network_indicator_vals, argv[0]);
+ int ni = get_string_value(mtp_network_indicator_vals, argv[0]);

inst->cfg.network_indicator = ni;
return CMD_SUCCESS;
@@ -1286,9 +1286,9 @@
vty_out(vty, "cs7 instance %u%s", inst->cfg.id, VTY_NEWLINE);
if (inst->cfg.description)
vty_out(vty, " description %s%s", inst->cfg.description, VTY_NEWLINE);
- if (inst->cfg.network_indicator)
+ if (inst->cfg.network_indicator != MTP_NI_INTERNATIONAL)
vty_out(vty, " network-indicator %s%s",
- get_value_string(ss7_network_indicator_vals,
+ get_value_string(mtp_network_indicator_vals,
inst->cfg.network_indicator),
VTY_NEWLINE);


To view, visit change 41402. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I0a7e113ac89946e5cf3bec8bec07ad10ee38723d
Gerrit-Change-Number: 41402
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>