Harald Welte | ccea8dd | 2016-12-24 10:27:55 +0100 | [diff] [blame] | 1 | /* Utlity code for GSM related logging */ |
| 2 | /* |
| 3 | * (C) 2013-2016 by Harald Welte <laforge@gnumonks.org> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along |
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | */ |
| 19 | |
Harald Welte | f5d6fee | 2016-01-13 22:29:10 +0100 | [diff] [blame] | 20 | #include <osmocom/core/utils.h> |
| 21 | #include <osmocom/core/msgb.h> |
| 22 | |
Harald Welte | 84ec50f | 2016-12-24 10:16:00 +0100 | [diff] [blame] | 23 | #include "protocol/diagcmd.h" |
| 24 | #include "protocol/diag_log_gsm.h" |
| 25 | #include "protocol/protocol.h" |
Harald Welte | f5d6fee | 2016-01-13 22:29:10 +0100 | [diff] [blame] | 26 | |
| 27 | const struct value_string diag_gsm_rr_st_vals[] = { |
| 28 | { DIAG_RR_ST_INACTIVE, "INACTIVE" }, |
| 29 | { DIAG_RR_ST_GOING_ACTIVE, "GOING_ACTIVE" }, |
| 30 | { DIAG_RR_ST_GOING_INACTIVE, "GOING_INACTIVE" }, |
| 31 | { DIAG_RR_ST_CELL_SELECTION, "CELL_SELECTION" }, |
| 32 | { DIAG_RR_ST_PLMN_LIST_CONSTRUCTION, "PLMN_LIST_CONSTR" }, |
| 33 | { DIAG_RR_ST_IDLE, "IDLE" }, |
| 34 | { DIAG_RR_ST_CELL_RESELECTION, "CELL_RESELECTION" }, |
| 35 | { DIAG_RR_ST_CONNECTION_PENDING, "CONNECTION_PENDING" }, |
| 36 | { DIAG_RR_ST_CHOOSE_CELL, "CHOOSE_CELL" }, |
| 37 | { DIAG_RR_ST_DATA_TRANSFER, "DATA_TRANSFER" }, |
| 38 | { DIAG_RR_ST_NO_CHANNELS, "NO_CHANNELS" }, |
| 39 | { DIAG_RR_ST_CONNECTION_RELEASE, "CONNECTION_RELEASE" }, |
| 40 | { DIAG_RR_ST_EARLY_CAMPED_WAIT_FOR_SI, "EARLY_CAMPED_WAIT_SI" }, |
| 41 | { DIAG_RR_ST_W2G_INTERRAT_HO_PROGRESS, "IRAT_W2G_HO_PROGRESS" }, |
| 42 | { DIAG_RR_ST_W2G_INTERRAT_RESELECTION_PROGRESS, "IRAT_W2G_RESEL_PROGRESS" }, |
| 43 | { DIAG_RR_ST_W2G_INTERRAT_CC_ORDER_PROGRESS, "IRAT_W2G_CC_ORDER_PROGRESS" }, |
| 44 | { DIAG_RR_ST_G2W_INTERRAT_RESELECTION_PROGRESS, "IRAT_G2W_RESEL_PROGRESS" }, |
| 45 | { DIAG_RR_ST_WAIT_FOR_EARLY_PSCAN, "WAIT_FOR_EARLY_PSCAN" }, |
| 46 | { DIAG_RR_ST_GRR, "GRR" }, |
| 47 | { DIAG_RR_ST_G2W_INTERRAT_HO_PROGRESS, "IRAT_G2W_HO_PROGRESS" }, |
| 48 | { DIAG_RR_ST_BACKGROUND_PLMN_SEARCH, "BGROUND_PLMN_SEARCH" }, |
| 49 | { DIAG_RR_ST_W2G_SERVICE_REDIR_IN_PROGRESS, "W2G_SERVICE_REDIR_PROGRESS" }, |
| 50 | { DIAG_RR_ST_RESET, "RESET" }, |
| 51 | { DIAG_RR_ST_W2G_BACKGROUND_PLN_SEARCH, "W2G_BGROUND_PLMN_SEARCH" }, |
| 52 | { 0, NULL } |
| 53 | }; |
| 54 | |
| 55 | const struct value_string diag_gprs_grr_st_vals[] = { |
| 56 | { DIAG_GRR_ST_NULL, "NULL" }, |
| 57 | { DIAG_GRR_ST_ACQUIRE, "ACQUIRE" }, |
| 58 | { DIAG_GRR_ST_CAMPED, "CAMPED" }, |
| 59 | { DIAG_GRR_ST_CONN_PEND, "CONN_PEND" }, |
| 60 | { DIAG_GRR_ST_CELL_RESEL, "CELL_RESEL" }, |
| 61 | { DIAG_GRR_ST_CELL_RESEL_G2W, "CELL_RESEL_G2W" }, |
| 62 | { DIAG_GRR_ST_BG_PLMN_SEARCH, "BG_PLMNN_SEARCH" }, |
| 63 | { DIAG_GRR_ST_PCCO, "PCCO" }, |
| 64 | { 0, NULL } |
| 65 | }; |
| 66 | |
| 67 | const struct value_string diag_gprs_llme_st_vals[] = { |
| 68 | { DIAG_GPRS_LLMES_TLLI_UNASS, "TLLI_UNASSIGNED" }, |
| 69 | { DIAG_GPRS_LLMES_TLLI_ASS, "TLLI_ASSIGNED" }, |
| 70 | { DIAG_GPRS_LLMES_TEST_MODE, "TEST_MODE" }, |
| 71 | { 0, NULL } |
| 72 | }; |
| 73 | |
| 74 | |
| 75 | |
| 76 | /* GSM_GPRS_LOG_PACKET_REQ_F */ |
| 77 | struct diag_gsm_log_packet_req { |
| 78 | uint16_t code; |
| 79 | uint8_t zero_stats; |
| 80 | uint8_t addl_info; |
| 81 | } __attribute__((packed)); |
| 82 | |
Harald Welte | 234b56b | 2016-12-23 23:44:19 +0100 | [diff] [blame] | 83 | struct msgb *diag_gsm_make_log_pack_req(uint16_t log_code, uint8_t zero_stats, uint8_t addl_info) |
Harald Welte | f5d6fee | 2016-01-13 22:29:10 +0100 | [diff] [blame] | 84 | { |
| 85 | struct msgb *msg = msgb_alloc_headroom(1024, 128, "GSM Log Packet Req"); |
| 86 | struct diag_gsm_log_packet_req *glpr; |
| 87 | |
| 88 | glpr = (struct diag_gsm_log_packet_req *) msgb_put(msg, sizeof(*glpr)); |
| 89 | glpr->code = log_code; |
| 90 | glpr->zero_stats = zero_stats; |
| 91 | glpr->addl_info = addl_info; |
| 92 | diag_push_subsys_hdr(msg, DIAG_SUBSYS_GSM, GSM_GPRS_LOG_PACKET_REQ_F); |
| 93 | |
| 94 | return msg; |
| 95 | } |