add functions to print human-readable state names

This commit is contained in:
Harald Welte 2010-07-17 18:49:24 +02:00
parent 363796ba5b
commit b6ac5eb1fe
2 changed files with 34 additions and 0 deletions

View File

@ -1,6 +1,8 @@
#include <osmocore/linuxlist.h>
#include <osmocore/talloc.h>
#include <osmocore/utils.h>
#include <osmocore/logging.h>
#include "tcap.h"
@ -101,3 +103,33 @@ uint32_t tcap_trans_id_alloc(void)
return trans_id;
}
static const struct value_string trans_state_name[] = {
{ TCAP_TS_INVALID, "TS-Invalid" },
{ TCAP_TS_IDLE, "TS-Idle" },
{ TCAP_TS_INIT_RECV, "TS-Initiation-Received" },
{ TCAP_TS_INIT_SENT, "TS-Initiation-Sent" },
{ TCAP_TS_ACTIVE, "TS-Active" },
{ 0, NULL }
};
static const struct value_string inv_state_name[] = {
{ TCAP_IS_INVALID, "IS-Invalid" },
{ TCAP_IS_IDLE, "IS-Idle" },
{ TCAP_IS_OP_SENT_CL1, "IS-Operation-Sent-CL1" },
{ TCAP_IS_OP_SENT_CL2, "IS-Operation-Sent-CL2" },
{ TCAP_IS_OP_SENT_CL3, "IS-Operation-Sent-CL3" },
{ TCAP_IS_OP_SENT_CL4, "IS-Operation-Sent-CL4" },
{ TCAP_IS_WAIT_REJECT, "IS-Wait-Reject" },
{ 0, NULL }
};
const char *tcap_trans_state_name(enum tcap_transaction_state ts)
{
return get_value_string(trans_state_name, ts);
}
const char *tcap_inv_state_name(enum tcap_invocation_state is)
{
return get_value_string(inv_state_name, is);
}

View File

@ -209,6 +209,8 @@ struct tcap_transaction *tcap_transaction_alloc(void);
struct tcap_transaction *tcap_transaction_by_remote_tid(uint32_t tid_remote);
struct tcap_transaction *tcap_transaction_by_local_tid(uint32_t tid_local);
uint32_t tcap_trans_id_alloc(void);
const char *tcap_trans_state_name(enum tcap_transaction_state ts);
const char *tcap_inv_state_name(enum tcap_invocation_state is);
/* scXp.c */