From 3da55888e6d89aa1dc0cc59fc52b4cd1b31cfa2e Mon Sep 17 00:00:00 2001 From: Jaap Keuter Date: Sun, 6 May 2007 19:25:14 +0000 Subject: Improve readability of code samples and program output svn path=/trunk/; revision=21701 --- docbook/wsdg_src/WSDG_chapter_dissection.xml | 112 +++++++++++++-------------- docbook/wsdg_src/WSDG_chapter_tools.xml | 39 +++++----- 2 files changed, 73 insertions(+), 78 deletions(-) (limited to 'docbook/wsdg_src') diff --git a/docbook/wsdg_src/WSDG_chapter_dissection.xml b/docbook/wsdg_src/WSDG_chapter_dissection.xml index 69d229a0d0..19cd6a78b5 100644 --- a/docbook/wsdg_src/WSDG_chapter_dissection.xml +++ b/docbook/wsdg_src/WSDG_chapter_dissection.xml @@ -144,20 +144,19 @@ plugin_reg_handoff(void){ Plugin Initialisation. - @@ -174,8 +173,7 @@ proto_register_foo(void) Plugin Handoff. - Plugin Dissection. - cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "FOO"); /* Clear out stuff in the info column */ - if(check_col(pinfo->cinfo,COL_INFO)){ + if (check_col(pinfo->cinfo,COL_INFO)) { col_clear(pinfo->cinfo,COL_INFO); } }]]> @@ -241,7 +238,7 @@ dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) Makefile.nmake for Windows. - Makefile.am for unix/linux. - Plugin Packet Dissection. - Plugin Registering data structures. - + &ett_foo +};]]> Then, after the registration code, we register these arrays. Plugin Registering data structures. - + The variables hf_foo_pdu_type and ett_foo also need to be declared @@ -476,30 +467,32 @@ static int hf_foo_sequenceno = -1; static int hf_foo_initialip = -1; ... { &hf_foo_flags, - { "FOO PDU Flags", "foo.flags", - FT_UINT8, BASE_HEX, NULL, 0x0, - "", HFILL } + { "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, - "", HFILL } + { "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, - "", HFILL } + { "FOO PDU Initial IP", "foo.initialip", + FT_IPv4, BASE_NONE, + NULL, 0x0, + NULL, HFILL } }, -... - gint offset = 0; - 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; + gint offset = 0; + 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; ]]> @@ -540,7 +533,7 @@ static const value_string packettypenames[] = { FT_UINT8, BASE_DEC, VALS(packettypenames), 0x0, NULL, HFILL } - }, + } ]]> @@ -605,8 +598,7 @@ static int hf_foo_priorityflag = -1; Enhancing the display. - cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "FOO"); /* Clear out stuff in the info column */ - if(check_col(pinfo->cinfo,COL_INFO)){ + if (check_col(pinfo->cinfo,COL_INFO)) { col_clear(pinfo->cinfo,COL_INFO); } if (check_col(pinfo->cinfo, COL_INFO)) { @@ -631,7 +623,8 @@ dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) 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; + proto_tree_add_item(foo_tree, hf_foo_pdu_type, tvb, offset, 1, FALSE); + offset += 1; ... ]]> @@ -671,12 +664,14 @@ dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) Decompressing data packets for dissection. fragmented = save_fragmented; - ]]> +]]> Having passed the fragment data to the reassembly handler, we can @@ -1213,7 +1208,7 @@ 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_packet_types = stats_tree_create_pivot(st, st_str_packet_types, st_node_packets); } ]]> @@ -1225,7 +1220,8 @@ static void foo_stats_tree_init(stats_tree* st) { Generating the stats should result in something like: - @@ -168,7 +168,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.]]> should result in something like: - should result in something like: - should result in something like: - @@ -802,7 +802,7 @@ usage: cl [ option... ] filename... [ /link linkoption... ]]> should result in something like: - should result in something like: - However, the version string may vary. @@ -1102,7 +1102,7 @@ Copyright (C) 2005 Free Software Foundation, Inc.]]> should result in something like: - + However, the version string may vary. @@ -1129,7 +1129,7 @@ Copyright (C) 2005 Free Software Foundation, Inc.]]> should result in something like: - should result in something like: - should result in something like: - should result in something like: - should result in something like: - + However, the version string may vary.
@@ -1299,7 +1299,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.]]> should result in something like: - should result in something like: - @@ -1387,7 +1387,7 @@ Copyright (C) 2000-2006 CollabNet. should result in something like: - should result in something like: - available as a Cygwin package), you can get it at: . If wget is trying to download files but fails to do so, - your internet connection might use a HTTP proxy. Some Internet + your Internet connection might use a HTTP proxy. Some Internet providers using such a proxy and it is common for company networks today. In this case, you must set the environment - variable http_proxy before using wget. For example, if you are + variable HTTP_PROXY before using wget. For example, if you are behind proxy.com which is listening on port 8080, you have to set it to something like: - set - HTTP_PROXY=http://proxy.com:8080/ + set HTTP_PROXY=http://proxy.com:8080/ If you are unsure about the settings, you might ask your system administrator. -- cgit v1.2.1