diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:53 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:53 +0000 |
commit | a86c5f7cae7ec9a3398300555a0b644689d946a1 (patch) | |
tree | 39fe4b107c71174fd1e8a8ceb9a4d2aa14116248 /epan/dissectors/packet-iuup.c | |
parent | Releasing progress-linux version 4.2.6-1~progress7.99u1. (diff) | |
download | wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.tar.xz wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.zip |
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/packet-iuup.c')
-rw-r--r-- | epan/dissectors/packet-iuup.c | 273 |
1 files changed, 126 insertions, 147 deletions
diff --git a/epan/dissectors/packet-iuup.c b/epan/dissectors/packet-iuup.c index c7a90eef..19d5eafe 100644 --- a/epan/dissectors/packet-iuup.c +++ b/epan/dissectors/packet-iuup.c @@ -32,125 +32,104 @@ void proto_reg_handoff_iuup(void); void proto_register_iuup(void); typedef struct _iuup_rfci_t { - guint id; - guint sum_len; - guint num_of_subflows; + unsigned id; + unsigned sum_len; + unsigned num_of_subflows; struct { - guint len; + unsigned len; } subflow[8]; struct _iuup_rfci_t* next; } iuup_rfci_t; typedef struct { - guint32 id; - guint num_of_subflows; + uint32_t id; + unsigned num_of_subflows; iuup_rfci_t* rfcis; iuup_rfci_t* last_rfci; } iuup_circuit_t; -static int proto_iuup = -1; +static int proto_iuup; -static int hf_iuup_direction = -1; -static int hf_iuup_circuit_id = -1; +static int hf_iuup_direction; +static int hf_iuup_circuit_id; -static int hf_iuup_pdu_type = -1; -static int hf_iuup_frame_number = -1; -static int hf_iuup_fqc = -1; -static int hf_iuup_rfci = -1; -static int hf_iuup_hdr_crc = -1; -static int hf_iuup_payload_crc = -1; +static int hf_iuup_pdu_type; +static int hf_iuup_frame_number; +static int hf_iuup_fqc; +static int hf_iuup_rfci; +static int hf_iuup_hdr_crc; +static int hf_iuup_payload_crc; -static int hf_iuup_ack_nack = -1; -static int hf_iuup_frame_number_t14 = -1; -static int hf_iuup_mode_version = -1; -static int hf_iuup_procedure_indicator = -1; -static int hf_iuup_error_cause_val = -1; +static int hf_iuup_ack_nack; +static int hf_iuup_frame_number_t14; +static int hf_iuup_mode_version; +static int hf_iuup_procedure_indicator; +static int hf_iuup_error_cause_val; -static int hf_iuup_init_ti = -1; -static int hf_iuup_init_subflows_per_rfci = -1; -static int hf_iuup_init_chain_ind = -1; +static int hf_iuup_init_ti; +static int hf_iuup_init_subflows_per_rfci; +static int hf_iuup_init_chain_ind; -static int hf_iuup_error_distance = -1; -static int hf_iuup_errorevt_cause_val = -1; +static int hf_iuup_error_distance; +static int hf_iuup_errorevt_cause_val; -static int hf_iuup_time_align = -1; -static int hf_iuup_spare_bytes = -1; -static int hf_iuup_spare_03 = -1; -/* static int hf_iuup_spare_0f = -1; */ -/* static int hf_iuup_spare_c0 = -1; */ -static int hf_iuup_spare_e0 = -1; -static int hf_iuup_spare_ff = -1; +static int hf_iuup_time_align; +static int hf_iuup_spare_bytes; +static int hf_iuup_spare_03; +/* static int hf_iuup_spare_0f; */ +/* static int hf_iuup_spare_c0; */ +static int hf_iuup_spare_e0; +static int hf_iuup_spare_ff; -static int hf_iuup_delay = -1; -static int hf_iuup_advance = -1; -static int hf_iuup_delta = -1; +static int hf_iuup_delay; +static int hf_iuup_advance; +static int hf_iuup_delta; -static int hf_iuup_mode_versions = -1; -static int hf_iuup_mode_versions_a[] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; +static int hf_iuup_mode_versions; +static int hf_iuup_mode_versions_a[16]; -static int hf_iuup_data_pdu_type = -1; +static int hf_iuup_data_pdu_type; -static int hf_iuup_num_rfci_ind = -1; +static int hf_iuup_num_rfci_ind; -static int hf_iuup_payload = -1; +static int hf_iuup_payload; -static int hf_iuup_init_rfci_ind = -1; -static int hf_iuup_init_rfci[] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; +static int hf_iuup_init_rfci_ind; +static int hf_iuup_init_rfci[64]; -static int hf_iuup_init_rfci_flow_len[64][8] = { - {-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1}, - {-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1}, - {-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1}, - {-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},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-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1,-1,-1,-1} -}; - -static int hf_iuup_rfci_ratectl[] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; +static int hf_iuup_init_rfci_flow_len[64][8]; +static int hf_iuup_init_rfci_li[64]; +static int hf_iuup_init_rfci_lri[64]; +static int hf_iuup_init_ipti[64]; +static int hf_iuup_rfci_subflow[64][8]; +static int hf_iuup_rfci_ratectl[64]; -static gint ett_iuup = -1; -static gint ett_rfci = -1; -static gint ett_ipti = -1; -static gint ett_support = -1; -static gint ett_time = -1; -static gint ett_rfciinds = -1; -static gint ett_payload = -1; -static gint ett_payload_subflows = -1; +static int ett_iuup; +static int ett_rfci; +static int ett_ipti; +static int ett_support; +static int ett_time; +static int ett_rfciinds; +static int ett_payload; +static int ett_payload_subflows; -static expert_field ei_iuup_hdr_crc_bad = EI_INIT; -static expert_field ei_iuup_payload_crc_bad = EI_INIT; -static expert_field ei_iuup_payload_undecoded = EI_INIT; -static expert_field ei_iuup_error_response = EI_INIT; -static expert_field ei_iuup_ack_nack = EI_INIT; -static expert_field ei_iuup_time_align = EI_INIT; -static expert_field ei_iuup_procedure_indicator = EI_INIT; -static expert_field ei_iuup_pdu_type = EI_INIT; +static expert_field ei_iuup_hdr_crc_bad; +static expert_field ei_iuup_payload_crc_bad; +static expert_field ei_iuup_payload_undecoded; +static expert_field ei_iuup_error_response; +static expert_field ei_iuup_ack_nack; +static expert_field ei_iuup_time_align; +static expert_field ei_iuup_procedure_indicator; +static expert_field ei_iuup_pdu_type; -static wmem_map_t* circuits = NULL; +static wmem_map_t* circuits; static dissector_handle_t iuup_handle; -static gboolean dissect_fields = FALSE; -static gboolean two_byte_pseudoheader = FALSE; +static bool dissect_fields; +static bool two_byte_pseudoheader; #define PDUTYPE_DATA_WITH_CRC 0 #define PDUTYPE_DATA_NO_CRC 1 @@ -312,16 +291,16 @@ static const value_string iuup_fqcs[] = { static proto_item* -iuup_proto_tree_add_bits(proto_tree* tree, int hf, tvbuff_t* tvb, int offset, int bit_offset, guint bits, guint8** buf) { - static const guint8 masks[] = {0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe}; +iuup_proto_tree_add_bits(packet_info *pinfo, proto_tree* tree, int hf, tvbuff_t* tvb, int offset, int bit_offset, unsigned bits, uint8_t** buf) { + static const uint8_t masks[] = {0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe}; int len = (bits + bit_offset)/8 + (((bits + bit_offset)%8) ? 0 : 1); - guint8* shifted_buffer; + uint8_t* shifted_buffer; proto_item* pi; int i; DISSECTOR_ASSERT(bit_offset < 8); - shifted_buffer = (guint8 *)tvb_memdup(wmem_packet_scope(),tvb,offset,len+1); + shifted_buffer = (uint8_t *)tvb_memdup(pinfo->pool,tvb,offset,len+1); for(i = 0; i < len; i++) { shifted_buffer[i] <<= bit_offset; @@ -340,11 +319,11 @@ iuup_proto_tree_add_bits(proto_tree* tree, int hf, tvbuff_t* tvb, int offset, in return pi; } -static void dissect_iuup_payload(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint rfci_id, int offset, guint32 circuit_id) { +static void dissect_iuup_payload(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, unsigned rfci_id, int offset, uint32_t circuit_id) { iuup_circuit_t* iuup_circuit; iuup_rfci_t *rfci; int last_offset = tvb_reported_length(tvb) - 1; - guint bit_offset = 0; + unsigned bit_offset = 0; proto_item* pi; if (offset == (int)tvb_reported_length(tvb)) /* NO_DATA */ @@ -373,8 +352,8 @@ static void dissect_iuup_payload(tvbuff_t* tvb, packet_info* pinfo, proto_tree* do { - guint i; - guint subflows = rfci->num_of_subflows; + unsigned i; + unsigned subflows = rfci->num_of_subflows; proto_tree* flow_tree; flow_tree = proto_tree_add_subtree(tree,tvb,offset,-1,ett_payload_subflows,NULL,"Payload Frame"); @@ -386,7 +365,7 @@ static void dissect_iuup_payload(tvbuff_t* tvb, packet_info* pinfo, proto_tree* if (! rfci->subflow[i].len) continue; - iuup_proto_tree_add_bits(flow_tree, hf_iuup_rfci_subflow[rfci->id][i], tvb, + iuup_proto_tree_add_bits(pinfo, flow_tree, hf_iuup_rfci_subflow[rfci->id][i], tvb, offset + (bit_offset/8), bit_offset % 8, rfci->subflow[i].len, @@ -400,16 +379,16 @@ static void dissect_iuup_payload(tvbuff_t* tvb, packet_info* pinfo, proto_tree* } while (offset <= last_offset); } -static guint dissect_rfcis(tvbuff_t* tvb, packet_info* pinfo _U_, proto_tree* tree, int* offset, iuup_circuit_t* iuup_circuit) { +static unsigned dissect_rfcis(tvbuff_t* tvb, packet_info* pinfo _U_, proto_tree* tree, int* offset, iuup_circuit_t* iuup_circuit) { proto_item* pi; proto_tree* pt; - guint8 oct; - guint c = 0; - guint i; + uint8_t oct; + unsigned c = 0; + unsigned i; do { iuup_rfci_t *rfci = wmem_new0(wmem_file_scope(), iuup_rfci_t); - guint len = 0; + unsigned len = 0; DISSECTOR_ASSERT(c < 64); @@ -420,7 +399,7 @@ static guint dissect_rfcis(tvbuff_t* tvb, packet_info* pinfo _U_, proto_tree* tr proto_tree_add_item(pt,hf_iuup_init_rfci_li[c],tvb,*offset,1,ENC_BIG_ENDIAN); proto_tree_add_item(pt,hf_iuup_init_rfci[c],tvb,*offset,1,ENC_BIG_ENDIAN); - oct = tvb_get_guint8(tvb,*offset); + oct = tvb_get_uint8(tvb,*offset); rfci->id = oct & 0x3f; rfci->num_of_subflows = iuup_circuit->num_of_subflows; @@ -431,12 +410,12 @@ static guint dissect_rfcis(tvbuff_t* tvb, packet_info* pinfo _U_, proto_tree* tr (*offset)++; for(i = 0; i < iuup_circuit->num_of_subflows; i++) { - guint subflow_len; + unsigned subflow_len; if (len == 2) { subflow_len = tvb_get_ntohs(tvb,*offset); } else { - subflow_len = tvb_get_guint8(tvb,*offset); + subflow_len = tvb_get_uint8(tvb,*offset); } rfci->subflow[i].len = subflow_len; @@ -460,13 +439,13 @@ static guint dissect_rfcis(tvbuff_t* tvb, packet_info* pinfo _U_, proto_tree* tr return c - 1; } -static void dissect_iuup_init(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint32 circuit_id) { +static void dissect_iuup_init(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, uint32_t circuit_id) { int offset = 4; - guint8 oct = tvb_get_guint8(tvb,offset); - guint n = (oct & 0x0e) >> 1; - gboolean ti = oct & 0x10; - guint i; - guint rfcis; + uint8_t oct = tvb_get_uint8(tvb,offset); + unsigned n = (oct & 0x0e) >> 1; + bool ti = oct & 0x10; + unsigned i; + unsigned rfcis; proto_item* pi; proto_tree* support_tree = NULL; proto_tree* iptis_tree; @@ -481,7 +460,7 @@ static void dissect_iuup_init(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tre iuup_circuit = wmem_new0(wmem_file_scope(), iuup_circuit_t); } else { - iuup_circuit = wmem_new0(wmem_packet_scope(), iuup_circuit_t); + iuup_circuit = wmem_new0(pinfo->pool, iuup_circuit_t); } iuup_circuit->id = circuit_id; @@ -538,8 +517,8 @@ static void dissect_iuup_init(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tre } static void dissect_iuup_ratectl(tvbuff_t* tvb, packet_info* pinfo _U_, proto_tree* tree) { - guint num = tvb_get_guint8(tvb,4) & 0x3f; - guint i; + unsigned num = tvb_get_uint8(tvb,4) & 0x3f; + unsigned i; proto_item* pi; proto_tree* inds_tree; int offset = 4; @@ -560,12 +539,12 @@ static void add_hdr_crc(tvbuff_t* tvb, packet_info* pinfo, proto_item* iuup_tree pinfo, crc6_compute_tvb(tvb, 2), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); } -static guint16 +static uint16_t update_crc10_by_bytes_iuup(tvbuff_t *tvb, int offset, int length) { - guint16 crc10; - guint16 extra_16bits; - guint8 extra_8bits[2]; + uint16_t crc10; + uint16_t extra_16bits; + uint8_t extra_8bits[2]; crc10 = update_crc10_by_bytes_tvb(0, tvb, offset + 2, length); extra_16bits = tvb_get_ntohs(tvb, offset) & 0x3FF; @@ -579,7 +558,7 @@ static void add_payload_crc(tvbuff_t* tvb, packet_info* pinfo, proto_item* iuup_ { proto_item *crc_item; int length = tvb_reported_length(tvb); - guint16 crccheck = update_crc10_by_bytes_iuup(tvb, 2, length - 4); + uint16_t crccheck = update_crc10_by_bytes_iuup(tvb, 2, length - 4); crc_item = proto_tree_add_item(iuup_tree,hf_iuup_payload_crc,tvb,2,2,ENC_BIG_ENDIAN); if (crccheck) { @@ -599,10 +578,10 @@ static int dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree, proto_tree* iuup_tree = NULL; proto_item* proc_item = NULL; proto_item* ack_item = NULL; - guint8 first_octet; - guint8 second_octet; - guint8 pdutype; - guint phdr = 0; + uint8_t first_octet; + uint8_t second_octet; + uint8_t pdutype; + unsigned phdr = 0; tvbuff_t* tvb = tvb_in; col_set_str(pinfo->cinfo, COL_PROTOCOL, "IuUP"); @@ -622,8 +601,8 @@ static int dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree, tvb = tvb_new_subset_length(tvb_in,2,len); } - first_octet = tvb_get_guint8(tvb,0); - second_octet = tvb_get_guint8(tvb,1); + first_octet = tvb_get_uint8(tvb,0); + second_octet = tvb_get_uint8(tvb,1); pdutype = ( first_octet & PDUTYPE_MASK ) >> 4; @@ -638,7 +617,7 @@ static int dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree, switch(pdutype) { case PDUTYPE_DATA_WITH_CRC: - col_append_fstr(pinfo->cinfo, COL_INFO,"FN: %x RFCI: %u", (guint)(first_octet & 0x0f) ,(guint)(second_octet & 0x3f)); + col_append_fstr(pinfo->cinfo, COL_INFO,"FN: %x RFCI: %u", (unsigned)(first_octet & 0x0f) ,(unsigned)(second_octet & 0x3f)); proto_tree_add_item(iuup_tree,hf_iuup_frame_number,tvb,0,1,ENC_BIG_ENDIAN); pi = proto_tree_add_item(iuup_tree,hf_iuup_fqc,tvb,1,1,ENC_BIG_ENDIAN); @@ -653,7 +632,7 @@ static int dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree, dissect_iuup_payload(tvb,pinfo,iuup_tree,second_octet & 0x3f,4, conversation_get_id_from_elements(pinfo, CONVERSATION_IUUP, USE_LAST_ENDPOINT)); return tvb_captured_length(tvb); case PDUTYPE_DATA_NO_CRC: - col_append_fstr(pinfo->cinfo, COL_INFO," RFCI %u", (guint)(second_octet & 0x3f)); + col_append_fstr(pinfo->cinfo, COL_INFO," RFCI %u", (unsigned)(second_octet & 0x3f)); proto_tree_add_item(iuup_tree,hf_iuup_frame_number,tvb,0,1,ENC_BIG_ENDIAN); pi = proto_tree_add_item(iuup_tree,hf_iuup_fqc,tvb,1,1,ENC_BIG_ENDIAN); @@ -724,9 +703,9 @@ static int dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree, case PROC_TIME: { proto_tree* time_tree; - guint ta; + unsigned ta; - ta = tvb_get_guint8(tvb,4); + ta = tvb_get_uint8(tvb,4); pi = proto_tree_add_item(iuup_tree,hf_iuup_time_align,tvb,4,1,ENC_BIG_ENDIAN); time_tree = proto_item_add_subtree(pi,ett_time); @@ -734,12 +713,12 @@ static int dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree, if (ta >= 1 && ta <= 80) { pi = proto_tree_add_uint(time_tree,hf_iuup_delay,tvb,4,1,ta * 500); proto_item_set_generated(pi); - pi = proto_tree_add_float(time_tree,hf_iuup_delta,tvb,4,1,((gfloat)((gint)(ta) * 500))/(gfloat)1000000.0); + pi = proto_tree_add_float(time_tree,hf_iuup_delta,tvb,4,1,((float)((int)(ta) * 500))/(float)1000000.0); proto_item_set_generated(pi); } else if (ta >= 129 && ta <= 208) { pi = proto_tree_add_uint(time_tree,hf_iuup_advance,tvb,4,1,(ta-128) * 500); proto_item_set_generated(pi); - pi = proto_tree_add_float(time_tree,hf_iuup_delta,tvb,4,1,((gfloat)((gint)(-(((gint)ta)-128))) * 500)/(gfloat)1000000.0); + pi = proto_tree_add_float(time_tree,hf_iuup_delta,tvb,4,1,((float)((int)(-(((int)ta)-128))) * 500)/(float)1000000.0); proto_item_set_generated(pi); } else { expert_add_info(pinfo, pi, &ei_iuup_time_align); @@ -749,7 +728,7 @@ static int dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree, return tvb_captured_length(tvb); } case PROC_ERROR: - col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(tvb,4) & 0x3f,iuup_error_causes,"Unknown (%u)")); + col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_uint8(tvb,4) & 0x3f,iuup_error_causes,"Unknown (%u)")); proto_tree_add_item(iuup_tree,hf_iuup_error_distance,tvb,4,1,ENC_BIG_ENDIAN); pi = proto_tree_add_item(iuup_tree,hf_iuup_errorevt_cause_val,tvb,4,1,ENC_BIG_ENDIAN); @@ -768,36 +747,36 @@ static int dissect_iuup(tvbuff_t* tvb_in, packet_info* pinfo, proto_tree* tree, } -static gboolean dissect_iuup_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { +static bool dissect_iuup_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { int len = tvb_captured_length(tvb); - guint8 first_octet = tvb_get_guint8(tvb,0); - guint8 second_octet = tvb_get_guint8(tvb,1); - guint8 octet_array[] = {first_octet, second_octet}; - guint16 hdrcrc6 = tvb_get_guint8(tvb, 2) >> 2; + uint8_t first_octet = tvb_get_uint8(tvb,0); + uint8_t second_octet = tvb_get_uint8(tvb,1); + uint8_t octet_array[] = {first_octet, second_octet}; + uint16_t hdrcrc6 = tvb_get_uint8(tvb, 2) >> 2; - if (crc6_0X6F(hdrcrc6, octet_array, second_octet)) return FALSE; + if (crc6_0X6F(hdrcrc6, octet_array, second_octet)) return false; switch ( first_octet & 0xf0 ) { case 0x00: { - if (len<7) return FALSE; - if (update_crc10_by_bytes_iuup(tvb, 4, len-4) ) return FALSE; + if (len<7) return false; + if (update_crc10_by_bytes_iuup(tvb, 4, len-4) ) return false; break; } case 0x10: - /* a FALSE positive factory */ - if (len<5) return FALSE; + /* a false positive factory */ + if (len<5) return false; break; case 0xe0: - if (len<5) return FALSE; - if( (second_octet & 0x0f) > 3) return FALSE; + if (len<5) return false; + if( (second_octet & 0x0f) > 3) return false; break; default: - return FALSE; + return false; } dissect_iuup(tvb, pinfo, tree, data); - return TRUE; + return true; } @@ -925,7 +904,7 @@ void proto_register_iuup(void) { }; - gint* ett[] = { + int* ett[] = { &ett_iuup, &ett_rfci, &ett_ipti, |