diff options
author | Harald Welte <laforge@gnumonks.org> | 2016-12-24 10:16:00 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2016-12-24 10:16:00 +0100 |
commit | 84ec50f90123358a65e481d80045f761a4570003 (patch) | |
tree | 495338a3849c2fefbbc4e7333814e5c13ab72c20 | |
parent | 6fc7f68db856d0115db355ef6fc1ae9a024fcd7e (diff) |
header file restructuring
Move all protocol definitions to protocol/*.h and keep only
definitions related to our implementation as *.h in the top directory.
Also, remove some header files to reduce header file proliferation.
-rw-r--r-- | src/diag_gsm.c | 6 | ||||
-rw-r--r-- | src/diag_gsm.h | 118 | ||||
-rw-r--r-- | src/diag_io.c | 2 | ||||
-rw-r--r-- | src/diag_log.c | 4 | ||||
-rw-r--r-- | src/diag_log.h | 2 | ||||
-rw-r--r-- | src/diag_log_gprs.c | 7 | ||||
-rw-r--r-- | src/diag_log_gsm.c | 3 | ||||
-rw-r--r-- | src/diag_log_qmi.c | 2 | ||||
-rw-r--r-- | src/diag_log_umts.c | 6 | ||||
-rw-r--r-- | src/diag_msg.c | 4 | ||||
-rw-r--r-- | src/gprs_mac.c | 2 | ||||
-rw-r--r-- | src/gprs_rlc.c | 2 | ||||
-rw-r--r-- | src/log_codes_wcdma.h | 8 | ||||
-rw-r--r-- | src/protocol.c | 4 | ||||
-rw-r--r-- | src/protocol/diag_log_gprs_mac.h (renamed from src/gprs_mac.h) | 0 | ||||
-rw-r--r-- | src/protocol/diag_log_gprs_rlc.h (renamed from src/gprs_rlc.h) | 0 | ||||
-rw-r--r-- | src/protocol/diag_log_gsm.h (renamed from src/log_codes_gsm.h) | 117 | ||||
-rw-r--r-- | src/protocol/diag_log_qmi.h (renamed from src/log_codes_qmi.h) | 1 | ||||
-rw-r--r-- | src/protocol/diag_log_wcdma.h (renamed from src/diag_wcdma.h) | 10 | ||||
-rw-r--r-- | src/protocol/diagcmd.h (renamed from src/diagcmd.h) | 0 | ||||
-rw-r--r-- | src/protocol/protocol.h (renamed from src/protocol.h) | 0 | ||||
-rw-r--r-- | src/qxdm-log.c | 4 |
22 files changed, 148 insertions, 154 deletions
diff --git a/src/diag_gsm.c b/src/diag_gsm.c index d74dc5d..a2d0ea4 100644 --- a/src/diag_gsm.c +++ b/src/diag_gsm.c @@ -1,9 +1,9 @@ #include <osmocom/core/utils.h> #include <osmocom/core/msgb.h> -#include "diagcmd.h" -#include "diag_gsm.h" -#include "protocol.h" +#include "protocol/diagcmd.h" +#include "protocol/diag_log_gsm.h" +#include "protocol/protocol.h" const struct value_string diag_gsm_rr_st_vals[] = { { DIAG_RR_ST_INACTIVE, "INACTIVE" }, diff --git a/src/diag_gsm.h b/src/diag_gsm.h deleted file mode 100644 index 8e0afa0..0000000 --- a/src/diag_gsm.h +++ /dev/null @@ -1,118 +0,0 @@ -#pragma once - -#include <stdint.h> - -enum diag_gsm_cmd { - GSM_DIAG_VERNO_F = 0, - GSM_STATUS_F = 1, - GSM_TMC_STATE_RETRIEVAL_F = 2, - GSM_DIAG_CALL_ORIG_F = 3, - GSM_DIAG_CALL_END_F = 4, - GSM_GPRS_LOG_PACKET_REQ_F = 5, - DIAG_GSM_MAX_F = 6, -}; - -/* LOG_GSM_RR_SIGNALING_MESSAGE_C */ -struct diag_gsm_rr_msg { - uint8_t chan_type; - uint8_t msg_type; - uint8_t length; - uint8_t data[0]; -} __attribute__((packed)); - -enum diag_gsm_rr_st { - DIAG_RR_ST_INACTIVE = 0, - DIAG_RR_ST_GOING_ACTIVE = 1, - DIAG_RR_ST_GOING_INACTIVE = 2, - DIAG_RR_ST_CELL_SELECTION = 3, - DIAG_RR_ST_PLMN_LIST_CONSTRUCTION = 4, - DIAG_RR_ST_IDLE = 5, - DIAG_RR_ST_CELL_RESELECTION = 6, - DIAG_RR_ST_CONNECTION_PENDING = 7, - DIAG_RR_ST_CHOOSE_CELL = 8, - DIAG_RR_ST_DATA_TRANSFER = 9, - DIAG_RR_ST_NO_CHANNELS = 10, - DIAG_RR_ST_CONNECTION_RELEASE = 11, - DIAG_RR_ST_EARLY_CAMPED_WAIT_FOR_SI= 12, - DIAG_RR_ST_W2G_INTERRAT_HO_PROGRESS= 13, - DIAG_RR_ST_W2G_INTERRAT_RESELECTION_PROGRESS = 14, - DIAG_RR_ST_W2G_INTERRAT_CC_ORDER_PROGRESS = 15, - DIAG_RR_ST_G2W_INTERRAT_RESELECTION_PROGRESS = 16, - DIAG_RR_ST_WAIT_FOR_EARLY_PSCAN = 17, - DIAG_RR_ST_GRR = 18, - DIAG_RR_ST_G2W_INTERRAT_HO_PROGRESS = 20, - DIAG_RR_ST_BACKGROUND_PLMN_SEARCH = 21, - DIAG_RR_ST_W2G_SERVICE_REDIR_IN_PROGRESS = 22, - DIAG_RR_ST_RESET = 23, - DIAG_RR_ST_W2G_BACKGROUND_PLN_SEARCH = 24, -}; -extern const struct value_string diag_gsm_rr_st_vals[25]; - -/* LOG_GSM_RR_STATE_C */ -struct diag_gsm_rr_state { - uint8_t state; - uint8_t substate; - uint8_t status; - uint8_t mode; -} __attribute__((packed)); - -enum diag_gprs_grr_st { - DIAG_GRR_ST_NULL = 0, - DIAG_GRR_ST_ACQUIRE = 1, - DIAG_GRR_ST_CAMPED = 2, - DIAG_GRR_ST_CONN_PEND = 3, - DIAG_GRR_ST_CELL_RESEL = 4, - DIAG_GRR_ST_CELL_RESEL_G2W = 6, - DIAG_GRR_ST_BG_PLMN_SEARCH = 7, - DIAG_GRR_ST_PCCO = 8, -}; -extern const struct value_string diag_gprs_grr_st_vals[9]; - -/* LOG_GPRS_GRR_STATE_C */ -struct diag_gprs_grr_state { - uint8_t active_state; - uint8_t grr_state; -} __attribute__((packed)); - - -enum diag_gprs_llme_state { - DIAG_GPRS_LLMES_TLLI_UNASS = 0, - DIAG_GPRS_LLMES_TLLI_ASS = 1, - DIAG_GPRS_LLMES_TEST_MODE = 2, -}; -const struct value_string diag_gprs_llme_st_vals[4]; - -/* LOG_GPRS_LLC_ME_INFO_C */ -struct diag_gprs_llme_info { - uint8_t state; - uint8_t xid_version; - uint32_t tlli_new; - uint32_t tlli_old; - uint8_t enc_alg; - uint8_t enc_key[8]; - uint32_t input_offset_iov_ui; -} __attribute__((packed)); - -/* LOG_GPRS_LLC_PDU_STATS_C */ -struct diag_gprs_llc_stats { - uint8_t sapi; - uint32_t ack_l3pdu_tx; - uint32_t ack_octet_tx; - uint32_t ack_l3pdu_retrans; - uint32_t ack_octet_retrans; - uint32_t ack_l3pdu_rx; - uint32_t ack_octet_rx; - uint32_t unack_l3pdu_tx; - uint32_t unack_octet_tx; - uint32_t unack_l3pdu_rx; - uint32_t unack_octet_rx; - uint32_t llpdu_tx; - uint32_t llpdu_rx; - uint32_t llpdu_fcs_err; - uint32_t llpdu_frm_rej; - uint32_t llpdu_tlli_err; - uint32_t llpdu_addr_err; - uint32_t llpdu_short_err; -} __attribute__((packed)); - -struct msgb *diag_gsm_make_log_pack_req(uint16_t log_code, uint8_t zero_stats, uint8_t addl_info); diff --git a/src/diag_io.c b/src/diag_io.c index b8dd18b..f9abd87 100644 --- a/src/diag_io.c +++ b/src/diag_io.c @@ -5,7 +5,7 @@ #include <string.h> #include <unistd.h> -#include "protocol.h" +#include "protocol/protocol.h" #include "diag_io.h" #include "diagchar_hdlc.h" diff --git a/src/diag_log.c b/src/diag_log.c index 1bb3a72..2f0bc79 100644 --- a/src/diag_log.c +++ b/src/diag_log.c @@ -4,8 +4,8 @@ #include <osmocom/core/msgb.h> #include "diag_log.h" -#include "protocol.h" -#include "diagcmd.h" +#include "protocol/protocol.h" +#include "protocol/diagcmd.h" /*********************************************************************** * LOG Configuration / Protocol diff --git a/src/diag_log.h b/src/diag_log.h index 785549e..5c442b8 100644 --- a/src/diag_log.h +++ b/src/diag_log.h @@ -1,7 +1,7 @@ #pragma once #include "diag_io.h" -#include "protocol.h" +#include "protocol/protocol.h" typedef void diag_log_handler(struct log_hdr *lh, struct msgb *msg); diff --git a/src/diag_log_gprs.c b/src/diag_log_gprs.c index f267600..3225d6a 100644 --- a/src/diag_log_gprs.c +++ b/src/diag_log_gprs.c @@ -1,10 +1,9 @@ #include <stdio.h> #include "diag_log.h" -#include "diag_gsm.h" -#include "gprs_rlc.h" -#include "gprs_mac.h" -#include "log_codes_gsm.h" +#include "protocol/diag_log_gsm.h" +#include "protocol/diag_log_gprs_rlc.h" +#include "protocol/diag_log_gprs_mac.h" static void handle_grr_state_msg(struct log_hdr *lh, struct msgb *msg) diff --git a/src/diag_log_gsm.c b/src/diag_log_gsm.c index 791d6c6..cfc96a4 100644 --- a/src/diag_log_gsm.c +++ b/src/diag_log_gsm.c @@ -1,8 +1,7 @@ #include <stdio.h> #include "diag_log.h" -#include "diag_gsm.h" -#include "log_codes_gsm.h" +#include "protocol/diag_log_gsm.h" static void handle_rr_sig_msg(struct log_hdr *lh, struct msgb *msg) diff --git a/src/diag_log_qmi.c b/src/diag_log_qmi.c index b6f7eb5..cc9f0a8 100644 --- a/src/diag_log_qmi.c +++ b/src/diag_log_qmi.c @@ -4,7 +4,7 @@ #include <libqmi-glib.h> #include "diag_log.h" -#include "log_codes_qmi.h" +#include "protocol/diag_log_qmi.h" /* A small wrapper around libqmi-glib to give us a human-readable string * representation of QMI messages that we receive from DIAG */ diff --git a/src/diag_log_umts.c b/src/diag_log_umts.c index c0303b4..1d69648 100644 --- a/src/diag_log_umts.c +++ b/src/diag_log_umts.c @@ -1,8 +1,7 @@ #include <stdio.h> #include "diag_log.h" -#include "diag_wcdma.h" -#include "log_codes_wcdma.h" +#include "protocol/diag_log_wcdma.h" static void handle_rrc_sig_msg(struct log_hdr *lh, struct msgb *msg) { @@ -12,9 +11,6 @@ static void handle_rrc_sig_msg(struct log_hdr *lh, struct msgb *msg) osmo_hexdump(msgb_data(msg), rrm->length)); } -#define UMTS(x) (0x4000 + x) - - static const struct diag_log_dispatch_tbl log_tbl[] = { { UMTS(LOG_WCDMA_SIGNALING_MSG_C), handle_rrc_sig_msg }, }; diff --git a/src/diag_msg.c b/src/diag_msg.c index 646663e..b17106d 100644 --- a/src/diag_msg.c +++ b/src/diag_msg.c @@ -7,9 +7,9 @@ #include <osmocom/core/bit16gen.h> #include <osmocom/core/bit32gen.h> -#include "protocol.h" +#include "protocol/protocol.h" #include "diag_msg.h" -#include "diagcmd.h" +#include "protocol/diagcmd.h" struct diag_set_rt_mask_req { uint8_t cmd_code; diff --git a/src/gprs_mac.c b/src/gprs_mac.c index b2073be..79341f6 100644 --- a/src/gprs_mac.c +++ b/src/gprs_mac.c @@ -1,6 +1,6 @@ #include <osmocom/core/utils.h> -#include "gprs_mac.h" +#include "protocol/diag_log_gprs_mac.h" struct value_string gprs_mac_mode_vals[] = { { NULL_MODE, "NULL" }, diff --git a/src/gprs_rlc.c b/src/gprs_rlc.c index 7ea5437..9e3bed0 100644 --- a/src/gprs_rlc.c +++ b/src/gprs_rlc.c @@ -1,6 +1,6 @@ #include <osmocom/core/utils.h> -#include "gprs_rlc.h" +#include "protocol/diag_log_gprs_rlc.h" struct value_string gprs_rlc_ul_state_vals[8] = { { US_NULL, "US_NULL" }, diff --git a/src/log_codes_wcdma.h b/src/log_codes_wcdma.h deleted file mode 100644 index d19f82f..0000000 --- a/src/log_codes_wcdma.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -enum diag_log_code_umts { - LOG_WCDMA_RRC_STATES_C = 0x125, - LOG_WCDMA_RRC_PROTOCOL_ERRORS_C = 0x126, - LOG_WCDMA_CELL_ID_C = 0x127, - LOG_WCDMA_SIGNALING_MSG_C = 0x12f, -}; diff --git a/src/protocol.c b/src/protocol.c index d89603d..7574227 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -1,6 +1,6 @@ #include <osmocom/core/msgb.h> -#include "protocol.h" -#include "diagcmd.h" +#include "protocol/protocol.h" +#include "protocol/diagcmd.h" int diag_push_subsys_hdr(struct msgb *msg, uint8_t subsys, uint8_t code) { diff --git a/src/gprs_mac.h b/src/protocol/diag_log_gprs_mac.h index cc499b3..cc499b3 100644 --- a/src/gprs_mac.h +++ b/src/protocol/diag_log_gprs_mac.h diff --git a/src/gprs_rlc.h b/src/protocol/diag_log_gprs_rlc.h index d577c8d..d577c8d 100644 --- a/src/gprs_rlc.h +++ b/src/protocol/diag_log_gprs_rlc.h diff --git a/src/log_codes_gsm.h b/src/protocol/diag_log_gsm.h index aba64ab..fb67821 100644 --- a/src/log_codes_gsm.h +++ b/src/protocol/diag_log_gsm.h @@ -1,5 +1,7 @@ #pragma once +#include <stdint.h> + #define GSM(x) (0x5000 + x) enum diag_log_code_gsm { @@ -92,3 +94,118 @@ enum diag_log_code_gsm { LOG_GPRS_DLPTCCH_BURST_METRICS_C = 593, LOG_GPRS_DLPTCCH_MSG_METRICS_C = 594, }; + +enum diag_gsm_cmd { + GSM_DIAG_VERNO_F = 0, + GSM_STATUS_F = 1, + GSM_TMC_STATE_RETRIEVAL_F = 2, + GSM_DIAG_CALL_ORIG_F = 3, + GSM_DIAG_CALL_END_F = 4, + GSM_GPRS_LOG_PACKET_REQ_F = 5, + DIAG_GSM_MAX_F = 6, +}; + +/* LOG_GSM_RR_SIGNALING_MESSAGE_C */ +struct diag_gsm_rr_msg { + uint8_t chan_type; + uint8_t msg_type; + uint8_t length; + uint8_t data[0]; +} __attribute__((packed)); + +enum diag_gsm_rr_st { + DIAG_RR_ST_INACTIVE = 0, + DIAG_RR_ST_GOING_ACTIVE = 1, + DIAG_RR_ST_GOING_INACTIVE = 2, + DIAG_RR_ST_CELL_SELECTION = 3, + DIAG_RR_ST_PLMN_LIST_CONSTRUCTION = 4, + DIAG_RR_ST_IDLE = 5, + DIAG_RR_ST_CELL_RESELECTION = 6, + DIAG_RR_ST_CONNECTION_PENDING = 7, + DIAG_RR_ST_CHOOSE_CELL = 8, + DIAG_RR_ST_DATA_TRANSFER = 9, + DIAG_RR_ST_NO_CHANNELS = 10, + DIAG_RR_ST_CONNECTION_RELEASE = 11, + DIAG_RR_ST_EARLY_CAMPED_WAIT_FOR_SI= 12, + DIAG_RR_ST_W2G_INTERRAT_HO_PROGRESS= 13, + DIAG_RR_ST_W2G_INTERRAT_RESELECTION_PROGRESS = 14, + DIAG_RR_ST_W2G_INTERRAT_CC_ORDER_PROGRESS = 15, + DIAG_RR_ST_G2W_INTERRAT_RESELECTION_PROGRESS = 16, + DIAG_RR_ST_WAIT_FOR_EARLY_PSCAN = 17, + DIAG_RR_ST_GRR = 18, + DIAG_RR_ST_G2W_INTERRAT_HO_PROGRESS = 20, + DIAG_RR_ST_BACKGROUND_PLMN_SEARCH = 21, + DIAG_RR_ST_W2G_SERVICE_REDIR_IN_PROGRESS = 22, + DIAG_RR_ST_RESET = 23, + DIAG_RR_ST_W2G_BACKGROUND_PLN_SEARCH = 24, +}; +extern const struct value_string diag_gsm_rr_st_vals[25]; + +/* LOG_GSM_RR_STATE_C */ +struct diag_gsm_rr_state { + uint8_t state; + uint8_t substate; + uint8_t status; + uint8_t mode; +} __attribute__((packed)); + +enum diag_gprs_grr_st { + DIAG_GRR_ST_NULL = 0, + DIAG_GRR_ST_ACQUIRE = 1, + DIAG_GRR_ST_CAMPED = 2, + DIAG_GRR_ST_CONN_PEND = 3, + DIAG_GRR_ST_CELL_RESEL = 4, + DIAG_GRR_ST_CELL_RESEL_G2W = 6, + DIAG_GRR_ST_BG_PLMN_SEARCH = 7, + DIAG_GRR_ST_PCCO = 8, +}; +extern const struct value_string diag_gprs_grr_st_vals[9]; + +/* LOG_GPRS_GRR_STATE_C */ +struct diag_gprs_grr_state { + uint8_t active_state; + uint8_t grr_state; +} __attribute__((packed)); + + +enum diag_gprs_llme_state { + DIAG_GPRS_LLMES_TLLI_UNASS = 0, + DIAG_GPRS_LLMES_TLLI_ASS = 1, + DIAG_GPRS_LLMES_TEST_MODE = 2, +}; +const struct value_string diag_gprs_llme_st_vals[4]; + +/* LOG_GPRS_LLC_ME_INFO_C */ +struct diag_gprs_llme_info { + uint8_t state; + uint8_t xid_version; + uint32_t tlli_new; + uint32_t tlli_old; + uint8_t enc_alg; + uint8_t enc_key[8]; + uint32_t input_offset_iov_ui; +} __attribute__((packed)); + +/* LOG_GPRS_LLC_PDU_STATS_C */ +struct diag_gprs_llc_stats { + uint8_t sapi; + uint32_t ack_l3pdu_tx; + uint32_t ack_octet_tx; + uint32_t ack_l3pdu_retrans; + uint32_t ack_octet_retrans; + uint32_t ack_l3pdu_rx; + uint32_t ack_octet_rx; + uint32_t unack_l3pdu_tx; + uint32_t unack_octet_tx; + uint32_t unack_l3pdu_rx; + uint32_t unack_octet_rx; + uint32_t llpdu_tx; + uint32_t llpdu_rx; + uint32_t llpdu_fcs_err; + uint32_t llpdu_frm_rej; + uint32_t llpdu_tlli_err; + uint32_t llpdu_addr_err; + uint32_t llpdu_short_err; +} __attribute__((packed)); + +struct msgb *diag_gsm_make_log_pack_req(uint16_t log_code, uint8_t zero_stats, uint8_t addl_info); diff --git a/src/log_codes_qmi.h b/src/protocol/diag_log_qmi.h index 54adce9..d13ed0d 100644 --- a/src/log_codes_qmi.h +++ b/src/protocol/diag_log_qmi.h @@ -1,3 +1,4 @@ +#pragma once #define LOG_QMI_RESERVED_CODES_BASE_C 0x38E #define LOG_QMI_LAST_C (32 + LOG_QMI_RESERVED_CODES_BASE_C) diff --git a/src/diag_wcdma.h b/src/protocol/diag_log_wcdma.h index af4562d..82a631a 100644 --- a/src/diag_wcdma.h +++ b/src/protocol/diag_log_wcdma.h @@ -2,6 +2,15 @@ #include <stdint.h> +#define UMTS(x) (0x4000 + x) + +enum diag_log_code_umts { + LOG_WCDMA_RRC_STATES_C = 0x125, + LOG_WCDMA_RRC_PROTOCOL_ERRORS_C = 0x126, + LOG_WCDMA_CELL_ID_C = 0x127, + LOG_WCDMA_SIGNALING_MSG_C = 0x12f, +}; + enum diag_umts_rrc_chtype { DIAG_UMTS_RRC_CHT_UL_CCCH = 0, DIAG_UMTS_RRC_CHT_DL_DCCH = 1, @@ -19,4 +28,3 @@ struct diag_umts_rrc_msg { uint16_t length; uint8_t msg[0]; } __attribute__((packed)); - diff --git a/src/diagcmd.h b/src/protocol/diagcmd.h index c54d6ad..c54d6ad 100644 --- a/src/diagcmd.h +++ b/src/protocol/diagcmd.h diff --git a/src/protocol.h b/src/protocol/protocol.h index 53b9670..53b9670 100644 --- a/src/protocol.h +++ b/src/protocol/protocol.h diff --git a/src/qxdm-log.c b/src/qxdm-log.c index 4bd5cf2..fceb9db 100644 --- a/src/qxdm-log.c +++ b/src/qxdm-log.c @@ -15,10 +15,10 @@ #include <osmocom/core/serial.h> #include "diag_io.h" -#include "protocol.h" #include "diag_log.h" #include "diag_msg.h" -#include "diagcmd.h" +#include "protocol/protocol.h" +#include "protocol/diagcmd.h" /*********/ |