diff options
author | Bill Meier <wmeier@newsguy.com> | 2010-12-17 21:31:55 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2010-12-17 21:31:55 +0000 |
commit | 9fb850cf5bf8087ac13121b0ecce1542c88672eb (patch) | |
tree | 2430e9d1b0bb5b50ebfac09761fa9c2ecf553e82 /docbook/wsdg_src | |
parent | 160bee8c168498b021c9d20da5cb91690d7f4b6b (diff) |
Convert indentation tabs within <programlisting> elements to 4 spaces.
As the book says:
"Often a program listing will include tab characters to indent lines of code.
When such a listing is imported to DocBook XML and formatted, the tab
characters are not expanded as they are in the program editor.
That's because in XSL-FO and HTML, tab stops and tab expansion are not
described in either HTML or XSL-FO standards.
By default, an XSL-FO processor treats a tab character as a single space,
which leads to unsatisfactory results."
http://www.sagehill.net/docbookxsl/TabExpansion.html
svn path=/trunk/; revision=35215
Diffstat (limited to 'docbook/wsdg_src')
-rw-r--r-- | docbook/wsdg_src/WSDG_chapter_dissection.xml | 520 |
1 files changed, 260 insertions, 260 deletions
diff --git a/docbook/wsdg_src/WSDG_chapter_dissection.xml b/docbook/wsdg_src/WSDG_chapter_dissection.xml index 9e1c37ddd6..90b969519c 100644 --- a/docbook/wsdg_src/WSDG_chapter_dissection.xml +++ b/docbook/wsdg_src/WSDG_chapter_dissection.xml @@ -89,11 +89,11 @@ static int proto_foo = -1; void proto_register_foo(void) { - proto_foo = proto_register_protocol ( - "FOO Protocol", /* name */ - "FOO", /* short name */ - "foo" /* abbrev */ - ); + proto_foo = proto_register_protocol ( + "FOO Protocol", /* name */ + "FOO", /* short name */ + "foo" /* abbrev */ + ); }]]> </programlisting></example> <para> @@ -111,9 +111,9 @@ proto_register_foo(void) Then a #define for the UDP port that we'll assume we are dissecting traffic for. </para> <para> - Now that we have the basics in place to interact with the main program, we'll + Now that we have the basics in place to interact with the main program, we'll start with two protocol dissector setup functions. - + </para> <para> First we'll call the proto_register_protocol function which registers the protocol. @@ -130,21 +130,21 @@ proto_register_foo(void) <![CDATA[void proto_reg_handoff_foo(void) { - static dissector_handle_t foo_handle; + static dissector_handle_t foo_handle; - foo_handle = create_dissector_handle(dissect_foo, proto_foo); - dissector_add("udp.port", FOO_PORT, foo_handle); + foo_handle = create_dissector_handle(dissect_foo, proto_foo); + dissector_add("udp.port", FOO_PORT, foo_handle); }]]> </programlisting></example> <para> What's happening here? We are initialising the dissector. First we create a dissector handle; It is associated with the foo protocol and - with a routine to be called to do the actual dissecting. + with a routine to be called to do the actual dissecting. Then we associate the handle with a UDP port number so that the main program will know to call us when it gets UDP traffic on that port. </para> <para> - The stardard Wireshark dissector convention is to put proto_register_foo and + The stardard Wireshark dissector convention is to put proto_register_foo and proto_reg_handoff_foo as the last two functions in the dissector source. </para> <para> @@ -156,9 +156,9 @@ proto_reg_handoff_foo(void) <![CDATA[static void dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - col_set_str(pinfo->cinfo, COL_PROTOCOL, "FOO"); - /* Clear out stuff in the info column */ - col_clear(pinfo->cinfo,COL_INFO); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "FOO"); + /* Clear out stuff in the info column */ + col_clear(pinfo->cinfo,COL_INFO); }]]> </programlisting></example> <para> @@ -239,14 +239,14 @@ dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - col_set_str(pinfo->cinfo, COL_PROTOCOL, "FOO"); - /* Clear out stuff in the info column */ - col_clear(pinfo->cinfo,COL_INFO); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "FOO"); + /* Clear out stuff in the info column */ + col_clear(pinfo->cinfo,COL_INFO); - if (tree) { /* we are being asked for details */ - proto_item *ti = NULL; - ti = proto_tree_add_item(tree, proto_foo, tvb, 0, -1, FALSE); - } + if (tree) { /* we are being asked for details */ + proto_item *ti = NULL; + ti = proto_tree_add_item(tree, proto_foo, tvb, 0, -1, FALSE); + } }]]> </programlisting></example> <para> @@ -270,7 +270,7 @@ dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) <para> Now let's go to the next step and add some protocol dissection. For this step we'll need to construct a couple of tables that help with dissection. - This needs some additions to the proto_register_foo function shown previously. + This needs some additions to the proto_register_foo function shown previously. </para> <para> Two statically allocated arrays are added at the beginning of proto_register_foo. The @@ -281,28 +281,28 @@ dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) <![CDATA[void proto_register_foo(void) { - static hf_register_info hf[] = { - { &hf_foo_pdu_type, - { "FOO PDU Type", "foo.type", - FT_UINT8, BASE_DEC, - NULL, 0x0, - NULL, HFILL } - } - }; + static hf_register_info hf[] = { + { &hf_foo_pdu_type, + { "FOO PDU Type", "foo.type", + FT_UINT8, BASE_DEC, + NULL, 0x0, + NULL, HFILL } + } + }; - /* Setup protocol subtree array */ - static gint *ett[] = { - &ett_foo - }; + /* Setup protocol subtree array */ + static gint *ett[] = { + &ett_foo + }; - proto_foo = proto_register_protocol ( - "FOO Protocol", /* name */ - "FOO", /* short name */ - "foo" /* abbrev */ - ); + proto_foo = proto_register_protocol ( + "FOO Protocol", /* name */ + "FOO", /* short name */ + "foo" /* abbrev */ + ); - proto_register_field_array(proto_foo, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); + proto_register_field_array(proto_foo, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); }]]> </programlisting></example> <para> @@ -320,14 +320,14 @@ static gint ett_foo = -1;]]> </para> <example><title>Dissector starting to dissect the packets.</title> <programlisting> -<![CDATA[ if (tree) { /* we are being asked for details */ - proto_item *ti = NULL; - proto_tree *foo_tree = NULL; +<![CDATA[ if (tree) { /* we are being asked for details */ + proto_item *ti = NULL; + proto_tree *foo_tree = NULL; - ti = proto_tree_add_item(tree, proto_foo, tvb, 0, -1, FALSE); - foo_tree = proto_item_add_subtree(ti, ett_foo); - proto_tree_add_item(foo_tree, hf_foo_pdu_type, tvb, 0, 1, FALSE); - }]]> + ti = proto_tree_add_item(tree, proto_foo, tvb, 0, -1, FALSE); + foo_tree = proto_item_add_subtree(ti, ett_foo); + proto_tree_add_item(foo_tree, hf_foo_pdu_type, tvb, 0, 1, FALSE); + }]]> </programlisting></example> <para> Now the dissection is starting to look more interesting. We have picked apart @@ -392,48 +392,48 @@ static int hf_foo_initialip = -1; static void dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - gint offset = 0; + gint offset = 0; - ... + ... - if (tree) { /* we are being asked for details */ - proto_item *ti = NULL; - proto_tree *foo_tree = NULL; + if (tree) { /* we are being asked for details */ + proto_item *ti = NULL; + proto_tree *foo_tree = NULL; - ti = proto_tree_add_item(tree, proto_foo, tvb, 0, -1, FALSE); - foo_tree = proto_item_add_subtree(ti, ett_foo); - proto_tree_add_item(foo_tree, hf_foo_pdu_type, tvb, offset, 1, FALSE); offset += 1; - proto_tree_add_item(foo_tree, hf_foo_flags, tvb, offset, 1, FALSE); offset += 1; - proto_tree_add_item(foo_tree, hf_foo_sequenceno, tvb, offset, 2, FALSE); offset += 2; - proto_tree_add_item(foo_tree, hf_foo_initialip, tvb, offset, 4, FALSE); offset += 4; - } - ... + ti = proto_tree_add_item(tree, proto_foo, tvb, 0, -1, FALSE); + foo_tree = proto_item_add_subtree(ti, ett_foo); + proto_tree_add_item(foo_tree, hf_foo_pdu_type, tvb, offset, 1, FALSE); offset += 1; + proto_tree_add_item(foo_tree, hf_foo_flags, tvb, offset, 1, FALSE); offset += 1; + proto_tree_add_item(foo_tree, hf_foo_sequenceno, tvb, offset, 2, FALSE); offset += 2; + proto_tree_add_item(foo_tree, hf_foo_initialip, tvb, offset, 4, FALSE); offset += 4; + } + ... } void proto_register_foo(void) { - ... - ... - { &hf_foo_flags, - { "FOO PDU Flags", "foo.flags", - FT_UINT8, BASE_HEX, - NULL, 0x0, - NULL, HFILL } - }, - { &hf_foo_sequenceno, - { "FOO PDU Sequence Number", "foo.seqn", - FT_UINT16, BASE_DEC, - NULL, 0x0, - NULL, HFILL } - }, - { &hf_foo_initialip, - { "FOO PDU Initial IP", "foo.initialip", - FT_IPv4, BASE_NONE, - NULL, 0x0, - NULL, HFILL } - }, - ... - ... + ... + ... + { &hf_foo_flags, + { "FOO PDU Flags", "foo.flags", + FT_UINT8, BASE_HEX, + NULL, 0x0, + NULL, HFILL } + }, + { &hf_foo_sequenceno, + { "FOO PDU Sequence Number", "foo.seqn", + FT_UINT16, BASE_DEC, + NULL, 0x0, + NULL, HFILL } + }, + { &hf_foo_initialip, + { "FOO PDU Initial IP", "foo.initialip", + FT_IPv4, BASE_NONE, + NULL, 0x0, + NULL, HFILL } + }, + ... + ... } ...]]> </programlisting></example> @@ -453,10 +453,10 @@ proto_register_foo(void) { <example><title>Naming the packet types.</title> <programlisting> <![CDATA[static const value_string packettypenames[] = { - { 1, "Initialise" }, - { 2, "Terminate" }, - { 3, "Data" }, - { 0, NULL } + { 1, "Initialise" }, + { 2, "Terminate" }, + { 3, "Data" }, + { 0, NULL } };]]> </programlisting></example> <para> @@ -467,12 +467,12 @@ proto_register_foo(void) { </para> <example><title>Adding Names to the protocol.</title> <programlisting> -<![CDATA[ { &hf_foo_pdu_type, - { "FOO PDU Type", "foo.type", - FT_UINT8, BASE_DEC, - VALS(packettypenames), 0x0, - NULL, HFILL } - }]]> +<![CDATA[ { &hf_foo_pdu_type, + { "FOO PDU Type", "foo.type", + FT_UINT8, BASE_DEC, + VALS(packettypenames), 0x0, + NULL, HFILL } + }]]> </programlisting></example> <para> This helps in deciphering the packets, and we can do a similar thing for the @@ -480,9 +480,9 @@ proto_register_foo(void) { </para> <example><title>Adding Flags to the protocol.</title> <programlisting> -<![CDATA[#define FOO_START_FLAG 0x01 -#define FOO_END_FLAG 0x02 -#define FOO_PRIORITY_FLAG 0x04 +<![CDATA[#define FOO_START_FLAG 0x01 +#define FOO_END_FLAG 0x02 +#define FOO_PRIORITY_FLAG 0x04 static int hf_foo_startflag = -1; static int hf_foo_endflag = -1; @@ -491,40 +491,40 @@ static int hf_foo_priorityflag = -1; static void dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - ... - ... - proto_tree_add_item(foo_tree, hf_foo_flags, tvb, offset, 1, FALSE); - proto_tree_add_item(foo_tree, hf_foo_startflag, tvb, offset, 1, FALSE); - proto_tree_add_item(foo_tree, hf_foo_endflag, tvb, offset, 1, FALSE); - proto_tree_add_item(foo_tree, hf_foo_priorityflag, tvb, offset, 1, FALSE); offset += 1; - ... - ... + ... + ... + proto_tree_add_item(foo_tree, hf_foo_flags, tvb, offset, 1, FALSE); + proto_tree_add_item(foo_tree, hf_foo_startflag, tvb, offset, 1, FALSE); + proto_tree_add_item(foo_tree, hf_foo_endflag, tvb, offset, 1, FALSE); + proto_tree_add_item(foo_tree, hf_foo_priorityflag, tvb, offset, 1, FALSE); offset += 1; + ... + ... } void proto_register_foo(void) { - ... - ... - { &hf_foo_startflag, - { "FOO PDU Start Flags", "foo.flags.start", - FT_BOOLEAN, 8, - NULL, FOO_START_FLAG, - NULL, HFILL } - }, - { &hf_foo_endflag, - { "FOO PDU End Flags", "foo.flags.end", - FT_BOOLEAN, 8, - NULL, FOO_END_FLAG, - NULL, HFILL } - }, - { &hf_foo_priorityflag, - { "FOO PDU Priority Flags", "foo.flags.priority", - FT_BOOLEAN, 8, - NULL, FOO_PRIORITY_FLAG, - NULL, HFILL } - }, - ... - ... + ... + ... + { &hf_foo_startflag, + { "FOO PDU Start Flags", "foo.flags.start", + FT_BOOLEAN, 8, + NULL, FOO_START_FLAG, + NULL, HFILL } + }, + { &hf_foo_endflag, + { "FOO PDU End Flags", "foo.flags.end", + FT_BOOLEAN, 8, + NULL, FOO_END_FLAG, + NULL, HFILL } + }, + { &hf_foo_priorityflag, + { "FOO PDU Priority Flags", "foo.flags.priority", + FT_BOOLEAN, 8, + NULL, FOO_PRIORITY_FLAG, + NULL, HFILL } + }, + ... + ... } ...]]> </programlisting></example> @@ -553,26 +553,26 @@ proto_register_foo(void) { <![CDATA[static void dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - guint8 packet_type = tvb_get_guint8(tvb, 0); + guint8 packet_type = tvb_get_guint8(tvb, 0); - col_set_str(pinfo->cinfo, COL_PROTOCOL, "FOO"); - /* Clear out stuff in the info column */ - col_clear(pinfo->cinfo,COL_INFO); - col_add_fstr(pinfo->cinfo, COL_INFO, "Type %s", - val_to_str(packet_type, packettypenames, "Unknown (0x%02x)")); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "FOO"); + /* Clear out stuff in the info column */ + col_clear(pinfo->cinfo,COL_INFO); + col_add_fstr(pinfo->cinfo, COL_INFO, "Type %s", + val_to_str(packet_type, packettypenames, "Unknown (0x%02x)")); - if (tree) { /* we are being asked for details */ - proto_item *ti = NULL; - proto_tree *foo_tree = NULL; - gint offset = 0; + if (tree) { /* we are being asked for details */ + proto_item *ti = NULL; + proto_tree *foo_tree = NULL; + gint offset = 0; - ti = proto_tree_add_item(tree, proto_foo, tvb, 0, -1, FALSE); - proto_item_append_text(ti, ", Type %s", - val_to_str(packet_type, packettypenames, "Unknown (0x%02x)")); - foo_tree = proto_item_add_subtree(ti, ett_foo); - proto_tree_add_item(foo_tree, hf_foo_pdu_type, tvb, offset, 1, FALSE); - offset += 1; - } + ti = proto_tree_add_item(tree, proto_foo, tvb, 0, -1, FALSE); + proto_item_append_text(ti, ", Type %s", + val_to_str(packet_type, packettypenames, "Unknown (0x%02x)")); + foo_tree = proto_item_add_subtree(ti, ett_foo); + proto_tree_add_item(foo_tree, hf_foo_pdu_type, tvb, offset, 1, FALSE); + offset += 1; + } }]]> </programlisting></example> <para> @@ -611,24 +611,24 @@ dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) <example><title>Decompressing data packets for dissection.</title> <programlisting> <![CDATA[ - guint8 flags = tvb_get_guint8(tvb, offset); - offset ++; - if (flags & FLAG_COMPRESSED) { /* the remainder of the packet is compressed */ - guint16 orig_size = tvb_get_ntohs(tvb, offset); - guchar *decompressed_buffer = (guchar*)g_malloc(orig_size); - offset += 2; - decompress_packet(tvb_get_ptr(tvb, offset, -1), - tvb_length_remaining(tvb, offset), - decompressed_buffer, orig_size); - /* Now re-setup the tvb buffer to have the new data */ - next_tvb = tvb_new_real_data(decompressed_buffer, orig_size, orig_size); - tvb_set_child_real_data_tvbuff(tvb, next_tvb); - add_new_data_source(pinfo, next_tvb, "Decompressed Data"); - } else { - next_tvb = tvb_new_subset(tvb, offset, -1, -1); - } - offset = 0; - /* process next_tvb from here on */ + guint8 flags = tvb_get_guint8(tvb, offset); + offset ++; + if (flags & FLAG_COMPRESSED) { /* the remainder of the packet is compressed */ + guint16 orig_size = tvb_get_ntohs(tvb, offset); + guchar *decompressed_buffer = (guchar*)g_malloc(orig_size); + offset += 2; + decompress_packet(tvb_get_ptr(tvb, offset, -1), + tvb_length_remaining(tvb, offset), + decompressed_buffer, orig_size); + /* Now re-setup the tvb buffer to have the new data */ + next_tvb = tvb_new_real_data(decompressed_buffer, orig_size, orig_size); + tvb_set_child_real_data_tvbuff(tvb, next_tvb); + add_new_data_source(pinfo, next_tvb, "Decompressed Data"); + } else { + next_tvb = tvb_new_subset(tvb, offset, -1, -1); + } + offset = 0; + /* process next_tvb from here on */ ]]> </programlisting></example> <para> @@ -700,15 +700,15 @@ dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) </para> <programlisting> <![CDATA[msg_pkt ::= SEQUENCE { - ..... - flags ::= SEQUENCE { - fragment BOOLEAN, - last_fragment BOOLEAN, - ..... - } - msg_id INTEGER(0..65535), - frag_id INTEGER(0..65535), - ..... + ..... + flags ::= SEQUENCE { + fragment BOOLEAN, + last_fragment BOOLEAN, + ..... + } + msg_id INTEGER(0..65535), + frag_id INTEGER(0..65535), + ..... }]]> </programlisting> <example><title>Reassembling fragments - Part 1</title> @@ -718,19 +718,19 @@ dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) save_fragmented = pinfo->fragmented; flags = tvb_get_guint8(tvb, offset); offset++; if (flags & FL_FRAGMENT) { /* fragmented */ - tvbuff_t* new_tvb = NULL; - fragment_data *frag_msg = NULL; - guint16 msg_seqid = tvb_get_ntohs(tvb, offset); offset += 2; - guint16 msg_num = tvb_get_ntohs(tvb, offset); offset += 2; + tvbuff_t* new_tvb = NULL; + fragment_data *frag_msg = NULL; + guint16 msg_seqid = tvb_get_ntohs(tvb, offset); offset += 2; + guint16 msg_num = tvb_get_ntohs(tvb, offset); offset += 2; - pinfo->fragmented = TRUE; - frag_msg = fragment_add_seq_check(tvb, offset, pinfo, - msg_seqid, /* ID for fragments belonging together */ - msg_fragment_table, /* list of message fragments */ - msg_reassembled_table, /* list of reassembled messages */ - msg_num, /* fragment sequence number */ - tvb_length_remaining(tvb, offset), /* fragment length - to the end */ - flags & FL_FRAG_LAST); /* More fragments? */]]> + pinfo->fragmented = TRUE; + frag_msg = fragment_add_seq_check(tvb, offset, pinfo, + msg_seqid, /* ID for fragments belonging together */ + msg_fragment_table, /* list of message fragments */ + msg_reassembled_table, /* list of reassembled messages */ + msg_num, /* fragment sequence number */ + tvb_length_remaining(tvb, offset), /* fragment length - to the end */ + flags & FL_FRAG_LAST); /* More fragments? */]]> </programlisting></example> <para> We start by saving the fragmented state of this packet, so we can restore it later. @@ -772,27 +772,27 @@ if (flags & FL_FRAGMENT) { /* fragmented */ </itemizedlist> <example><title>Reassembling fragments part 2</title> <programlisting> - <![CDATA[ - new_tvb = process_reassembled_data(tvb, offset, pinfo, - "Reassembled Message", frag_msg, &msg_frag_items, - NULL, msg_tree); + <![CDATA[ + new_tvb = process_reassembled_data(tvb, offset, pinfo, + "Reassembled Message", frag_msg, &msg_frag_items, + NULL, msg_tree); - if (frag_msg) { /* Reassembled */ - col_append_str(pinfo->cinfo, COL_INFO, - " (Message Reassembled)"); - } else { /* Not last packet of reassembled Short Message */ - col_append_fstr(pinfo->cinfo, COL_INFO, - " (Message fragment %u)", msg_num); - } + if (frag_msg) { /* Reassembled */ + col_append_str(pinfo->cinfo, COL_INFO, + " (Message Reassembled)"); + } else { /* Not last packet of reassembled Short Message */ + col_append_fstr(pinfo->cinfo, COL_INFO, + " (Message fragment %u)", msg_num); + } - if (new_tvb) { /* take it all */ - next_tvb = new_tvb; - } else { /* make a new subset */ - next_tvb = tvb_new_subset(tvb, offset, -1, -1); - } + if (new_tvb) { /* take it all */ + next_tvb = new_tvb; + } else { /* make a new subset */ + next_tvb = tvb_new_subset(tvb, offset, -1, -1); + } } else { /* Not fragmented */ - next_tvb = tvb_new_subset(tvb, offset, -1, -1); + next_tvb = tvb_new_subset(tvb, offset, -1, -1); } ..... @@ -823,8 +823,8 @@ static GHashTable *msg_reassembled_table = NULL; static void msg_init_protocol(void) { - fragment_table_init(&msg_fragment_table); - reassembled_table_init(&msg_reassembled_table); + fragment_table_init(&msg_fragment_table); + reassembled_table_init(&msg_reassembled_table); }]]> </programlisting></example> <para> @@ -854,57 +854,57 @@ static gint ett_msg_fragment = -1; static gint ett_msg_fragments = -1; ... static const fragment_items msg_frag_items = { - /* Fragment subtrees */ - &ett_msg_fragment, - &ett_msg_fragments, - /* Fragment fields */ - &hf_msg_fragments, - &hf_msg_fragment, - &hf_msg_fragment_overlap, - &hf_msg_fragment_overlap_conflicts, - &hf_msg_fragment_multiple_tails, - &hf_msg_fragment_too_long_fragment, - &hf_msg_fragment_error, - /* Reassembled in field */ - &hf_msg_reassembled_in, - /* Reassembled length field */ - &hf_msg_reassembled_length, - /* Tag */ - "Message fragments" + /* Fragment subtrees */ + &ett_msg_fragment, + &ett_msg_fragments, + /* Fragment fields */ + &hf_msg_fragments, + &hf_msg_fragment, + &hf_msg_fragment_overlap, + &hf_msg_fragment_overlap_conflicts, + &hf_msg_fragment_multiple_tails, + &hf_msg_fragment_too_long_fragment, + &hf_msg_fragment_error, + /* Reassembled in field */ + &hf_msg_reassembled_in, + /* Reassembled length field */ + &hf_msg_reassembled_length, + /* Tag */ + "Message fragments" }; ... static hf_register_info hf[] = { ... {&hf_msg_fragments, - {"Message fragments", "msg.fragments", - FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } }, + {"Message fragments", "msg.fragments", + FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } }, {&hf_msg_fragment, - {"Message fragment", "msg.fragment", - FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } }, + {"Message fragment", "msg.fragment", + FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } }, {&hf_msg_fragment_overlap, - {"Message fragment overlap", "msg.fragment.overlap", - FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } }, + {"Message fragment overlap", "msg.fragment.overlap", + FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } }, {&hf_msg_fragment_overlap_conflicts, - {"Message fragment overlapping with conflicting data", - "msg.fragment.overlap.conflicts", - FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } }, + {"Message fragment overlapping with conflicting data", + "msg.fragment.overlap.conflicts", + FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } }, {&hf_msg_fragment_multiple_tails, - {"Message has multiple tail fragments", - "msg.fragment.multiple_tails", - FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } }, + {"Message has multiple tail fragments", + "msg.fragment.multiple_tails", + FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } }, {&hf_msg_fragment_too_long_fragment, - {"Message fragment too long", "msg.fragment.too_long_fragment", - FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } }, + {"Message fragment too long", "msg.fragment.too_long_fragment", + FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } }, {&hf_msg_fragment_error, - {"Message defragmentation error", "msg.fragment.error", - FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } }, + {"Message defragmentation error", "msg.fragment.error", + FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } }, {&hf_msg_reassembled_in, - {"Reassembled in", "msg.reassembled.in", - FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } }, + {"Reassembled in", "msg.reassembled.in", + FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } }, {&hf_msg_reassembled_length, - {"Reassembled length", "msg.reassembled.length", - FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } }, + {"Reassembled length", "msg.reassembled.length", + FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } }, ... static gint *ett[] = { @@ -1028,15 +1028,15 @@ static guint get_foo_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset) static int foo_tap = -1; struct FooTap { - gint packet_type; - gint priority; - ... + gint packet_type; + gint priority; + ... }; void proto_register_foo(void) { - ... - foo_tap = register_tap("foo");]]> + ... + foo_tap = register_tap("foo");]]> </programlisting></example> <para> Whilst you can program a tap without protocol specific data, it @@ -1060,12 +1060,12 @@ void proto_register_foo(void) <![CDATA[ void dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - ... - fooinfo = ep_alloc(sizeof(struct FooTap)); - fooinfo->packet_type = tvb_get_guint8(tvb, 0); - fooinfo->priority = tvb_get_ntohs(tvb, 8); - ... - tap_queue_packet(foo_tap, pinfo, fooinfo); + ... + fooinfo = ep_alloc(sizeof(struct FooTap)); + fooinfo->packet_type = tvb_get_guint8(tvb, 0); + fooinfo->priority = tvb_get_ntohs(tvb, 8); + ... + tap_queue_packet(foo_tap, pinfo, fooinfo); } ]]> </programlisting></example> @@ -1094,15 +1094,15 @@ void dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) <programlisting> <![CDATA[/* register all http trees */ static void register_foo_stat_trees(void) { - stats_tree_register("foo", "foo", "Foo/Packet Types", - foo_stats_tree_packet, foo_stats_tree_init, NULL); + stats_tree_register("foo", "foo", "Foo/Packet Types", + foo_stats_tree_packet, foo_stats_tree_init, NULL); } G_MODULE_EXPORT const gchar version[] = "0.0"; G_MODULE_EXPORT void plugin_register_tap_listener(void) { - register_foo_stat_trees(); + register_foo_stat_trees(); } #endif]]> @@ -1148,8 +1148,8 @@ static int st_node_packet_types = -1; static void foo_stats_tree_init(stats_tree* st) { - st_node_packets = stats_tree_create_node(st, st_str_packets, 0, TRUE); - st_node_packet_types = stats_tree_create_pivot(st, st_str_packet_types, st_node_packets); + st_node_packets = stats_tree_create_node(st, st_str_packets, 0, TRUE); + st_node_packet_types = stats_tree_create_pivot(st, st_str_packet_types, st_node_packets); }]]> </programlisting></example> <para> @@ -1161,11 +1161,11 @@ static void foo_stats_tree_init(stats_tree* st) <programlisting> <![CDATA[static int foo_stats_tree_packet(stats_tree* st, packet_info* pinfo, epan_dissect_t* edt, const void* p) { - struct FooTap *pi = (struct FooTap *)p; - tick_stat_node(st, st_str_packets, 0, FALSE); - stats_tree_tick_pivot(st, st_node_packet_types, - val_to_str(pi->packet_type, msgtypevalues, "Unknown packet type (%d)")); - return 1; + struct FooTap *pi = (struct FooTap *)p; + tick_stat_node(st, st_str_packets, 0, FALSE); + stats_tree_tick_pivot(st, st_node_packet_types, + val_to_str(pi->packet_type, msgtypevalues, "Unknown packet type (%d)")); + return 1; }]]> </programlisting></example> <para> |