diff options
| -rw-r--r-- | include/osmocom/gprs/gprs_ns.h | 2 | ||||
| -rw-r--r-- | src/gb/gprs_ns.c | 22 | ||||
| -rw-r--r-- | src/gb/libosmogb.map | 1 | 
3 files changed, 25 insertions, 0 deletions
diff --git a/include/osmocom/gprs/gprs_ns.h b/include/osmocom/gprs/gprs_ns.h index b368ad99..7b95099c 100644 --- a/include/osmocom/gprs/gprs_ns.h +++ b/include/osmocom/gprs/gprs_ns.h @@ -226,4 +226,6 @@ struct ns_signal_data {  void gprs_ns_set_log_ss(int ss); +char *gprs_nsvc_state_append(char *s, struct gprs_nsvc *nsvc); +  /*! @} */ 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;  | 
