From Vincent Helfre:

#define some constants, and move constants into header files.
Hopfully this will make it easier for these dissectors to be reused.

svn path=/trunk/; revision=27487
This commit is contained in:
Martin Mathieson 2009-02-19 22:25:36 +00:00
parent c690a24816
commit 34423cbcc3
6 changed files with 60 additions and 39 deletions

View File

@ -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[] =
{

View File

@ -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

View File

@ -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))) {

View File

@ -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

View File

@ -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;

View File

@ -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