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


Change subject: netif: sctp.h: Introduce value_string for enum sctp_spinfo_state
......................................................................

netif: sctp.h: Introduce value_string for enum sctp_spinfo_state

This can be used by apps retrieving struct sctp_paddrinfo through
getsockopt(SCTP_GET_PEER_ADDR_INFO).
The relevant field is spinfo_state: 
osmo_sctp_spinfo_state_str(pinfo.spinfo_state);

Related: SYS#6636
Change-Id: I78a0bd8279a04f4011c7273e0f542981308e482f
---
M include/osmocom/netif/sctp.h
M src/sctp.c
2 files changed, 29 insertions(+), 0 deletions(-)



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

diff --git a/include/osmocom/netif/sctp.h b/include/osmocom/netif/sctp.h
index bb8acda..374cf6e 100644
--- a/include/osmocom/netif/sctp.h
+++ b/include/osmocom/netif/sctp.h
@@ -48,3 +48,8 @@
 extern const struct value_string osmo_sctp_op_error_strs[];
 static inline const char *osmo_sctp_op_error_str(enum osmo_sctp_op_error val)
 { return get_value_string(osmo_sctp_op_error_strs, val); }
+
+enum sctp_spinfo_state;
+extern const struct value_string osmo_sctp_spinfo_state_strs[];
+static inline const char *osmo_sctp_spinfo_state_str(enum sctp_spinfo_state 
val)
+{ return get_value_string(osmo_sctp_spinfo_state_strs, val); }
diff --git a/src/sctp.c b/src/sctp.c
index 7f4f54b..a81077e 100644
--- a/src/sctp.c
+++ b/src/sctp.c
@@ -69,3 +69,13 @@
        { OSMO_SCTP_OP_ERR_PROTO_VERSION,       "Protocol Violation" },
        { 0, NULL }
 };
+
+/* linux/sctp.h enum sctp_spinfo_state */
+const struct value_string osmo_sctp_spinfo_state_strs[] = {
+       { SCTP_INACTIVE,                "INACTIVE" },
+       { SCTP_POTENTIALLY_FAILED,      "POTENTIALLY_FAILED" },
+       { SCTP_ACTIVE,                  "ACTIVE" },
+       { SCTP_UNCONFIRMED,             "UNCONFIRMED" },
+       { SCTP_UNKNOWN,                 "UNKNOWN" },
+       {}
+};

--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35280?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: I78a0bd8279a04f4011c7273e0f542981308e482f
Gerrit-Change-Number: 35280
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pes...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to