diff options
author | Bill Meier <wmeier@newsguy.com> | 2010-04-28 16:09:25 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2010-04-28 16:09:25 +0000 |
commit | 2d1dccfcfc8608a763f80168c84af94fcec3a829 (patch) | |
tree | d85b06ae04e7632aba5f1449912ed46fccc882ca /epan/dissectors | |
parent | b6937765561c9abd3ad9b70acaedda2c980b8a53 (diff) |
Remove trailing blanks; Also: Altho tabs expanded, use tab-width=8 anyway.
svn path=/trunk/; revision=32587
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-db-lsp.c | 38 | ||||
-rw-r--r-- | epan/dissectors/packet-h223.c | 106 | ||||
-rw-r--r-- | epan/dissectors/packet-iax2.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-memcache.c | 408 | ||||
-rw-r--r-- | epan/dissectors/packet-sbus.c | 6 |
5 files changed, 283 insertions, 283 deletions
diff --git a/epan/dissectors/packet-db-lsp.c b/epan/dissectors/packet-db-lsp.c index 6f6f90214d..ae11a138e8 100644 --- a/epan/dissectors/packet-db-lsp.c +++ b/epan/dissectors/packet-db-lsp.c @@ -62,7 +62,7 @@ static gint ett_db_lsp = -1; /* desegmentation of tcp payload */ static gboolean db_lsp_desegment = TRUE; -static void +static void dissect_db_lsp_pdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *db_lsp_tree; @@ -76,7 +76,7 @@ dissect_db_lsp_pdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) db_lsp_item = proto_tree_add_item (tree, proto_db_lsp, tvb, offset, -1, FALSE); db_lsp_tree = proto_item_add_subtree (db_lsp_item, ett_db_lsp); - + type = tvb_get_guint8 (tvb, offset); proto_tree_add_item (db_lsp_tree, hf_type, tvb, offset, 1, FALSE); offset += 1; @@ -114,7 +114,7 @@ dissect_db_lsp_pdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_set_len (db_lsp_item, length + 5); } -static guint +static guint get_db_lsp_pdu_len (packet_info *pinfo _U_, tvbuff_t *tvb, int offset) { if (tvb_get_ntohs (tvb, offset + 1) != 0x0301) { @@ -125,14 +125,14 @@ get_db_lsp_pdu_len (packet_info *pinfo _U_, tvbuff_t *tvb, int offset) return tvb_get_ntohs (tvb, offset + 3) + 5; } -static void +static void dissect_db_lsp_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { tcp_dissect_pdus (tvb, pinfo, tree, db_lsp_desegment, 5, get_db_lsp_pdu_len, dissect_db_lsp_pdu); } -static void +static void dissect_db_lsp_disc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *db_lsp_tree; @@ -148,33 +148,33 @@ dissect_db_lsp_disc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item (db_lsp_tree, hf_text, tvb, offset, -1, FALSE); } -void +void proto_register_db_lsp (void) -{ - static hf_register_info hf[] = { +{ + static hf_register_info hf[] = { { &hf_type, { "Type", "db-lsp.type", - FT_UINT8, BASE_DEC_HEX, NULL, 0x0, + FT_UINT8, BASE_DEC_HEX, NULL, 0x0, "Type", HFILL } }, { &hf_magic, { "Magic", "db-lsp.magic", - FT_UINT16, BASE_DEC_HEX, NULL, 0x0, + FT_UINT16, BASE_DEC_HEX, NULL, 0x0, "Magic number", HFILL } }, { &hf_length, { "Length", "db-lsp.length", - FT_UINT16, BASE_DEC_HEX, NULL, 0x0, + FT_UINT16, BASE_DEC_HEX, NULL, 0x0, "Length in bytes", HFILL } }, { &hf_value, { "Value", "db-lsp.value", - FT_BYTES, BASE_NONE, NULL, 0x0, + FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_text, { "Text", "db-lsp.text", - FT_STRING, BASE_NONE, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, }; @@ -188,14 +188,14 @@ proto_register_db_lsp (void) proto_db_lsp_disc = proto_register_protocol (PNAME_DISC, PSNAME_DISC, PFNAME_DISC); register_dissector ("db-lsp.tcp", dissect_db_lsp_tcp, proto_db_lsp); register_dissector ("db-lsp.udp", dissect_db_lsp_disc, proto_db_lsp_disc); - + proto_register_field_array (proto_db_lsp, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); /* Register our configuration options */ db_lsp_module = prefs_register_protocol (proto_db_lsp, NULL); - prefs_register_bool_preference (db_lsp_module, "desegment_pdus", + prefs_register_bool_preference (db_lsp_module, "desegment_pdus", "Reassemble PDUs spanning multiple TCP segments", "Whether the LAN sync dissector should reassemble PDUs" " spanning multiple TCP segments." @@ -204,7 +204,7 @@ proto_register_db_lsp (void) &db_lsp_desegment); } -void +void proto_reg_handoff_db_lsp (void) { dissector_handle_t db_lsp_tcp_handle; @@ -222,10 +222,10 @@ proto_reg_handoff_db_lsp (void) * * Local Variables: * c-basic-offset: 2 - * tab-width: 2 + * tab-width: 8 * indent-tabs-mode: nil * End: * - * ex: set shiftwidth=2 tabstop=2 expandtab - * :indentSize=2:tabSize=2:noTabs=true: + * ex: set shiftwidth=2 tabstop=8 expandtab + * :indentSize=2:tabSize=8:noTabs=true: */ diff --git a/epan/dissectors/packet-h223.c b/epan/dissectors/packet-h223.c index ab8a883ef3..c559c1f2b9 100644 --- a/epan/dissectors/packet-h223.c +++ b/epan/dissectors/packet-h223.c @@ -280,9 +280,9 @@ static void add_h223_mux_element(h223_call_direction_data *direct, guint8 mc, h2 h223_mux_element_listitem *li; h223_mux_element_listitem **old_li_ptr; h223_mux_element_listitem *old_li; - + DISSECTOR_ASSERT(mc < 16); - + li = se_alloc(sizeof(h223_mux_element_listitem)); old_li_ptr = &(direct->mux_table[mc]); old_li = *old_li_ptr; @@ -310,11 +310,11 @@ static void add_h223_mux_element(h223_call_direction_data *direct, guint8 mc, h2 static h223_mux_element* find_h223_mux_element(h223_call_direction_data* direct, guint8 mc, guint32 framenum, guint32 pkt_offset) { h223_mux_element_listitem* li; - + DISSECTOR_ASSERT(mc < 16); - + li = direct->mux_table[mc]; - + while( li && li->next && li->next->first_frame < framenum ) li = li->next; while( li && li->next && li->next->first_frame == framenum && li->next->pdu_offset < pkt_offset ) @@ -420,7 +420,7 @@ static h223_call_info *create_call_info( guint32 start_frame ) /* initialise the call info */ init_direction_data(&datax -> direction_data[0]); init_direction_data(&datax -> direction_data[1]); - + /* FIXME shouldn't this be figured out dynamically? */ datax -> h223_level = 2; @@ -446,7 +446,7 @@ static h223_call_info *find_or_create_call_info_circ(packet_info * pinfo) return NULL; datax = (h223_call_info *)circuit_get_proto_data(circ, proto_h223); - + if( datax == NULL ) { datax = create_call_info(pinfo->fd->num); @@ -456,11 +456,11 @@ static h223_call_info *find_or_create_call_info_circ(packet_info * pinfo) #endif circuit_add_proto_data(circ, proto_h223, datax); } - + /* work out what direction we're really going in */ if( pinfo->p2p_dir < 0 || pinfo->p2p_dir > 1) pinfo->p2p_dir = P2P_DIR_SENT; - + return datax; } @@ -484,7 +484,7 @@ static h223_call_info *find_or_create_call_info_conv(packet_info * pinfo) if(datax == NULL && pinfo->ptype == PT_UDP ) { conversation_t *conv2; - + /* RTP tracks the two sides of the conversation totally separately; * this messes us up totally. * @@ -523,7 +523,7 @@ static h223_call_info *find_or_create_call_info_conv(packet_info * pinfo) pinfo->dst.data[0], pinfo->dst.data[1], pinfo->dst.data[2], pinfo->dst.data[3], pinfo->destport); #endif - + conversation_add_proto_data(conv, proto_h223, datax); /* add the source details so we can distinguish directions * in future */ @@ -535,7 +535,7 @@ static h223_call_info *find_or_create_call_info_conv(packet_info * pinfo) if( ADDRESSES_EQUAL( &(pinfo->src), &(datax->srcaddress)) && pinfo->srcport == datax->srcport ) pinfo->p2p_dir = P2P_DIR_SENT; - else + else pinfo->p2p_dir = P2P_DIR_RECV; return datax; @@ -646,7 +646,7 @@ static void dissect_mux_al_pdu( tvbuff_t *tvb, next_tvb = tvb; al_subitem = proto_tree_add_item(al_tree, hf_h223_al_payload, next_tvb, 0, -1, FALSE); break; - + case al2WithSequenceNumbers: al2_sequenced = TRUE; /* fall-through */ @@ -663,7 +663,7 @@ static void dissect_mux_al_pdu( tvbuff_t *tvb, /* check minimum payload length */ if(len < (al2_sequenced?2U:1U)) THROW(BoundsError); - + data_start = 0; if( al2_sequenced ) { proto_tree_add_item(al_tree, hf_h223_al2_seqno, tvb, 0, 1, TRUE); @@ -754,12 +754,12 @@ static void dissect_mux_sdu_fragment(tvbuff_t *volatile next_tvb, } } - + if( lc_params != NULL ) { if( lc_params->segmentable && lc_params->al_type != al1NotFramed ) { stream_t *substream; stream_pdu_fragment_t *frag; - + substream = find_stream_circ(subcircuit,pinfo->p2p_dir); if(substream == NULL ) substream = stream_new_circ(subcircuit,pinfo->p2p_dir); @@ -780,7 +780,7 @@ static void dissect_mux_sdu_fragment(tvbuff_t *volatile next_tvb, } next_tvb = stream_process_reassembled( - next_tvb, 0, pinfo, + next_tvb, 0, pinfo, "Reassembled H.223 AL-PDU", frag, &h223_al_frag_items, NULL, vc_tree); @@ -885,7 +885,7 @@ static guint32 dissect_mux_payload_by_me_list( tvbuff_t *tvb, packet_info *pinfo * call_info data structure for h223 call * mc multiplex code for this PDU * endOfMuxSdu true if the end-of-sdu flag was set - */ + */ static void dissect_mux_payload( tvbuff_t *tvb, packet_info *pinfo, guint32 pkt_offset, proto_tree *pdu_tree, h223_call_info* call_info, guint8 mc, gboolean endOfMuxSdu ) @@ -899,7 +899,7 @@ static void dissect_mux_payload( tvbuff_t *tvb, packet_info *pinfo, guint32 pkt_ } else { /* no entry found in mux-table. ignore packet and dissect as data */ proto_tree *vc_tree = NULL; - + if(pdu_tree) { proto_item *vc_item = proto_tree_add_item(pdu_tree, hf_h223_mux_deact, tvb, 0, len, FALSE); vc_tree = proto_item_add_subtree(vc_item, ett_h223_mux_deact); @@ -943,7 +943,7 @@ static void dissect_mux_pdu( tvbuff_t *tvb, packet_info * pinfo, g_debug("%u: dissecting complete H.223 MUX-PDU, pkt_offset %u, len %u", pinfo->fd->num, pkt_offset, tvb_reported_length(tvb)); #endif - + switch(call_info->h223_level) { case 0: case 1: raw_hdr = tvb_get_guint8(tvb,0); @@ -964,7 +964,7 @@ static void dissect_mux_pdu( tvbuff_t *tvb, packet_info * pinfo, if(errors != -1) { correct_hdr = raw_hdr ^ (guint32)errors; - + mc = (guint8)(correct_hdr & 0xf); mpl = (guint8)((correct_hdr >> 4) & 0xff); @@ -987,7 +987,7 @@ static void dissect_mux_pdu( tvbuff_t *tvb, packet_info * pinfo, DISSECTOR_ASSERT_NOT_REACHED(); } - + if( h223_tree ) { if( mpl == 0 ) { pdu_item = proto_tree_add_item (h223_tree, hf_h223_mux_stuffing_pdu, tvb, 0, -1, FALSE); @@ -1061,7 +1061,7 @@ static void dissect_mux_pdu( tvbuff_t *tvb, packet_info * pinfo, call_dissector(data_handle,next_tvb,pinfo,vc_tree); offset += len; - } + } /* add the closing HDLC flag */ if( pdu_tree ) @@ -1089,7 +1089,7 @@ static gboolean attempt_mux_level1_header_parse(guint32 nbytes, guint32 hdr, gui { /* this is untested */ DISSECTOR_ASSERT_NOT_REACHED(); - + if(nbytes < 2) return FALSE; @@ -1106,7 +1106,7 @@ static gboolean attempt_mux_level1_header_parse(guint32 nbytes, guint32 hdr, gui static gboolean attempt_mux_level2_3_header_parse(guint32 nbytes, guint32 hdr, guint32 *minlen) { gint32 errors; - + if(nbytes < 3) return FALSE; @@ -1118,7 +1118,7 @@ static gboolean attempt_mux_level2_3_header_parse(guint32 nbytes, guint32 hdr, g ((hdr & 0xFF0000) >> 16) | (hdr & 0x00FF00) | ((hdr & 0x0000FF) << 16); - + errors = golay_errors(hdr); if(errors != -1) { hdr ^= errors; @@ -1176,16 +1176,16 @@ static gint dissect_mux_pdu_fragment( tvbuff_t *tvb, guint32 start_offset, packe gboolean header_parsed = FALSE; guint32 header_buf = 0, tail_buf = 0; guint32 pdu_minlen = 0; - + #ifdef DEBUG_H223_FRAGMENTATION g_debug("%d: dissecting H.223 PDU, start_offset %u, %u bytes left", pinfo->fd->num,start_offset, tvb_reported_length_remaining( tvb, start_offset )); #endif - + while( more_frags && offset < tvb_reported_length( tvb )) { guint8 byte = tvb_get_guint8(tvb, offset++); - + /* read a byte into the header buf, if necessary */ if((offset-start_offset) <= 4) { header_buf <<= 8; @@ -1349,7 +1349,7 @@ static void dissect_h223_bitswapped (tvbuff_t * tvb, packet_info * pinfo, proto_ /* Add the reversed data to the data source list. */ add_new_data_source(pinfo, reversed_tvb, "Bit-swapped H.223 frame" ); - + dissect_h223(reversed_tvb,pinfo,tree); } @@ -1364,12 +1364,12 @@ static void h223_init_protocol (void) void proto_register_h223 (void) { /* A header field is something you can search/filter on. - * + * * We create a structure to register our fields. It consists of an * array of hf_register_info structures, each of which are of the format * {&(field id), {name, abbrev, type, display, strings, bitmask, blurb, HFILL}}. */ - + static hf_register_info hf[] = { { &hf_h223_non_h223_data, { "Non-H.223 data", "h223.non-h223", FT_NONE, BASE_NONE, NULL, 0x0, @@ -1390,7 +1390,7 @@ void proto_register_h223 (void) { &hf_h223_mux_rawhdr, { "Raw value", "h223.mux.rawhdr", FT_UINT24, BASE_HEX, NULL, 0x0, "Raw header bytes", HFILL }}, - + { &hf_h223_mux_correctedhdr, { "Corrected value", "h223.mux.correctedhdr", FT_UINT24, BASE_HEX, NULL, 0x0, "Corrected header bytes", HFILL }}, @@ -1410,11 +1410,11 @@ void proto_register_h223 (void) { &hf_h223_mux_vc, { "H.223 virtual circuit", "h223.mux.vc", FT_UINT16, BASE_DEC, NULL, 0x0, "H.223 Virtual Circuit", HFILL }}, - + { &hf_h223_mux_extra, { "Extraneous data", "h223.mux.extra", FT_NONE, BASE_NONE, NULL, 0x0, "data beyond mpl", HFILL }}, - + { &hf_h223_mux_hdlc2, { "HDLC flag", "h223.mux.hdlc", FT_UINT16, BASE_HEX, NULL, 0x0, "framing flag", HFILL }}, @@ -1423,31 +1423,31 @@ void proto_register_h223 (void) { &hf_h223_mux_fragment_overlap, { "Fragment overlap", "h223.mux.fragment.overlap", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Fragment overlaps with other fragments", HFILL }}, - + { &hf_h223_mux_fragment_overlap_conflict, { "Conflicting data in fragment overlap", "h223.mux.fragment.overlap.conflict", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Overlapping fragments contained conflicting data", HFILL }}, - + { &hf_h223_mux_fragment_multiple_tails, { "Multiple tail fragments found", "h223.mux.fragment.multipletails", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Several tails were found when defragmenting the packet", HFILL }}, - + { &hf_h223_mux_fragment_too_long_fragment, { "Fragment too long", "h223.mux.fragment.toolongfragment", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Fragment contained data past end of packet", HFILL }}, - + { &hf_h223_mux_fragment_error, { "Defragmentation error", "h223.mux.fragment.error", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "Defragmentation error due to illegal fragments", HFILL }}, - + { &hf_h223_mux_fragment, { "H.223 MUX-PDU Fragment", "h223.mux.fragment", FT_FRAMENUM, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_h223_mux_fragments, { "H.223 MUX-PDU Fragments", "h223.mux.fragments", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_h223_mux_reassembled_in, { "MUX-PDU fragment, reassembled in frame", "h223.mux.reassembled_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "This H.223 MUX-PDU packet is reassembled in this frame", HFILL }}, @@ -1460,31 +1460,31 @@ void proto_register_h223 (void) { &hf_h223_al_fragment_overlap, { "Fragment overlap", "h223.al.fragment.overlap", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Fragment overlaps with other fragments", HFILL }}, - + { &hf_h223_al_fragment_overlap_conflict, { "Conflicting data in fragment overlap", "h223.al.fragment.overlap.conflict", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Overlapping fragments contained conflicting data", HFILL }}, - + { &hf_h223_al_fragment_multiple_tails, { "Multiple tail fragments found", "h223.al.fragment.multipletails", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Several tails were found when defragmenting the packet", HFILL }}, - + { &hf_h223_al_fragment_too_long_fragment, { "Fragment too long", "h223.al.fragment.toolongfragment", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Fragment contained data past end of packet", HFILL }}, - + { &hf_h223_al_fragment_error, { "Defragmentation error", "h223.al.fragment.error", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "Defragmentation error due to illegal fragments", HFILL }}, - + { &hf_h223_al_fragment, { "H.223 AL-PDU Fragment", "h223.al.fragment", FT_FRAMENUM, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_h223_al_fragments, { "H.223 AL-PDU Fragments", "h223.al.fragments", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_h223_al_reassembled_in, { "AL-PDU fragment, reassembled in frame", "h223.al.reassembled_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "This H.223 AL-PDU packet is reassembled in this frame", HFILL }}, @@ -1560,7 +1560,7 @@ void proto_register_h223 (void) proto_register_subtree_array (ett, array_length (ett)); register_dissector("h223", dissect_h223, proto_h223); register_dissector("h223_bitswapped", dissect_h223_bitswapped, proto_h223_bitswapped); - + /* register our init routine to be called at the start of a capture, to clear out our hash tables etc */ register_init_routine(&h223_init_protocol); @@ -1587,10 +1587,10 @@ void proto_reg_handoff_h223(void) * * Local Variables: * c-basic-offset: 4 - * tab-width: 4 + * tab-width: 8 * indent-tabs-mode: nil * End: * - * ex: set shiftwidth=4 tabstop=4 expandtab - * :indentSize=4:tabSize=4:noTabs=true: + * ex: set shiftwidth=4 tabstop=8 expandtab + * :indentSize=4:tabSize=8:noTabs=true: */ diff --git a/epan/dissectors/packet-iax2.c b/epan/dissectors/packet-iax2.c index f4562f5b7a..cfab23c190 100644 --- a/epan/dissectors/packet-iax2.c +++ b/epan/dissectors/packet-iax2.c @@ -2603,7 +2603,7 @@ void proto_reg_handoff_iax2 (void) { dissector_handle_t v110_handle = NULL; - + dissector_add("udp.port", IAX2_PORT, find_dissector("iax2")); v110_handle = find_dissector("v110"); if(v110_handle) @@ -2616,10 +2616,10 @@ proto_reg_handoff_iax2 (void) * * Local Variables: * c-basic-offset: 2 - * tab-width: 2 + * tab-width: 8 * indent-tabs-mode: nil * End: * - * ex: set shiftwidth=2 tabstop=2 expandtab - * :indentSize=2:tabSize=2:noTabs=true: + * ex: set shiftwidth=2 tabstop=8 expandtab + * :indentSize=2:tabSize=8:noTabs=true: */ diff --git a/epan/dissectors/packet-memcache.c b/epan/dissectors/packet-memcache.c index e740390399..512b55b6c2 100644 --- a/epan/dissectors/packet-memcache.c +++ b/epan/dissectors/packet-memcache.c @@ -209,8 +209,8 @@ static const value_string data_type_vals[] = { }; /* memcache message types. */ -typedef enum _memcache_type { - MEMCACHE_REQUEST, +typedef enum _memcache_type { + MEMCACHE_REQUEST, MEMCACHE_RESPONSE, MEMCACHE_UNKNOWN } memcache_type_t; @@ -223,7 +223,7 @@ static gboolean memcache_desegment_body = TRUE; /* should refer to either the request or the response dissector. */ -typedef int (*ReqRespDissector)(tvbuff_t*, packet_info *, proto_tree *, +typedef int (*ReqRespDissector)(tvbuff_t*, packet_info *, proto_tree *, int, const guchar*, const guchar*, guint8); /* determines if a packet contains a memcache @@ -231,10 +231,10 @@ typedef int (*ReqRespDissector)(tvbuff_t*, packet_info *, proto_tree *, */ static int is_memcache_request_or_reply(const gchar *data, int linelen, guint8 *opcode, - memcache_type_t *type, int *expect_content_length, + memcache_type_t *type, int *expect_content_length, ReqRespDissector *reqresp_dissector); -static guint +static guint get_memcache_pdu_len (packet_info *pinfo _U_, tvbuff_t *tvb, int offset) { guint32 body_len; @@ -246,8 +246,8 @@ get_memcache_pdu_len (packet_info *pinfo _U_, tvbuff_t *tvb, int offset) return body_len + MEMCACHE_HEADER_LEN; } -static void -dissect_extras (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, +static void +dissect_extras (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, guint8 extras_len, guint8 opcode, gboolean request) { proto_tree *extras_tree = NULL; @@ -363,25 +363,25 @@ dissect_extras (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (illegal) { ti = proto_tree_add_item (extras_tree, hf_extras_unknown, tvb, offset, extras_len, FALSE); - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s %s shall not have Extras", + expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s %s shall not have Extras", val_to_str (opcode, opcode_vals, "Opcode %d"), request ? "Request" : "Response"); offset += extras_len; } else if (missing) { ti = proto_tree_add_item (tree, hf_extras_missing, tvb, offset, 0, FALSE); - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s %s must have Extras", + expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s %s must have Extras", val_to_str (opcode, opcode_vals, "Opcode %d"), request ? "Request" : "Response"); } if ((offset - save_offset) != extras_len) { - expert_add_info_format (pinfo, extras_item, PI_UNDECODED, PI_WARN, + expert_add_info_format (pinfo, extras_item, PI_UNDECODED, PI_WARN, "Illegal Extras length, should be %d", offset - save_offset); } } -static void -dissect_key (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, +static void +dissect_key (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, int key_len, guint8 opcode, gboolean request) { proto_item *ti = NULL; @@ -423,7 +423,7 @@ dissect_key (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } if (illegal) { - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s %s shall not have Key", + expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s %s shall not have Key", val_to_str (opcode, opcode_vals, "Opcode %d"), request ? "Request" : "Response"); } else if (missing) { @@ -434,8 +434,8 @@ dissect_key (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } } -static void -dissect_value (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, +static void +dissect_value (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, guint32 value_len, guint8 opcode, gboolean request) { proto_item *ti = NULL; @@ -456,7 +456,7 @@ dissect_value (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* Sanity check */ if (value_len) { - if ((opcode == OP_GET) || (opcode == OP_GET_Q) || (opcode == OP_GET_K) || (opcode == OP_GET_K_Q) || + if ((opcode == OP_GET) || (opcode == OP_GET_Q) || (opcode == OP_GET_K) || (opcode == OP_GET_K_Q) || (opcode == OP_INCREMENT) || (opcode == OP_DECREMENT) || (opcode == OP_VERSION) || (opcode == OP_INCREMENT_Q) || (opcode == OP_DECREMENT_Q)) { @@ -493,18 +493,18 @@ dissect_value (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } if (illegal) { - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s %s shall not have Value", + expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s %s shall not have Value", val_to_str (opcode, opcode_vals, "Opcode %d"), request ? "Request" : "Response"); } else if (missing) { ti = proto_tree_add_item (tree, hf_value_missing, tvb, offset, 0, FALSE); expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s %s must have Value", val_to_str (opcode, opcode_vals, "Opcode %d"), - request ? "Request" : "Response"); + request ? "Request" : "Response"); } } -static void +static void dissect_memcache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *memcache_tree; @@ -540,7 +540,7 @@ dissect_memcache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_append_text (memcache_item, ", %s %s", val_to_str (opcode, opcode_vals, "Unknown opcode (%d)"), val_to_str (magic, magic_vals, "Unknown magic (%d)")); - col_append_fstr (pinfo->cinfo, COL_INFO, "%s %s", + col_append_fstr (pinfo->cinfo, COL_INFO, "%s %s", val_to_str (opcode, opcode_vals, "Unknown opcode (%d)"), val_to_str (magic, magic_vals, "Unknown magic (%d)")); @@ -560,7 +560,7 @@ dissect_memcache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) request = FALSE; ti = proto_tree_add_item (memcache_tree, hf_status, tvb, offset, 2, FALSE); if (status != 0) { - expert_add_info_format (pinfo, ti, PI_RESPONSE_CODE, PI_NOTE, "%s: %s", + expert_add_info_format (pinfo, ti, PI_RESPONSE_CODE, PI_NOTE, "%s: %s", val_to_str (opcode, opcode_vals, "Unknown opcode (%d)"), val_to_str (status, status_vals, "Status: %d")); } @@ -599,8 +599,8 @@ dissect_memcache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else if (body_len) { proto_tree_add_item (memcache_tree, hf_value, tvb, offset, body_len, FALSE); offset += body_len; - - col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", + + col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", val_to_str (status, status_vals, "Unknown status: %d")); } else { ti = proto_tree_add_item (memcache_tree, hf_value_missing, tvb, offset, 0, FALSE); @@ -612,8 +612,8 @@ dissect_memcache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Obtain the content length by peeping into the header. */ -static gboolean -get_payload_length (tvbuff_t *tvb, const int token_number, int offset, +static gboolean +get_payload_length (tvbuff_t *tvb, const int token_number, int offset, guint32 *bytes, gboolean *content_length_found) { const guchar *next_token; @@ -671,19 +671,19 @@ desegment_pdus (tvbuff_t *tvb, packet_info *pinfo, const int offset, gint length_remaining, reported_length_remaining; /* data_offset has been set to start of the data block. */ - if (!tvb_bytes_exist (tvb, data_offset, content_length)) { + if (!tvb_bytes_exist (tvb, data_offset, content_length)) { length_remaining = tvb_length_remaining (tvb, data_offset); reported_length_remaining = tvb_reported_length_remaining (tvb, data_offset); - if (length_remaining < reported_length_remaining) { + if (length_remaining < reported_length_remaining) { /* It's a waste of time asking for more * data, because that data wasn't captured. */ return FALSE; } - if (length_remaining == -1) { + if (length_remaining == -1) { length_remaining = 0; } @@ -700,8 +700,8 @@ desegment_pdus (tvbuff_t *tvb, packet_info *pinfo, const int offset, */ static gboolean memcache_req_resp_hdrs_do_reassembly ( - tvbuff_t *tvb, const int offset, packet_info *pinfo, - const gboolean desegment_headers, const gboolean desegment_body, + tvbuff_t *tvb, const int offset, packet_info *pinfo, + const gboolean desegment_headers, const gboolean desegment_body, const memcache_type_t type, const int expect_content_length) { int linelen; @@ -715,10 +715,10 @@ memcache_req_resp_hdrs_do_reassembly ( /* * If header desegmentation is activated, check the * header in this tvbuff. - * request one more byte (we don't know how many bytes + * request one more byte (we don't know how many bytes * we'll need, so we just ask for one). */ - if (desegment_headers && pinfo->can_desegment) { + if (desegment_headers && pinfo->can_desegment) { next_offset = offset; reported_length_remaining = tvb_reported_length_remaining (tvb, next_offset); @@ -729,7 +729,7 @@ memcache_req_resp_hdrs_do_reassembly ( * the available data, requesting more bytes * won't help, as those bytes weren't captured). */ - if (reported_length_remaining < 1) { + if (reported_length_remaining < 1) { pinfo->desegment_offset = offset; pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; return FALSE; @@ -737,15 +737,15 @@ memcache_req_resp_hdrs_do_reassembly ( length_remaining = tvb_length_remaining (tvb, next_offset); - /* Request one more byte if we cannot find a + /* Request one more byte if we cannot find a * header (i.e. a line end). */ linelen = tvb_find_line_end (tvb, next_offset, -1, &next_offset, TRUE); - if (linelen == -1 && length_remaining >= reported_length_remaining) { + if (linelen == -1 && length_remaining >= reported_length_remaining) { /* Not enough data; ask for one more byte. */ pinfo->desegment_offset = offset; pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; - return FALSE; + return FALSE; } /* Browse through the header to find the content length. @@ -755,39 +755,39 @@ memcache_req_resp_hdrs_do_reassembly ( * cas <key> <flags> <exptime> <bytes> <cas unqiue> [noreply]\r\n * * response: - * VALUE <key> <flags> <bytes> [<cas unique>]\r\n + * VALUE <key> <flags> <bytes> [<cas unique>]\r\n * <data block>\r\n - */ - if (expect_content_length == TRUE) { + */ + if (expect_content_length == TRUE) { switch (type) { case MEMCACHE_REQUEST: /* Get the fifth token in the header.*/ ret = get_payload_length (tvb, 5 , offset, &content_length, &content_length_found); - if (!ret) { - return FALSE; + if (!ret) { + return FALSE; } break; case MEMCACHE_RESPONSE: /* Get the fourth token in the header.*/ ret = get_payload_length (tvb, 4 , offset, &content_length, &content_length_found); - if (!ret) { - return FALSE; - } + if (!ret) { + return FALSE; + } break; default: /* Unrecognized message type. */ - return FALSE; + return FALSE; } } } - /* We have reached the end of a header, so there - * should be 'content_length' bytes after this - * followed by CRLF. The next_offset points to the - * start of the data bytes. + /* We have reached the end of a header, so there + * should be 'content_length' bytes after this + * followed by CRLF. The next_offset points to the + * start of the data bytes. */ if (desegment_body && content_length_found) { return !desegment_pdus (tvb, pinfo, offset, next_offset, content_length); @@ -824,7 +824,7 @@ dissect_memcache_message (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t first_linelen = tvb_find_line_end (tvb, offset, tvb_ensure_length_remaining (tvb, offset), &next_offset, FALSE); - if (first_linelen < 0) { + if (first_linelen < 0) { return -1; } @@ -833,20 +833,20 @@ dissect_memcache_message (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t memcache_type = MEMCACHE_UNKNOWN; /* packet type not known yet */ - /* Look at the first token of the first line to - * determine if it is a request or a response? + /* Look at the first token of the first line to + * determine if it is a request or a response? */ - is_request_or_reply = - is_memcache_request_or_reply ((const gchar *)line, - first_linelen, &opcode, &memcache_type, + is_request_or_reply = + is_memcache_request_or_reply ((const gchar *)line, + first_linelen, &opcode, &memcache_type, &expect_content_length, &reqresp_dissector); if (is_request_or_reply) { /* Yes, it is a request or a response. * Do header and body desegmentation if we've been told to. */ - if (!memcache_req_resp_hdrs_do_reassembly (tvb, offset, pinfo, memcache_desegment_headers, - memcache_desegment_body, memcache_type, + if (!memcache_req_resp_hdrs_do_reassembly (tvb, offset, pinfo, memcache_desegment_headers, + memcache_desegment_body, memcache_type, expect_content_length)) { /* More data needed for desegmentation. */ @@ -854,7 +854,7 @@ dissect_memcache_message (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t } } - /* Columns and summary display. */ + /* Columns and summary display. */ col_set_str (pinfo->cinfo, COL_PROTOCOL, PSNAME); /* If the packet is a memcache request or reply, @@ -863,7 +863,7 @@ dissect_memcache_message (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t */ if (is_request_or_reply) { line = tvb_get_ptr (tvb, offset, first_linelen); - col_add_fstr (pinfo->cinfo, COL_INFO, "%s ", + col_add_fstr (pinfo->cinfo, COL_INFO, "%s ", format_text (line, first_linelen)); } else { col_set_str (pinfo->cinfo, COL_INFO, "MEMCACHE Continuation"); @@ -874,18 +874,18 @@ dissect_memcache_message (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t memcache_item = proto_tree_add_item (tree, proto_memcache, tvb, offset, -1, FALSE); memcache_tree = proto_item_add_subtree (memcache_item, ett_memcache); - /* Process the packet data. The first line is expected to be a + /* Process the packet data. The first line is expected to be a * header. If its not a header then we don't dissect. - * At this point, we already know if it is a request or a + * At this point, we already know if it is a request or a * response. */ if (tvb_reported_length_remaining (tvb, offset) != 0) { /* Dissect a request or a response. */ if (is_request_or_reply && reqresp_dissector) { if (tree) { - next_offset = reqresp_dissector (tvb, pinfo, memcache_tree, + next_offset = reqresp_dissector (tvb, pinfo, memcache_tree, offset, line, lineend, opcode); - if (next_offset == -1) { + if (next_offset == -1) { /* Error in dissecting. */ return -1; } @@ -913,20 +913,20 @@ dissect_memcache_message (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t return offset - orig_offset; } -/* Payload dissector +/* Payload dissector * <data block>\r\n - */ -static int -content_data_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, + */ +static int +content_data_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int content_length, guint8 opcode) { gint datalen; int len; gboolean short_pkt = FALSE; - /* - * Expecting to read 'content_length' number of bytes from - * the buffer. It is not necessary that we have all the + /* + * Expecting to read 'content_length' number of bytes from + * the buffer. It is not necessary that we have all the * content_length bytes available to read. */ if ((len = tvb_reported_length_remaining (tvb, offset) != 0)) { @@ -961,7 +961,7 @@ content_data_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int /* Find the occurrences of a ':' in a stat response. */ static guint -find_stat_colon (const guchar *line, const guchar *lineend, +find_stat_colon (const guchar *line, const guchar *lineend, const guchar **first_colon, const guchar **last_colon) { const guchar *linep, *temp; @@ -969,7 +969,7 @@ find_stat_colon (const guchar *line, const guchar *lineend, guchar c; linep = line; - while (linep < lineend) { + while (linep < lineend) { temp = linep; c = *linep++; @@ -981,8 +981,8 @@ find_stat_colon (const guchar *line, const guchar *lineend, } else if (occurrences == 2) { *last_colon = temp; } else { - /* anything other than 1 or 2; - * return immediately + /* anything other than 1 or 2; + * return immediately */ return occurrences; } @@ -1019,12 +1019,12 @@ incr_dissector (tvbuff_t *tvb, proto_tree *tree, int offset) /* * Get a buffer that refers to the line. - * in other words, the unstructured portion + * in other words, the unstructured portion * of memcache. */ line = tvb_get_ptr (tvb, offset, linelen); lineend = line + linelen; - + /* 64 bit value */ tokenlen = get_token_len (line, lineend, &next_token); if (tokenlen == 0) { @@ -1095,7 +1095,7 @@ stat_dissector (tvbuff_t *tvb, proto_tree *tree, int offset) case 2: /* stats items: 2 colons */ /* subcommand 'items' */ tokenlen = (int) (first_colon - line); - proto_tree_add_item (tree, hf_subcommand, tvb, offset, + proto_tree_add_item (tree, hf_subcommand, tvb, offset, tokenlen, FALSE); offset += tokenlen + 1; @@ -1190,12 +1190,12 @@ get_response_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int /* * Get a buffer that refers to the line. - * in other words, the unstructured portion + * in other words, the unstructured portion * of memcache. */ line = tvb_get_ptr (tvb, offset, linelen); lineend = line + linelen; - + /* VALUE token */ tokenlen = get_token_len (line, lineend, &next_token); if (tokenlen == 0) { @@ -1219,7 +1219,7 @@ get_response_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int /* key */ tokenlen = get_token_len (line, lineend, &next_token); - if (tokenlen == 0) { + if (tokenlen == 0) { return -1; } dissect_key (tvb, pinfo, tree, offset, tokenlen, opcode, TRUE); @@ -1239,7 +1239,7 @@ get_response_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset += (int) (next_token - line); line = next_token; - + /* bytes */ tokenlen = get_token_len (line, lineend, &next_token); if (tokenlen == 0 || tokenlen > 10) { @@ -1279,7 +1279,7 @@ get_response_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset = next_offset; /* <datablock>\r\n */ - offset = content_data_dissector (tvb, pinfo, tree, offset, bytes, opcode); + offset = content_data_dissector (tvb, pinfo, tree, offset, bytes, opcode); if (offset == -1) { return offset; } @@ -1289,7 +1289,7 @@ get_response_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int } /* Basic memcache response dissector. */ -static int +static int memcache_response_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, const guchar *line, const guchar *lineend, guint8 opcode) { @@ -1307,7 +1307,7 @@ memcache_response_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree tokenlen = get_token_len (line, lineend, &next_token); if (tokenlen == 0) { return -1; - } + } if ((tokenlen == 7) && strncmp (line, "VERSION", tokenlen) == 0) { offset += (int) (next_token - line); line = next_token; @@ -1350,7 +1350,7 @@ memcache_response_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* all the following mark an end of a response. * should take care of set, add, cas, append, replace - * prepend, flush_all, verbosity, delete and to an extent + * prepend, flush_all, verbosity, delete and to an extent * incr, decr and stat commands. */ if ((tokenlen == 6 && strncmp (line, "STORED", tokenlen) == 0) || @@ -1359,7 +1359,7 @@ memcache_response_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree (tokenlen == 9 && strncmp (line, "NOT_FOUND", tokenlen) == 0) || (tokenlen == 7 && strncmp (line, "DELETED", tokenlen) == 0) || (tokenlen == 2 && strncmp (line, "OK", tokenlen) == 0) || - (tokenlen == 3 && strncmp (line, "END", tokenlen) == 0)) + (tokenlen == 3 && strncmp (line, "END", tokenlen) == 0)) { proto_tree_add_item (tree, hf_response, tvb, offset, tokenlen, FALSE); offset += (int) (next_token - line); @@ -1368,8 +1368,8 @@ memcache_response_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree } /* if we have reached this point: - * it is either an incr/decr response of the format - * <value>\r\n. + * it is either an incr/decr response of the format + * <value>\r\n. * or * "stats sizes" response of the format: * <size> <count> \r\n @@ -1382,7 +1382,7 @@ memcache_response_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree } /* Basic memcache request dissector. */ -static int +static int memcache_request_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, const guchar *line, const guchar *lineend, guint8 opcode) { @@ -1415,7 +1415,7 @@ memcache_request_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* key */ tokenlen = get_token_len (line, lineend, &next_token); - if (tokenlen == 0) { + if (tokenlen == 0) { return -1; } @@ -1436,8 +1436,8 @@ memcache_request_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += (int) (next_token - line); line = next_token; - - /* expiration */ + + /* expiration */ tokenlen = get_token_len (line, lineend, &next_token); if (tokenlen == 0 || tokenlen > 10) { return -1; @@ -1482,11 +1482,11 @@ memcache_request_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* check if the following bit is "noreply" or - * the actual data block. + * the actual data block. */ tokenlen = get_token_len (line, lineend, &next_token); if (tokenlen != 0) { - if (tokenlen == 7 && strncmp (line, "noreply", 7) == 0) { + if (tokenlen == 7 && strncmp (line, "noreply", 7) == 0) { proto_tree_add_item (tree, hf_noreply, tvb, offset, tokenlen, FALSE); } offset += (int) (next_token - line); @@ -1495,7 +1495,7 @@ memcache_request_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += 2 ; /* go past /r/n*/ /* <datablock>\r\n */ - offset = content_data_dissector (tvb, pinfo, tree, offset, bytes, opcode); + offset = content_data_dissector (tvb, pinfo, tree, offset, bytes, opcode); if (offset == -1) { return offset; } @@ -1505,7 +1505,7 @@ memcache_request_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, case OP_DECREMENT: /* key */ tokenlen = get_token_len (line, lineend, &next_token); - if (tokenlen == 0) { + if (tokenlen == 0) { return -1; } dissect_key (tvb, pinfo, tree, offset, tokenlen, opcode, TRUE); @@ -1547,7 +1547,7 @@ memcache_request_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, case OP_DELETE: /* key */ tokenlen = get_token_len (line, lineend, &next_token); - if (tokenlen == 0) { + if (tokenlen == 0) { return -1; } /* dissect key. */ @@ -1653,8 +1653,8 @@ memcache_request_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tokenlen = get_token_len (line, lineend, &next_token); if (tokenlen == 0) { return offset; - } - if (tokenlen == 7 && strncmp (line, "noreply", 7) == 0) { + } + if (tokenlen == 7 && strncmp (line, "noreply", 7) == 0) { /* noreply */ proto_tree_add_item (tree, hf_noreply, tvb, offset, tokenlen, FALSE); offset += (int) (next_token - line); @@ -1693,7 +1693,7 @@ memcache_request_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, */ static int is_memcache_request_or_reply (const gchar *data, int linelen, guint8 *opcode, - memcache_type_t *type, int *expect_content_length, + memcache_type_t *type, int *expect_content_length, ReqRespDissector *reqresp_dissector) { const guchar *ptr = (const guchar *)data; @@ -1751,7 +1751,7 @@ is_memcache_request_or_reply (const gchar *data, int linelen, guint8 *opcode, break; case 7: - if (strncmp (data, "VERSION", indx) == 0) { + if (strncmp (data, "VERSION", indx) == 0) { *opcode = OP_VERSION; *type = MEMCACHE_RESPONSE; is_request_or_response = TRUE; @@ -1786,46 +1786,46 @@ is_memcache_request_or_reply (const gchar *data, int linelen, guint8 *opcode, } /* is it a request? */ - switch (indx) { - case 3: + switch (indx) { + case 3: if (strncmp (data, "get", indx) == 0) { *opcode = OP_GET; - *type = MEMCACHE_REQUEST; + *type = MEMCACHE_REQUEST; is_request_or_response = TRUE; } else if (strncmp (data, "set", indx) == 0) { *opcode = OP_SET; - *type = MEMCACHE_REQUEST; + *type = MEMCACHE_REQUEST; *expect_content_length = TRUE; is_request_or_response = TRUE; } else if (strncmp (data, "add", indx) == 0) { *opcode = OP_ADD; - *type = MEMCACHE_REQUEST; + *type = MEMCACHE_REQUEST; *expect_content_length = TRUE; is_request_or_response = TRUE; } else if (strncmp (data, "cas", indx) == 0) { *opcode = OP_CAS; - *type = MEMCACHE_REQUEST; + *type = MEMCACHE_REQUEST; *expect_content_length = TRUE; is_request_or_response = TRUE; } break; - case 4: + case 4: if (strncmp (data, "gets", indx) == 0) { *opcode = OP_GETS; - *type = MEMCACHE_REQUEST; + *type = MEMCACHE_REQUEST; is_request_or_response = TRUE; } else if (strncmp (data, "incr", indx) == 0) { *opcode = OP_INCREMENT; - *type = MEMCACHE_REQUEST; + *type = MEMCACHE_REQUEST; is_request_or_response = TRUE; } else if (strncmp (data, "decr", indx) == 0) { *opcode = OP_DECREMENT; - *type = MEMCACHE_REQUEST; + *type = MEMCACHE_REQUEST; is_request_or_response = TRUE; } else if (strncmp (data, "quit", indx) == 0) { *opcode = OP_QUIT; - *type = MEMCACHE_REQUEST; + *type = MEMCACHE_REQUEST; is_request_or_response = TRUE; } break; @@ -1838,20 +1838,20 @@ is_memcache_request_or_reply (const gchar *data, int linelen, guint8 *opcode, } break; - case 6: + case 6: if (strncmp (data, "append", indx) == 0) { *opcode = OP_APPEND; - *type = MEMCACHE_REQUEST; + *type = MEMCACHE_REQUEST; *expect_content_length = TRUE; is_request_or_response = TRUE; } else if (strncmp (data, "delete", indx) == 0) { *opcode = OP_DELETE; - *type = MEMCACHE_REQUEST; + *type = MEMCACHE_REQUEST; is_request_or_response = TRUE; } break; - case 7: + case 7: if (strncmp (data, "replace", indx) == 0) { *opcode = OP_REPLACE; *type = MEMCACHE_REQUEST; @@ -1869,7 +1869,7 @@ is_memcache_request_or_reply (const gchar *data, int linelen, guint8 *opcode, } break; - case 9: + case 9: if (strncmp (data, "flush_all", indx) == 0) { *opcode = OP_FLUSH; *type = MEMCACHE_REQUEST; @@ -1877,7 +1877,7 @@ is_memcache_request_or_reply (const gchar *data, int linelen, guint8 *opcode, } break; - default: + default: break; /* check if it is an 'incr' or 'stats sizes' response. */ } @@ -1898,9 +1898,9 @@ static void dissect_memcache_text (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { int offset = 0; - int len; + int len; - while (tvb_reported_length_remaining (tvb, offset) != 0) { + while (tvb_reported_length_remaining (tvb, offset) != 0) { /* dissect the memcache packet. */ len = dissect_memcache_message (tvb, offset, pinfo, tree); @@ -1918,15 +1918,15 @@ dissect_memcache_text (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } /* Dissect tcp packets based on the type of protocol (text/binary) */ -static void +static void dissect_memcache_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) -{ +{ gint offset = 0; guint8 magic; magic = tvb_get_guint8 (tvb, offset); - if (match_strval (magic, magic_vals) != NULL) { + if (match_strval (magic, magic_vals) != NULL) { tcp_dissect_pdus (tvb, pinfo, tree, memcache_desegment_body, 12, get_memcache_pdu_len, dissect_memcache); } else { @@ -1935,7 +1935,7 @@ dissect_memcache_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } /* Dissect udp packets based on the type of protocol (text/binary) */ -static void +static void dissect_memcache_udp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { gint offset = 0; @@ -1943,184 +1943,184 @@ dissect_memcache_udp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) magic = tvb_get_guint8 (tvb, offset); - if (match_strval (magic, magic_vals) != NULL) { + if (match_strval (magic, magic_vals) != NULL) { dissect_memcache (tvb, pinfo, tree); } else { dissect_memcache_message (tvb, 0, pinfo, tree); } } -/* Registration functions; register memcache protocol, +/* Registration functions; register memcache protocol, * its configuration options and also register the tcp and udp * dissectors. */ -void +void proto_register_memcache (void) -{ - static hf_register_info hf[] = { +{ + static hf_register_info hf[] = { { &hf_magic, - { "Magic", "memcache.magic", - FT_UINT8, BASE_DEC, VALS (magic_vals), 0x0, + { "Magic", "memcache.magic", + FT_UINT8, BASE_DEC, VALS (magic_vals), 0x0, "Magic number", HFILL } }, { &hf_opcode, - { "Opcode", "memcache.opcode", - FT_UINT8, BASE_DEC, VALS (opcode_vals), 0x0, + { "Opcode", "memcache.opcode", + FT_UINT8, BASE_DEC, VALS (opcode_vals), 0x0, "Command code", HFILL } }, { &hf_extras_length, - { "Extras length", "memcache.extras.length", - FT_UINT8, BASE_DEC, NULL, 0x0, + { "Extras length", "memcache.extras.length", + FT_UINT8, BASE_DEC, NULL, 0x0, "Length in bytes of the command extras", HFILL } }, { &hf_key_length, - { "Key Length", "memcache.key.length", - FT_UINT16, BASE_DEC, NULL, 0x0, + { "Key Length", "memcache.key.length", + FT_UINT16, BASE_DEC, NULL, 0x0, "Length in bytes of the text key that follows the command extras", HFILL } }, { &hf_value_length, - { "Value length", "memcache.value.length", - FT_UINT32, BASE_DEC, NULL, 0x0, + { "Value length", "memcache.value.length", + FT_UINT32, BASE_DEC, NULL, 0x0, "Length in bytes of the value that follows the key", HFILL } }, { &hf_data_type, - { "Data type", "memcache.data_type", - FT_UINT8, BASE_DEC, VALS (data_type_vals), 0x0, + { "Data type", "memcache.data_type", + FT_UINT8, BASE_DEC, VALS (data_type_vals), 0x0, NULL, HFILL } }, { &hf_reserved, - { "Reserved", "memcache.reserved", - FT_UINT16, BASE_DEC, NULL, 0x0, + { "Reserved", "memcache.reserved", + FT_UINT16, BASE_DEC, NULL, 0x0, "Reserved for future use", HFILL } }, { &hf_status, - { "Status", "memcache.status", - FT_UINT16, BASE_DEC, VALS (status_vals), 0x0, + { "Status", "memcache.status", + FT_UINT16, BASE_DEC, VALS (status_vals), 0x0, "Status of the response", HFILL } }, { &hf_total_body_length, - { "Total body length", "memcache.total_body_length", - FT_UINT32, BASE_DEC, NULL, 0x0, + { "Total body length", "memcache.total_body_length", + FT_UINT32, BASE_DEC, NULL, 0x0, "Length in bytes of extra + key + value", HFILL } }, { &hf_opaque, - { "Opaque", "memcache.opaque", - FT_UINT32, BASE_DEC, NULL, 0x0, + { "Opaque", "memcache.opaque", + FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_cas, - { "CAS", "memcache.cas", - FT_UINT64, BASE_DEC, NULL, 0x0, + { "CAS", "memcache.cas", + FT_UINT64, BASE_DEC, NULL, 0x0, "Data version check", HFILL } }, { &hf_extras, - { "Extras", "memcache.extras", - FT_NONE, BASE_NONE, NULL, 0x0, + { "Extras", "memcache.extras", + FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_extras_flags, - { "Flags", "memcache.extras.flags", - FT_UINT32, BASE_HEX, NULL, 0x0, + { "Flags", "memcache.extras.flags", + FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_extras_expiration, - { "Expiration", "memcache.extras.expiration", - FT_UINT32, BASE_DEC, NULL, 0x0, + { "Expiration", "memcache.extras.expiration", + FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_extras_delta, - { "Amount to add", "memcache.extras.delta", - FT_UINT64, BASE_DEC, NULL, 0x0, + { "Amount to add", "memcache.extras.delta", + FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_extras_initial, - { "Initial value", "memcache.extras.initial", - FT_UINT64, BASE_DEC, NULL, 0x0, + { "Initial value", "memcache.extras.initial", + FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_extras_unknown, - { "Unknown", "memcache.extras.unknown", - FT_BYTES, BASE_NONE, NULL, 0x0, + { "Unknown", "memcache.extras.unknown", + FT_BYTES, BASE_NONE, NULL, 0x0, "Unknown Extras", HFILL } }, { &hf_extras_missing, - { "Extras missing", "memcache.extras.missing", - FT_NONE, BASE_NONE, NULL, 0x0, + { "Extras missing", "memcache.extras.missing", + FT_NONE, BASE_NONE, NULL, 0x0, "Extras is mandatory for this command", HFILL } }, { &hf_key, - { "Key", "memcache.key", - FT_STRING, BASE_NONE, NULL, 0x0, + { "Key", "memcache.key", + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_key_missing, - { "Key missing", "memcache.key.missing", - FT_NONE, BASE_NONE, NULL, 0x0, + { "Key missing", "memcache.key.missing", + FT_NONE, BASE_NONE, NULL, 0x0, "Key is mandatory for this command", HFILL } }, { &hf_value, - { "Value", "memcache.value", - FT_STRING, BASE_NONE, NULL, 0x0, + { "Value", "memcache.value", + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_value_missing, - { "Value missing", "memcache.value.missing", - FT_NONE, BASE_NONE, NULL, 0x0, + { "Value missing", "memcache.value.missing", + FT_NONE, BASE_NONE, NULL, 0x0, "Value is mandatory for this command", HFILL } }, - { &hf_uint64_response, - { "Response", "memcache.extras.response", - FT_UINT64, BASE_DEC, NULL, 0x0, + { &hf_uint64_response, + { "Response", "memcache.extras.response", + FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_command, - { "Command", "memcache.command", - FT_STRING, BASE_NONE , NULL, 0x0, + { "Command", "memcache.command", + FT_STRING, BASE_NONE , NULL, 0x0, NULL, HFILL } }, { &hf_subcommand, - { "Sub command", "memcache.subcommand", - FT_STRING, BASE_NONE, NULL, 0x0, + { "Sub command", "memcache.subcommand", + FT_STRING, BASE_NONE, NULL, 0x0, "Sub command if any", HFILL } }, { &hf_flags, - { "Flags", "memcache.flags", - FT_UINT16, BASE_DEC, NULL, 0x0, + { "Flags", "memcache.flags", + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_expiration, - { "Expiration", "memcache.expiration", - FT_UINT32, BASE_DEC, NULL, 0x0, + { "Expiration", "memcache.expiration", + FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_noreply, - { "Noreply", "memcache.noreply", - FT_STRING, BASE_NONE, NULL, 0x0, + { "Noreply", "memcache.noreply", + FT_STRING, BASE_NONE, NULL, 0x0, "Client does not expect a reply", HFILL } }, { &hf_response, - { "Response", "memcache.response", - FT_STRING, BASE_NONE, NULL, 0x0, + { "Response", "memcache.response", + FT_STRING, BASE_NONE, NULL, 0x0, "Response command", HFILL } }, { &hf_version, - { "Version", "memcache.version", - FT_STRING, BASE_NONE, NULL, 0x0, + { "Version", "memcache.version", + FT_STRING, BASE_NONE, NULL, 0x0, "Version of running memcache", HFILL } }, { &hf_slabclass, - { "Slab class", "memcache.slabclass", - FT_UINT32, BASE_DEC, NULL, 0x0, + { "Slab class", "memcache.slabclass", + FT_UINT32, BASE_DEC, NULL, 0x0, "Slab class of a stat", HFILL } }, { &hf_name, - { "Stat name", "memcache.name", - FT_STRING, BASE_NONE, NULL, 0x0, + { "Stat name", "memcache.name", + FT_STRING, BASE_NONE, NULL, 0x0, "Name of a stat", HFILL } }, { &hf_name_value, - { "Stat value", "memcache.name_value", - FT_STRING, BASE_NONE, NULL, 0x0, + { "Stat value", "memcache.name_value", + FT_STRING, BASE_NONE, NULL, 0x0, "Value of a stat", HFILL } }, }; @@ -2134,22 +2134,22 @@ proto_register_memcache (void) proto_memcache = proto_register_protocol (PNAME, PSNAME, PFNAME); register_dissector ("memcache.tcp", dissect_memcache_tcp, proto_memcache); register_dissector ("memcache.udp", dissect_memcache_udp, proto_memcache); - + proto_register_field_array (proto_memcache, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); /* Register our configuration options */ memcache_module = prefs_register_protocol (proto_memcache, NULL); - prefs_register_bool_preference (memcache_module, "desegment_headers", + prefs_register_bool_preference (memcache_module, "desegment_headers", "Reassemble MEMCACHE headers spanning multiple TCP segments", "Whether the MEMCACHE dissector should reassemble headers " "of a request spanning multiple TCP segments. " "To use this option, you must also enable " - "\"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", + "\"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", &memcache_desegment_headers); - prefs_register_bool_preference (memcache_module, "desegment_pdus", + prefs_register_bool_preference (memcache_module, "desegment_pdus", "Reassemble PDUs spanning multiple TCP segments", "Whether the memcache dissector should reassemble PDUs" " spanning multiple TCP segments." @@ -2159,7 +2159,7 @@ proto_register_memcache (void) } /* Register the tcp and udp memcache dissectors. */ -void +void proto_reg_handoff_memcache (void) { dissector_handle_t memcache_tcp_handle; @@ -2177,10 +2177,10 @@ proto_reg_handoff_memcache (void) * * Local Variables: * c-basic-offset: 2 - * tab-width: 2 + * tab-width: 8 * indent-tabs-mode: nil * End: * - * ex: set shiftwidth=2 tabstop=2 expandtab - * :indentSize=2:tabSize=2:noTabs=true: + * ex: set shiftwidth=2 tabstop=8 expandtab + * :indentSize=2:tabSize=8:noTabs=true: */ diff --git a/epan/dissectors/packet-sbus.c b/epan/dissectors/packet-sbus.c index 5bb7b674fe..8e04577db7 100644 --- a/epan/dissectors/packet-sbus.c +++ b/epan/dissectors/packet-sbus.c @@ -1640,10 +1640,10 @@ proto_reg_handoff_sbus(void) * * Local Variables: * c-basic-offset: 7 - * tab-width: 7 + * tab-width: 8 * indent-tabs-mode: nil * End: * - * ex: set shiftwidth=3 tabstop=3 expandtab - * :indentSize=7:tabSize=7:noTabs=true: + * ex: set shiftwidth=7 tabstop=8 expandtab + * :indentSize=7:tabSize=8:noTabs=true: */ |