decode L2 channel type

This commit is contained in:
Harald Welte 2017-01-21 11:15:50 +01:00
parent 0512d9d266
commit 1570b9f38b
3 changed files with 31 additions and 4 deletions

View File

@ -127,6 +127,18 @@ const struct value_string diag_gsm_l2_event_vals[] = {
{ 0, NULL }
};
const struct value_string diag_gsm_l2_chantype_vals[] = {
{ DIAG_L2_CHT_DCCH, "DCCH" },
{ DIAG_L2_CHT_BCCH, "BCCH" },
{ DIAG_L2_CHT_L2_RACH, "RACH" },
{ DIAG_L2_CHT_CCCH, "CCCH" },
{ DIAG_L2_CHT_SACCH, "SACCH" },
{ DIAG_L2_CHT_SDCCH, "SDCCH" },
{ DIAG_L2_CHT_FACCH_F, "FACCH/F" },
{ DIAG_L2_CHT_FACCH_H, "FACCH/H" },
{ 0, NULL }
};
/* GSM_GPRS_LOG_PACKET_REQ_F */
struct diag_gsm_log_packet_req {
uint16_t code;

View File

@ -26,8 +26,9 @@ static void handle_rr_sig_msg(struct log_hdr *lh, struct msgb *msg)
{
struct diag_gsm_rr_msg *rm = (struct diag_gsm_rr_msg *) msgb_data(msg);
printf("RR: %02x %02x %u: %s\n", rm->chan_type, rm->msg_type,
rm->length, osmo_hexdump(msgb_data(msg), rm->length));
printf("RR: %s %02x %u: %s\n",
get_value_string(diag_gsm_l2_chantype_vals, rm->chan_type & 0x7f),
rm->msg_type, rm->length, osmo_hexdump(msgb_data(msg), rm->length));
}
static void handle_rr_state_msg(struct log_hdr *lh, struct msgb *msg)
@ -84,8 +85,10 @@ static void handle_l2_transm_status(struct log_hdr *lh, struct msgb *msg)
{
struct diag_gsm_l2_transm_status *lts = (struct diag_gsm_l2_transm_status *) msgb_data(msg);
printf("L2-TRANSM-STATUS { sapi=%u, chan_type=%u, vs=%u, va=%u, vr=%u, retrans_ctr=%u, seq_err=%u, frame_type=%u, msg_entries=%u, seg_entries=%u }\n",
lts->sapi, lts->channel_type, lts->vs, lts->va, lts->vr, lts->retrans_ctr,
printf("L2-TRANSM-STATUS { sapi=%u, chan_type=%s, vs=%u, va=%u, vr=%u, retrans_ctr=%u, seq_err=%u, frame_type=%u, msg_entries=%u, seg_entries=%u }\n",
lts->sapi,
get_value_string(diag_gsm_l2_chantype_vals, lts->channel_type),
lts->vs, lts->va, lts->vr, lts->retrans_ctr,
lts->seq_err, lts->frame_type, lts->msg_entries, lts->seg_entries);
}

View File

@ -333,6 +333,18 @@ struct diag_gsm_l2_state {
uint8_t l2_event;
} __attribute__ ((packed));
enum diag_gsm_l2_chantype {
DIAG_L2_CHT_DCCH = 0,
DIAG_L2_CHT_BCCH = 1,
DIAG_L2_CHT_L2_RACH = 2,
DIAG_L2_CHT_CCCH = 3,
DIAG_L2_CHT_SACCH = 4,
DIAG_L2_CHT_SDCCH = 5,
DIAG_L2_CHT_FACCH_F = 6,
DIAG_L2_CHT_FACCH_H = 7,
};
const struct value_string diag_gsm_l2_chantype_vals[9];
struct diag_gsm_l2_transm_status {
uint8_t sapi;
uint8_t channel_type;