Harald Welte | ccea8dd | 2016-12-24 10:27:55 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * (C) 2013-2016 by Harald Welte <laforge@gnumonks.org> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along |
| 15 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 17 | */ |
| 18 | |
Harald Welte | faea754 | 2016-12-24 01:21:03 +0100 | [diff] [blame] | 19 | #include <stdio.h> |
| 20 | |
| 21 | #include "diag_log.h" |
Harald Welte | 84ec50f | 2016-12-24 10:16:00 +0100 | [diff] [blame] | 22 | #include "protocol/diag_log_gsm.h" |
Harald Welte | faea754 | 2016-12-24 01:21:03 +0100 | [diff] [blame] | 23 | |
| 24 | |
| 25 | static void handle_rr_sig_msg(struct log_hdr *lh, struct msgb *msg) |
| 26 | { |
| 27 | struct diag_gsm_rr_msg *rm = (struct diag_gsm_rr_msg *) msgb_data(msg); |
| 28 | |
| 29 | printf("RR: %02x %02x %u: %s\n", rm->chan_type, rm->msg_type, |
| 30 | rm->length, osmo_hexdump(msgb_data(msg), rm->length)); |
| 31 | } |
| 32 | |
| 33 | static void handle_rr_state_msg(struct log_hdr *lh, struct msgb *msg) |
| 34 | { |
| 35 | struct diag_gsm_rr_state *rrs = (struct diag_gsm_rr_state *) msgb_data(msg); |
| 36 | printf("RR-STATE { state=%s, substate=%u, status=%u, mode=%u }\n", |
| 37 | get_value_string(diag_gsm_rr_st_vals, rrs->state) |
| 38 | , rrs->substate, rrs->status, rrs->mode); |
| 39 | |
| 40 | } |
| 41 | |
| 42 | static const struct diag_log_dispatch_tbl log_tbl[] = { |
| 43 | { GSM(LOG_GSM_RR_SIGNALING_MESSAGE_C), handle_rr_sig_msg }, |
| 44 | { GSM(LOG_GSM_RR_STATE_C), handle_rr_state_msg }, |
| 45 | }; |
| 46 | |
| 47 | static __attribute__((constructor)) void on_dso_load_gsm(void) |
| 48 | { |
| 49 | diag_log_reg_dispatch(log_tbl, ARRAY_SIZE(log_tbl)); |
| 50 | } |