diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-12-08 15:43:11 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-12-08 17:45:07 +0100 |
commit | 1810e12df326291cd07c9d9a075a257e826289cb (patch) | |
tree | 7bb9a9328f5bc9a2cb9b18a201bfa8ea03485f5f | |
parent | 14dd5ba3297fbc794b09fd6776d40490296f3c94 (diff) |
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
-rw-r--r-- | include/osmocom/netif/sctp.h | 5 | ||||
-rw-r--r-- | src/sctp.c | 10 |
2 files changed, 15 insertions, 0 deletions
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 @@ enum osmo_sctp_op_error { 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); } @@ -69,3 +69,13 @@ const struct value_string osmo_sctp_op_error_strs[] = { { 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_PF, "POTENTIALLY_FAILED" }, + { SCTP_ACTIVE, "ACTIVE" }, + { SCTP_UNCONFIRMED, "UNCONFIRMED" }, + { SCTP_UNKNOWN, "UNKNOWN" }, + { 0, NULL } +}; |