diff options
author | martinm <martinm@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-02-19 22:25:36 +0000 |
---|---|---|
committer | martinm <martinm@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-02-19 22:25:36 +0000 |
commit | 1999dc505f0d87ef9363b6cc7f1697f755398377 (patch) | |
tree | 1c61642de92eed433d6f58ed5c800732bd64cef4 | |
parent | 1e0847760e573310e4fdd2c33e06743b5408139d (diff) |
From Vincent Helfre:
#define some constants, and move constants into header files.
Hopfully this will make it easier for these dissectors to be reused.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27487 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r-- | epan/dissectors/packet-mac-lte.c | 5 | ||||
-rw-r--r-- | epan/dissectors/packet-mac-lte.h | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-pdcp-lte.c | 30 | ||||
-rw-r--r-- | epan/dissectors/packet-pdcp-lte.h | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-rlc-lte.c | 24 | ||||
-rw-r--r-- | epan/dissectors/packet-rlc-lte.h | 22 |
6 files changed, 60 insertions, 39 deletions
diff --git a/epan/dissectors/packet-mac-lte.c b/epan/dissectors/packet-mac-lte.c index d448603d04..9cb2f49bb6 100644 --- a/epan/dissectors/packet-mac-lte.c +++ b/epan/dissectors/packet-mac-lte.c @@ -125,10 +125,7 @@ static int ett_mac_lte_pch = -1; -/* Constants an value strings */ - -#define FDD_RADIO 1 -#define TDD_RADIO 2 +/* Constants and value strings */ static const value_string radio_type_vals[] = { diff --git a/epan/dissectors/packet-mac-lte.h b/epan/dissectors/packet-mac-lte.h index 02d2de4fa7..5407cde487 100644 --- a/epan/dissectors/packet-mac-lte.h +++ b/epan/dissectors/packet-mac-lte.h @@ -22,9 +22,15 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* radioType */ +#define FDD_RADIO 1 +#define TDD_RADIO 2 + +/* direction */ #define DIRECTION_UPLINK 0 #define DIRECTION_DOWNLINK 1 +/* rntiType */ #define NO_RNTI 0 #define P_RNTI 1 #define RA_RNTI 2 diff --git a/epan/dissectors/packet-pdcp-lte.c b/epan/dissectors/packet-pdcp-lte.c index fe90661bcf..65000de007 100644 --- a/epan/dissectors/packet-pdcp-lte.c +++ b/epan/dissectors/packet-pdcp-lte.c @@ -175,16 +175,16 @@ static int ett_pdcp_rohc_dynamic_rtp = -1; static const value_string pdcp_plane_vals[] = { - { Signalling_Plane, "Signalling" }, - { User_Plane, "User" }, + { SIGNALING_PLANE, "Signalling" }, + { USER_PLANE, "User" }, { 0, NULL } }; static const value_string rohc_mode_vals[] = { - { Unidirectional, "Unidirectional" }, - { OptimisticBidirectional, "Optimistic Bidirectional" }, - { ReliableBidirectional, "Reliable Bidirectional" }, + { UNIDIRECTIONAL, "Unidirectional" }, + { OPTIMISTIC_BIDIRECTIONAL, "Optimistic Bidirectional" }, + { RELIABLE_BIDIRECTIONAL, "Reliable Bidirectional" }, { 0, NULL } }; @@ -1239,7 +1239,7 @@ static void show_pdcp_config(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree PROTO_ITEM_SET_GENERATED(ti); /* User-plane-specific fields */ - if (p_pdcp_info->plane == User_Plane) { + if (p_pdcp_info->plane == USER_PLANE) { /* No Header PDU */ ti = proto_tree_add_uint(configuration_tree, hf_pdcp_lte_no_header_pdu, tvb, 0, 0, @@ -1371,7 +1371,7 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /*****************************/ /* Signalling plane messages */ - if (p_pdcp_info->plane == Signalling_Plane) { + if (p_pdcp_info->plane == SIGNALING_PLANE) { guint32 mac; guint32 data_length; @@ -1414,7 +1414,7 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree return; } - else if (p_pdcp_info->plane == User_Plane) { + else if (p_pdcp_info->plane == USER_PLANE) { /**********************************/ /* User-plane messages */ @@ -1429,12 +1429,12 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* Use-plane Data */ /* Number of sequence number bits depends upon config */ - if (p_pdcp_info->seqnum_length == 7) { + if (p_pdcp_info->seqnum_length == PDCP_SN_LENGTH_7_BITS) { seqnum = tvb_get_guint8(tvb, offset) & 0x7f; proto_tree_add_item(pdcp_tree, hf_pdcp_lte_seq_num_7, tvb, offset, 1, FALSE); offset++; } - else if (p_pdcp_info->seqnum_length == 12) { + else if (p_pdcp_info->seqnum_length == PDCP_SN_LENGTH_12_BITS) { proto_item *ti; guint8 reserved_value; @@ -1632,14 +1632,14 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* R-0 begins with 00 */ if (((base_header_byte & 0xc0) == 0) && - (p_pdcp_info->mode == ReliableBidirectional)) { + (p_pdcp_info->mode == RELIABLE_BIDIRECTIONAL)) { offset = dissect_pdcp_r_0_packet(rohc_tree, rohc_ti, tvb, offset, p_pdcp_info, pinfo); } /* R-0-CRC begins with 01 */ else if ((((base_header_byte & 0x40) >> 6) == 1) && - (p_pdcp_info->mode == ReliableBidirectional)) { + (p_pdcp_info->mode == RELIABLE_BIDIRECTIONAL)) { offset = dissect_pdcp_r_0_crc_packet(rohc_tree, rohc_ti, tvb, offset, p_pdcp_info, pinfo); } @@ -1654,7 +1654,7 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree switch (p_pdcp_info->mode) { - case ReliableBidirectional: + case RELIABLE_BIDIRECTIONAL: /* R-1 if !(ipv4 && rand) */ if (!((p_pdcp_info->rohc_ip_version == 4) && (!p_pdcp_info->rnd))) { @@ -1668,8 +1668,8 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree } break; - case Unidirectional: - case OptimisticBidirectional: + case UNIDIRECTIONAL: + case OPTIMISTIC_BIDIRECTIONAL: /* UO-1 if !(ipv4 && rand) */ if (!((p_pdcp_info->rohc_ip_version == 4) && (!p_pdcp_info->rnd))) { diff --git a/epan/dissectors/packet-pdcp-lte.h b/epan/dissectors/packet-pdcp-lte.h index 3b21188ca3..12c5b86d62 100644 --- a/epan/dissectors/packet-pdcp-lte.h +++ b/epan/dissectors/packet-pdcp-lte.h @@ -25,20 +25,22 @@ enum pdcp_plane { - Signalling_Plane=1, - User_Plane=2 + SIGNALING_PLANE = 1, + USER_PLANE = 2 }; enum rohc_mode { - Unidirectional=1, - OptimisticBidirectional=2, - ReliableBidirectional=3 + UNIDIRECTIONAL = 1, + OPTIMISTIC_BIDIRECTIONAL = 2, + RELIABLE_BIDIRECTIONAL = 3 }; #define CID_IN_PDCP_HEADER 0 #define CID_IN_ROHC_PACKET 1 +#define PDCP_SN_LENGTH_7_BITS 7 +#define PDCP_SN_LENGTH_12_BITS 12 /* Info attached to each LTE PDCP/RoHC packet */ typedef struct pdcp_lte_info diff --git a/epan/dissectors/packet-rlc-lte.c b/epan/dissectors/packet-rlc-lte.c index 600e67b675..fac21cad08 100644 --- a/epan/dissectors/packet-rlc-lte.c +++ b/epan/dissectors/packet-rlc-lte.c @@ -101,17 +101,11 @@ static int ett_rlc_lte_extension_part = -1; static const value_string direction_vals[] = { - { 0, "Uplink"}, - { 1, "Downlink"}, + { DIRECTION_UPLINK, "Uplink"}, + { DIRECTION_DOWNLINK, "Downlink"}, { 0, NULL } }; - -#define RLC_TM_MODE 1 -#define RLC_UM_MODE 2 -#define RLC_AM_MODE 4 -#define RLC_PREDEF 8 - static const value_string rlc_mode_short_vals[] = { { RLC_TM_MODE, "TM"}, @@ -132,11 +126,11 @@ static const value_string rlc_mode_vals[] = static const value_string rlc_channel_type_vals[] = { - { 1, "CCCH"}, - { 2, "BCCH"}, - { 3, "PCCH"}, - { 4, "SRB"}, - { 5, "DRB"}, + { CHANNEL_TYPE_CCCH, "CCCH"}, + { CHANNEL_TYPE_BCCH, "BCCH"}, + { CHANNEL_TYPE_PCCH, "PCCH"}, + { CHANNEL_TYPE_SRB, "SRB"}, + { CHANNEL_TYPE_DRB, "DRB"}, { 0, NULL } }; @@ -338,7 +332,7 @@ static void dissect_rlc_lte_um(tvbuff_t *tvb, packet_info *pinfo, /*******************************/ /* Fixed UM header */ - if (p_rlc_lte_info->UMSequenceNumberLength == 5) { + if (p_rlc_lte_info->UMSequenceNumberLength == UM_SN_LENGTH_5_BITS) { /* Framing info (2 bits) */ proto_tree_add_bits_ret_val(um_header_tree, hf_rlc_lte_um_fi, tvb, offset*8, 2, @@ -355,7 +349,7 @@ static void dissect_rlc_lte_um(tvbuff_t *tvb, packet_info *pinfo, &sn, FALSE); offset++; } - else if (p_rlc_lte_info->UMSequenceNumberLength == 10) { + else if (p_rlc_lte_info->UMSequenceNumberLength == UM_SN_LENGTH_10_BITS) { guint8 reserved; proto_item *ti; diff --git a/epan/dissectors/packet-rlc-lte.h b/epan/dissectors/packet-rlc-lte.h index 82fc444718..6ece90b57d 100644 --- a/epan/dissectors/packet-rlc-lte.h +++ b/epan/dissectors/packet-rlc-lte.h @@ -22,6 +22,28 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* rlcMode */ +#define RLC_TM_MODE 1 +#define RLC_UM_MODE 2 +#define RLC_AM_MODE 4 +#define RLC_PREDEF 8 + +/* direction */ +#define DIRECTION_UPLINK 0 +#define DIRECTION_DOWNLINK 1 + +/* priority ? */ + +/* channelType */ +#define CHANNEL_TYPE_CCCH 1 +#define CHANNEL_TYPE_BCCH 2 +#define CHANNEL_TYPE_PCCH 3 +#define CHANNEL_TYPE_SRB 4 +#define CHANNEL_TYPE_DRB 5 + +/* UMSequenceNumberLength */ +#define UM_SN_LENGTH_5_BITS 5 +#define UM_SN_LENGTH_10_BITS 10 /* Info attached to each LTE RLC frame */ typedef struct rlc_lte_info |