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
This commit is contained in:
Pau Espin 2023-12-08 16:29:30 +01:00
parent 1810e12df3
commit a7650de412
2 changed files with 19 additions and 0 deletions

View File

@ -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); }

View File

@ -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 }
};