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


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

netif: sctp.h: Introduce value_string for enum sctp_sstat_state

This can be used by apps retrieving struct sctp_status through
getsockopt(SCTP_STATUS).
The relevant field is spinfo_state: osmo_sctp_sstat_state_str(st.sstat_state);

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



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

diff --git a/include/osmocom/netif/sctp.h b/include/osmocom/netif/sctp.h
index 374cf6e..9dcb6dd 100644
--- a/include/osmocom/netif/sctp.h
+++ b/include/osmocom/netif/sctp.h
@@ -53,3 +53,8 @@
 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); }
+
+enum sctp_sstat_state;
+extern const struct value_string osmo_sctp_sstat_state_strs[];
+static inline const char *osmo_sctp_sstat_state_str(enum sctp_sstat_state val)
+{ return get_value_string(osmo_sctp_sstat_state_strs, val); }
diff --git a/src/sctp.c b/src/sctp.c
index c725d2f..daa19cf 100644
--- a/src/sctp.c
+++ b/src/sctp.c
@@ -79,3 +79,17 @@
        { SCTP_UNKNOWN,         "UNKNOWN" },
        {}
 };
+
+/* linux/sctp.h enum sctp_sstat_state */
+const struct value_string osmo_sctp_sstat_state_strs[] = {
+       { SCTP_EMPTY,                   "EMPTY" },
+       { SCTP_CLOSED,                  "CLOSED" },
+       { SCTP_COOKIE_WAIT,             "COOKIE_WAIT" },
+       { SCTP_COOKIE_ECHOED,           "COOKIE_ECHOED" },
+       { SCTP_ESTABLISHED,             "ESTABLISHED" },
+       { SCTP_SHUTDOWN_PENDING,        "SHUTDOWN_PENDING" },
+       { SCTP_SHUTDOWN_SENT,           "SHUTDOWN_SENT" },
+       { SCTP_SHUTDOWN_RECEIVED,       "SHUTDOWN_RECEIVED" },
+       { SCTP_SHUTDOWN_ACK_SENT,       "SHUTDOWN_ACK_SENT" },
+       {}
+};

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

Reply via email to