* 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)
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.
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));
}