diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-12-08 16:29:30 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-12-08 17:45:20 +0100 |
commit | a7650de412009e8cb43dab29e56cb8f2411fcd6d (patch) | |
tree | 35d17b61f68baf8c6edcdec4e8f9537936ded453 | |
parent | 1810e12df326291cd07c9d9a075a257e826289cb (diff) |
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
-rw-r--r-- | include/osmocom/netif/sctp.h | 5 | ||||
-rw-r--r-- | src/sctp.c | 14 |
2 files changed, 19 insertions, 0 deletions
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 @@ 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); } + +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); } @@ -79,3 +79,17 @@ const struct value_string osmo_sctp_spinfo_state_strs[] = { { SCTP_UNKNOWN, "UNKNOWN" }, { 0, NULL } }; + +/* 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" }, + { 0, NULL } +}; |