Add RFC 1702 GRE-over-IPv4.
[obnox/wireshark/wip.git] / packet-nntp.c
index 06af7db8d167e7efc31c26ba40df46933d69e6e7..0c77c7751c057ee3dfd0d2825e08cf74c5800e79 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for nntp packet dissection
  * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
  *
- * $Id: packet-nntp.c,v 1.4 1999/08/18 00:57:52 guy Exp $
+ * $Id: packet-nntp.c,v 1.6 1999/11/16 11:42:42 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@unicom.net>
 #include "packet.h"
 
 static int proto_nntp = -1;
+static int hf_nntp_response = -1;
+static int hf_nntp_request = -1;
+
+static gint ett_nntp = -1;
 
 void
 dissect_nntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
@@ -79,7 +83,13 @@ dissect_nntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
        if (tree) {
 
          ti = proto_tree_add_item(tree, proto_nntp, offset, END_OF_FRAME, NULL);
-         nntp_tree = proto_item_add_subtree(ti, ETT_NNTP);
+         nntp_tree = proto_item_add_subtree(ti, ett_nntp);
+
+         if (pi.match_port == pi.destport) {
+           proto_tree_add_item_hidden(nntp_tree, hf_nntp_request, 0, 0, TRUE);
+         } else {
+           proto_tree_add_item_hidden(nntp_tree, hf_nntp_response, 0, 0, TRUE);
+         }
 
          /*
           * Show the request or response as text, a line at a time.
@@ -110,11 +120,24 @@ dissect_nntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
 void
 proto_register_nntp(void)
 {
-/*        static hf_register_info hf[] = {
-                { &variable,
-                { "Name",           "nntp.abbreviation", TYPE, VALS_POINTER }},
-        };*/
-
-        proto_nntp = proto_register_protocol("Network News Transfer Protocol", "nntp");
- /*       proto_register_field_array(proto_nntp, hf, array_length(hf));*/
+  
+  static hf_register_info hf[] = {
+    { &hf_nntp_response,
+      { "Response",           "nntp.response",
+       FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+       "TRUE if NNTP response" }},
+
+    { &hf_nntp_request,
+      { "Request",            "nntp.request",
+       FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+       "TRUE if NNTP request" }}
+  };
+  static gint *ett[] = {
+    &ett_nntp,
+  };
+
+  proto_nntp = proto_register_protocol("Network News Transfer Protocol", 
+                                      "nntp");
+  proto_register_field_array(proto_nntp, hf, array_length(hf));
+  proto_register_subtree_array(ett, array_length(ett));
 }