Harald Welte | faea754 | 2016-12-24 01:21:03 +0100 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | |
| 3 | #include "diag_log.h" |
Harald Welte | 84ec50f | 2016-12-24 10:16:00 +0100 | [diff] [blame] | 4 | #include "protocol/diag_log_gsm.h" |
Harald Welte | faea754 | 2016-12-24 01:21:03 +0100 | [diff] [blame] | 5 | |
| 6 | |
| 7 | static void handle_rr_sig_msg(struct log_hdr *lh, struct msgb *msg) |
| 8 | { |
| 9 | struct diag_gsm_rr_msg *rm = (struct diag_gsm_rr_msg *) msgb_data(msg); |
| 10 | |
| 11 | printf("RR: %02x %02x %u: %s\n", rm->chan_type, rm->msg_type, |
| 12 | rm->length, osmo_hexdump(msgb_data(msg), rm->length)); |
| 13 | } |
| 14 | |
| 15 | static void handle_rr_state_msg(struct log_hdr *lh, struct msgb *msg) |
| 16 | { |
| 17 | struct diag_gsm_rr_state *rrs = (struct diag_gsm_rr_state *) msgb_data(msg); |
| 18 | printf("RR-STATE { state=%s, substate=%u, status=%u, mode=%u }\n", |
| 19 | get_value_string(diag_gsm_rr_st_vals, rrs->state) |
| 20 | , rrs->substate, rrs->status, rrs->mode); |
| 21 | |
| 22 | } |
| 23 | |
| 24 | static const struct diag_log_dispatch_tbl log_tbl[] = { |
| 25 | { GSM(LOG_GSM_RR_SIGNALING_MESSAGE_C), handle_rr_sig_msg }, |
| 26 | { GSM(LOG_GSM_RR_STATE_C), handle_rr_state_msg }, |
| 27 | }; |
| 28 | |
| 29 | static __attribute__((constructor)) void on_dso_load_gsm(void) |
| 30 | { |
| 31 | diag_log_reg_dispatch(log_tbl, ARRAY_SIZE(log_tbl)); |
| 32 | } |