diff options
author | Daniel Willmann <dwillmann@sysmocom.de> | 2018-05-29 20:55:18 +0200 |
---|---|---|
committer | Daniel Willmann <dwillmann@sysmocom.de> | 2018-06-14 17:43:31 +0200 |
commit | f1318fe371a1943b8e3dc291a19844e084cbb2c2 (patch) | |
tree | 169d02899d0db8b9abb7a1b60489308391a41dde /src | |
parent | 520ebc17d9351ccd1a053eeb11c769649e4d1fc1 (diff) |
Add function gprs_nsvc_state_append
A common function to append the nsvc state from osmo-sgsn or osmo-gbproxy
Change-Id: I7f0eaff7329ab98cad792d30b20ab053007aab85
Diffstat (limited to 'src')
-rw-r--r-- | src/gb/gprs_ns.c | 22 | ||||
-rw-r--r-- | src/gb/libosmogb.map | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c index 47d170df..75c31415 100644 --- a/src/gb/gprs_ns.c +++ b/src/gb/gprs_ns.c @@ -1705,4 +1705,26 @@ void gprs_ns_set_log_ss(int ss) DNS = ss; } +/*! Append the nsvc state to a talloc string + * \param s The string to append to (allocated with talloc) + * \param[in] nsvc The NS-VC to print the state of + * \returns The new string with state information appended to it + * + * This function will append a comma-separated state of the NS-VC to the + * string. The string needs to be allocated with talloc (e.g. talloc_strdup) + */ +char *gprs_nsvc_state_append(char *s, struct gprs_nsvc *nsvc) +{ + s = talloc_asprintf_append(s, + "%u,%u,%s,%s,%s,%s,%s\n", + nsvc->nsei, nsvc->nsvci, + NS_DESC_A(nsvc->state), + NS_DESC_B(nsvc->state), + nsvc->remote_end_is_sgsn ? "SGSN" : "BSS", + NS_DESC_A(nsvc->remote_state), + NS_DESC_B(nsvc->remote_state)); + + return s; +} + /*! @} */ diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map index 83a36213..d56e6514 100644 --- a/src/gb/libosmogb.map +++ b/src/gb/libosmogb.map @@ -70,6 +70,7 @@ gprs_nsvc_delete; gprs_nsvc_reset; gprs_nsvc_by_nsvci; gprs_nsvc_by_nsei; +gprs_nsvc_state_append; gprs_log_filter_fn; |