General cleanup:

- 4-space tabs, trailing whitespace, etc
- use a consistent formatting style
- ...

svn path=/trunk/; revision=42733
This commit is contained in:
Bill Meier 2012-05-21 02:13:49 +00:00
parent ca4a51873e
commit e3ea682270
1 changed files with 1188 additions and 1195 deletions

View File

@ -255,8 +255,8 @@ static const value_string channel_type_vals[] =
{ CHANNEL_IUR_DSCH, "IUR DSCH" },
{ CHANNEL_EDCH, "EDCH" },
{ CHANNEL_RACH_TDD_128, "RACH_TDD_128" },
{ CHANNEL_HSDSCH_COMMON,"HSDSCH-COMMON" },
{ CHANNEL_HSDSCH_COMMON_T3,"HSDSCH-COMMON-T3" },
{ CHANNEL_HSDSCH_COMMON, "HSDSCH-COMMON" },
{ CHANNEL_HSDSCH_COMMON_T3, "HSDSCH-COMMON-T3" },
{ CHANNEL_EDCH_COMMON, "EDCH-COMMON"},
{ 0, NULL }
};
@ -296,22 +296,22 @@ static const value_string paging_indication_vals[] = {
};
static const value_string spreading_factor_vals[] = {
{0, "4"},
{1, "8"},
{2, "16"},
{3, "32"},
{4, "64"},
{5, "128"},
{6, "256"},
{0, NULL }
{ 0, "4"},
{ 1, "8"},
{ 2, "16"},
{ 3, "32"},
{ 4, "64"},
{ 5, "128"},
{ 6, "256"},
{ 0, NULL }
};
static const value_string congestion_status_vals[] = {
{0, "No TNL congestion"},
{1, "Reserved for future use"},
{2, "TNL congestion - detected by delay build-up"},
{3, "TNL congestion - detected by frame loss"},
{0, NULL }
{ 0, "No TNL congestion"},
{ 1, "Reserved for future use"},
{ 2, "TNL congestion - detected by delay build-up"},
{ 3, "TNL congestion - detected by frame loss"},
{ 0, NULL }
};
static const value_string e_rucch_flag_vals[] = {
@ -328,6 +328,7 @@ static const value_string hsdshc_mac_entity_vals[] = {
};
/* TODO: add and use */
#if 0
static const value_string segmentation_status_vals[] = {
{ 0, "" },
{ 1, "" },
@ -335,6 +336,7 @@ static const value_string segmentation_status_vals[] = {
{ 3, "" },
{ 0, NULL }
};
#endif
static const value_string lchid_vals[] = {
{ 0, "Logical Channel 1" },
@ -526,10 +528,6 @@ static void dissect_e_dch_t2_or_common_channel_info(tvbuff_t *tvb, packet_info *
/* Main dissection function */
static void dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
/* Protocol registration */
void proto_register_fp(void);
void proto_reg_handoff_fp(void);
/*
* CRNC sends data downlink on uplink parameters.
*/
@ -537,7 +535,7 @@ void
set_umts_fp_conv_data(conversation_t *conversation, umts_fp_conversation_info_t *umts_fp_conversation_info)
{
if(conversation==NULL)
if (conversation == NULL)
return;
conversation_add_proto_data(conversation, proto_fp, umts_fp_conversation_info);
@ -601,7 +599,7 @@ static int dissect_tb_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
chan+1, n+1, p_fp_info->chan_tf_size[chan]);
}
if (preferences_call_mac_dissectors && data_handle &&
p_fp_info->chan_tf_size[chan] > 0) {
(p_fp_info->chan_tf_size[chan] > 0)) {
tvbuff_t *next_tvb;
next_tvb = tvb_new_subset(tvb, offset + bit_offset/8,
((bit_offset % 8) + p_fp_info->chan_tf_size[chan] + 7) / 8, -1);
@ -811,14 +809,14 @@ static void dissect_spare_extension_and_crc(tvbuff_t *tvb, packet_info *pinfo,
{
int crc_size = 0;
int remain = tvb_length_remaining(tvb, offset);
proto_item *ti = NULL;
/* Payload CRC (optional) */
if (dch_crc_present == 1 || (dch_crc_present == 2 && remain >= 2)) {
if ((dch_crc_present == 1) || ((dch_crc_present == 2) && (remain >= 2))) {
crc_size = 2;
}
if (remain > crc_size) {
proto_item *ti;
ti = proto_tree_add_item(tree, hf_fp_spare_extension, tvb,
offset, remain-crc_size, ENC_NA);
proto_item_append_text(ti, " (%u octets)", remain-crc_size);
@ -839,14 +837,14 @@ static void dissect_spare_extension_and_crc(tvbuff_t *tvb, packet_info *pinfo,
/***********************************************************/
/* Common control message types */
int dissect_common_outer_loop_power_control(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
static int dissect_common_outer_loop_power_control(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
int offset, struct fp_info *p_fp_info _U_)
{
return dissect_dch_outer_loop_power_control(tree, pinfo, tvb, offset);
}
int dissect_common_timing_adjustment(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
static int dissect_common_timing_adjustment(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
int offset, struct fp_info *p_fp_info)
{
if (p_fp_info->channel != CHANNEL_PCH) {
@ -1204,8 +1202,7 @@ static void dissect_common_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree
val_to_str_const(control_frame_type, common_control_frame_type_vals, "Unknown"));
/* Frame-type specific dissection */
switch (control_frame_type)
{
switch (control_frame_type) {
case COMMON_OUTER_LOOP_POWER_CONTROL:
offset = dissect_common_outer_loop_power_control(pinfo, tree, tvb, offset, p_fp_info);
break;
@ -1325,7 +1322,7 @@ static void dissect_rach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_t
/* Info introduced in R6 */
/* only check if it looks as if they are present */
if (((p_fp_info->release == 6) || (p_fp_info->release == 7)) &&
tvb_length_remaining(tvb, offset) > 2)
(tvb_length_remaining(tvb, offset) > 2))
{
int n;
guint8 flags;
@ -1356,8 +1353,7 @@ static void dissect_rach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_t
for (n=0; n < 8; n++) {
switch (n) {
case 6:
switch (p_fp_info->division)
{
switch (p_fp_info->division) {
case Division_FDD:
/* Ext propagation delay */
ext_propagation_delay_present = TRUE;
@ -1379,8 +1375,7 @@ static void dissect_rach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_t
}
break;
case 7:
switch (p_fp_info->division)
{
switch (p_fp_info->division) {
case Division_FDD:
/* Cell Portion ID */
cell_portion_id_present = TRUE;
@ -1431,8 +1426,7 @@ static void dissect_rach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_t
if (ext_rx_timing_deviation_present) {
guint8 extra_bits;
guint bits_to_extend;
switch (p_fp_info->division)
{
switch (p_fp_info->division) {
case Division_TDD_384:
bits_to_extend = 1;
break;
@ -1917,9 +1911,9 @@ static int dissect_dch_rx_timing_deviation(packet_info *pinfo, proto_tree *tree,
tvbuff_t *tvb, int offset,
struct fp_info *p_fp_info)
{
guint16 timing_deviation = 0;
gint timing_deviation_chips = 0;
proto_item *timing_deviation_ti = NULL;
guint16 timing_deviation;
gint timing_deviation_chips;
proto_item *timing_deviation_ti;
/* CFN control */
proto_tree_add_item(tree, hf_fp_cfn_control, tvb, offset, 1, ENC_BIG_ENDIAN);
@ -1951,8 +1945,7 @@ static int dissect_dch_rx_timing_deviation(packet_info *pinfo, proto_tree *tree,
/* Value of bit_offset depends upon division type */
int bit_offset;
switch (p_fp_info->division)
{
switch (p_fp_info->division) {
case Division_TDD_384:
bit_offset = 6;
break;
@ -1983,8 +1976,7 @@ static int dissect_dch_rx_timing_deviation(packet_info *pinfo, proto_tree *tree,
if (extended_bits_present) {
guint8 extra_bits;
guint bits_to_extend;
switch (p_fp_info->division)
{
switch (p_fp_info->division) {
case Division_TDD_384:
bits_to_extend = 1;
break;
@ -2179,8 +2171,7 @@ static void dissect_dch_control_frame(proto_tree *tree, packet_info *pinfo, tvbu
val_to_str_const(control_frame_type,
dch_control_frame_type_vals, "Unknown"));
switch (control_frame_type)
{
switch (control_frame_type) {
case DCH_TIMING_ADJUSTMENT:
offset = dissect_dch_timing_adjustment(tree, pinfo, tvb, offset);
break;
@ -2329,7 +2320,7 @@ static void dissect_e_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_
This was 3 bits in early releases, is 4 bits offset by 1 in later releases */
if ((p_fp_info->release >= 6) &&
((p_fp_info->release_year > 2005) ||
(p_fp_info->release_year == 2005 && p_fp_info->release_month >= 9))) {
((p_fp_info->release_year == 2005) && (p_fp_info->release_month >= 9)))) {
/* Use 4 bits plus offset of 1 */
number_of_subframes = (tvb_get_guint8(tvb, offset) & 0x0f) + 1;
@ -2563,15 +2554,16 @@ static void dissect_e_dch_t2_or_common_channel_info(tvbuff_t *tvb, packet_info *
{
int n;
int pdu_no;
static struct edch_t2_subframe_info subframes[16];
guint64 total_macis_sdus;
guint16 macis_sdus_found = 0;
guint16 macis_pdus = 0;
guint32 total_bytes = 0;
gboolean F = TRUE; /* We want to continue loop if get E-RNTI indication... */
proto_item *subframe_macis_descriptors_ti = NULL;
gint bit_offset;
proto_item *subframe_macis_descriptors_ti = NULL;
static struct edch_t2_subframe_info subframes[16];
/* User Buffer size */
proto_tree_add_bits_item(tree, hf_fp_edch_user_buffer_size, tvb, offset*8,
18, ENC_BIG_ENDIAN);
@ -3125,8 +3117,7 @@ static gboolean heur_dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
return TRUE;
}
static fp_info*
fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_)
static fp_info *fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_)
{
fp_info *fpi;
guint8 tfi;
@ -3147,15 +3138,16 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data, tvbuff
/*fpi->paging_indications;*/
fpi->link_type = FP_Link_Ethernet;
if(pinfo->link_dir==P2P_DIR_UL){
if (pinfo->link_dir==P2P_DIR_UL) {
fpi->is_uplink = TRUE;
}else{
}
else {
fpi->is_uplink = FALSE;
}
is_control_frame = tvb_get_guint8(tvb, offset) & 0x01;
switch(fpi->channel){
switch (fpi->channel) {
case CHANNEL_HSDSCH:
fpi->hsdsch_entity = p_conv_data->hsdsch_entity;
return fpi;
@ -3168,14 +3160,14 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data, tvbuff
/* fall trough */
case CHANNEL_RACH_FDD:
fpi->num_chans = p_conv_data->num_dch_in_flow;
if(is_control_frame){
if (is_control_frame) {
/* control frame, we're done */
return fpi;
}
#if 0
/* For now cheat */
if(p_conv_data->dchs_in_flow_list[0] == 31){
if (p_conv_data->dchs_in_flow_list[0] == 31) {
macinf = se_new0(umts_mac_info);
macinf->ctmux[0] = 1;
macinf->content[0] = MAC_CONTENT_DCCH;
@ -3196,12 +3188,13 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data, tvbuff
offset = 2;
/* Peek at the packet as the per packet info seems not to take the tfi into account */
for(i=0;i<fpi->num_chans;i++){
for (i=0; i<fpi->num_chans; i++) {
tfi = tvb_get_guint8(tvb,offset);
if(pinfo->link_dir==P2P_DIR_UL){
if (pinfo->link_dir==P2P_DIR_UL) {
fpi->chan_tf_size[i] = p_conv_data->fp_dch_chanel_info[i].ul_chan_tf_size[tfi];
fpi->chan_num_tbs[i] = p_conv_data->fp_dch_chanel_info[i].ul_chan_num_tbs[tfi];
}else{
}
else{
fpi->chan_tf_size[i] = p_conv_data->fp_dch_chanel_info[i].dl_chan_tf_size[tfi];
fpi->chan_num_tbs[i] = p_conv_data->fp_dch_chanel_info[i].dl_chan_num_tbs[tfi];
}
@ -3236,13 +3229,13 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data, tvbuff
/*****************************/
/* Main dissection function. */
void dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static void dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *fp_tree;
proto_item *ti;
gint offset = 0;
struct fp_info *p_fp_info;
conversation_t *p_conv = NULL;
conversation_t *p_conv;
umts_fp_conversation_info_t *p_conv_data = NULL;
/* Append this protocol name rather than replace. */
@ -3264,21 +3257,22 @@ void dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (p_conv) {
p_conv_data = conversation_get_proto_data(p_conv, proto_fp);
if (p_conv_data) {
if (ADDRESSES_EQUAL(&(pinfo->net_dst), (&p_conv_data->crnc_address))){
if (ADDRESSES_EQUAL(&(pinfo->net_dst), (&p_conv_data->crnc_address))) {
proto_item* item = proto_tree_add_uint(fp_tree, hf_fp_ul_setup_frame,
tvb, 0, 0, p_conv_data->ul_frame_number);
PROTO_ITEM_SET_GENERATED(item);
/* CRNC -> Node B */
pinfo->link_dir=P2P_DIR_UL;
if (p_fp_info == NULL){
if (p_fp_info == NULL) {
p_fp_info = fp_set_per_packet_inf_from_conv(p_conv_data, tvb, pinfo, fp_tree);
}
}else{
}
else {
proto_item* item = proto_tree_add_uint(fp_tree, hf_fp_ul_setup_frame,
tvb, 0, 0, p_conv_data->ul_frame_number);
PROTO_ITEM_SET_GENERATED(item);
pinfo->link_dir=P2P_DIR_DL;
if (p_fp_info == NULL){
if (p_fp_info == NULL) {
p_fp_info = fp_set_per_packet_inf_from_conv(p_conv_data, tvb, pinfo, fp_tree);
}
}
@ -3325,7 +3319,7 @@ void dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (p_conv_data) {
int i;
col_append_fstr(pinfo->cinfo, COL_INFO, "(%u",p_conv_data->dchs_in_flow_list[0]);
for (i=1; i < p_conv_data->num_dch_in_flow; i++){
for (i=1; i < p_conv_data->num_dch_in_flow; i++) {
col_append_fstr(pinfo->cinfo, COL_INFO, ",%u",p_conv_data->dchs_in_flow_list[i]);
}
col_append_fstr(pinfo->cinfo, COL_INFO, ") ");
@ -3384,8 +3378,7 @@ void dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*************************************/
/* Dissect according to channel type */
switch (p_fp_info->channel)
{
switch (p_fp_info->channel) {
case CHANNEL_RACH_TDD:
case CHANNEL_RACH_TDD_128:
case CHANNEL_RACH_FDD: