mirror of https://gerrit.osmocom.org/libosmocore
Add function gprs_nsvc_state_append
A common function to append the nsvc state from osmo-sgsn or osmo-gbproxy Change-Id: I7f0eaff7329ab98cad792d30b20ab053007aab85
This commit is contained in:
parent
520ebc17d9
commit
f1318fe371
|
@ -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);
|
||||
|
||||
/*! @} */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/*! @} */
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue