aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packet-lapb.c13
-rw-r--r--packet-v120.c4
-rw-r--r--packet-x25.c167
-rw-r--r--packet-xot.c155
-rw-r--r--wiretap/i4btrace.c4
-rw-r--r--wiretap/nettl.c5
-rw-r--r--wiretap/ngsniffer.c6
-rw-r--r--wiretap/radcom.c6
-rw-r--r--wiretap/visual.c10
-rw-r--r--wiretap/wtap.h6
10 files changed, 289 insertions, 87 deletions
diff --git a/packet-lapb.c b/packet-lapb.c
index 79e25b5147..f781a0c78b 100644
--- a/packet-lapb.c
+++ b/packet-lapb.c
@@ -2,7 +2,7 @@
* Routines for lapb frame disassembly
* Olivier Abad <oabad@cybercable.fr>
*
- * $Id: packet-lapb.c,v 1.34 2002/01/24 09:20:49 guy Exp $
+ * $Id: packet-lapb.c,v 1.35 2002/04/09 08:15:02 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -37,8 +37,6 @@
#include <epan/packet.h>
#include "xdlc.h"
-#define FROM_DCE 0x80
-
static int proto_lapb = -1;
static int hf_lapb_address = -1;
static int hf_lapb_control = -1;
@@ -46,7 +44,7 @@ static int hf_lapb_control = -1;
static gint ett_lapb = -1;
static gint ett_lapb_control = -1;
-static dissector_handle_t x25_handle;
+static dissector_handle_t x25_dir_handle;
static void
dissect_lapb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -108,7 +106,7 @@ dissect_lapb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* not end of frame ==> X.25 */
if (tvb_reported_length(tvb) > 2) {
next_tvb = tvb_new_subset(tvb, 2, -1, -1);
- call_dissector(x25_handle, next_tvb, pinfo, tree);
+ call_dissector(x25_dir_handle, next_tvb, pinfo, tree);
}
}
@@ -143,9 +141,10 @@ proto_reg_handoff_lapb(void)
dissector_handle_t lapb_handle;
/*
- * Get a handle for the X.25 dissector.
+ * Get a handle for the X.25 dissector; we will be getting an
+ * X.25 pseudo-header, so call the dissector that can handle it.
*/
- x25_handle = find_dissector("x.25");
+ x25_dir_handle = find_dissector("x.25_dir");
lapb_handle = find_dissector("lapb");
dissector_add("wtap_encap", WTAP_ENCAP_LAPB, lapb_handle);
diff --git a/packet-v120.c b/packet-v120.c
index 9d762020f8..f69fb70d04 100644
--- a/packet-v120.c
+++ b/packet-v120.c
@@ -2,7 +2,7 @@
* Routines for v120 frame disassembly
* Bert Driehuis <driehuis@playbeing.org>
*
- * $Id: packet-v120.c,v 1.24 2002/01/21 07:36:44 guy Exp $
+ * $Id: packet-v120.c,v 1.25 2002/04/09 08:15:02 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -37,8 +37,6 @@
#include <epan/packet.h>
#include "xdlc.h"
-#define FROM_DCE 0x80
-
static int proto_v120 = -1;
static int hf_v120_address = -1;
static int hf_v120_control = -1;
diff --git a/packet-x25.c b/packet-x25.c
index 3e0dfaee08..953a9fbe97 100644
--- a/packet-x25.c
+++ b/packet-x25.c
@@ -2,7 +2,7 @@
* Routines for x25 packet disassembly
* Olivier Abad <oabad@cybercable.fr>
*
- * $Id: packet-x25.c,v 1.64 2002/01/24 09:20:53 guy Exp $
+ * $Id: packet-x25.c,v 1.65 2002/04/09 08:15:02 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -41,7 +41,14 @@
#include "nlpid.h"
#include "x264_prt_id.h"
-#define FROM_DCE 0x80
+/*
+ * Direction of packet.
+ */
+typedef enum {
+ X25_FROM_DCE, /* DCE->DTE */
+ X25_FROM_DTE, /* DTE->DCE */
+ X25_UNKNOWN /* direction unknown */
+} x25_dir_t;
#define X25_CALL_REQUEST 0x0B
#define X25_CALL_ACCEPTED 0x0F
@@ -1482,7 +1489,8 @@ static const value_string sharing_strategy_vals[] = {
};
static void
-dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_x25_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ x25_dir_t dir)
{
proto_tree *x25_tree=0, *gfi_tree=0, *userdata_tree=0;
proto_item *ti;
@@ -1494,6 +1502,7 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
gboolean toa; /* TOA/NPI address format */
guint16 bytes0_1;
guint8 pkt_type;
+ char *short_name = NULL, *long_name = NULL;
tvbuff_t *next_tvb;
gboolean q_bit_set = FALSE;
@@ -1552,18 +1561,30 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
switch (pkt_type) {
case X25_CALL_REQUEST:
+ switch (dir) {
+
+ case X25_FROM_DCE:
+ short_name = "Inc. call";
+ long_name = "Incoming call";
+ break;
+
+ case X25_FROM_DTE:
+ short_name = "Call req.";
+ long_name = "Call request";
+ break;
+
+ case X25_UNKNOWN:
+ short_name = "Inc. call/Call req.";
+ long_name = "Incoming call/Call request";
+ break;
+ }
if (check_col(pinfo->cinfo, COL_INFO))
- col_add_fstr(pinfo->cinfo, COL_INFO, "%s VC:%d",
- (pinfo->pseudo_header->x25.flags & FROM_DCE) ? "Inc. call"
- : "Call req." ,
- vc);
+ col_add_fstr(pinfo->cinfo, COL_INFO, "%s VC:%d", short_name, vc);
if (x25_tree) {
proto_tree_add_uint(x25_tree, hf_x25_lcn, tvb,
0, 2, bytes0_1);
proto_tree_add_uint_format(x25_tree, hf_x25_type, tvb, 2, 1,
- X25_CALL_REQUEST,
- (pinfo->pseudo_header->x25.flags & FROM_DCE) ? "Incoming call"
- : "Call request");
+ X25_CALL_REQUEST, "%s", long_name);
}
localoffset = 3;
if (localoffset < x25_pkt_len) /* calling/called addresses */
@@ -1789,17 +1810,29 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
break;
case X25_CALL_ACCEPTED:
+ switch (dir) {
+
+ case X25_FROM_DCE:
+ short_name = "Call conn.";
+ long_name = "Call connected";
+ break;
+
+ case X25_FROM_DTE:
+ short_name = "Call acc.";
+ long_name = "Call accepted";
+ break;
+
+ case X25_UNKNOWN:
+ short_name = "Call conn./Call acc.";
+ long_name = "Call connected/Call accepted";
+ break;
+ }
if(check_col(pinfo->cinfo, COL_INFO))
- col_add_fstr(pinfo->cinfo, COL_INFO, "%s VC:%d",
- (pinfo->pseudo_header->x25.flags & FROM_DCE) ? "Call conn."
- : "Call acc." ,
- vc);
+ col_add_fstr(pinfo->cinfo, COL_INFO, "%s VC:%d", short_name, vc);
if (x25_tree) {
proto_tree_add_uint(x25_tree, hf_x25_lcn, tvb, 0, 2, bytes0_1);
proto_tree_add_uint_format(x25_tree, hf_x25_type, tvb, 2, 1,
- X25_CALL_ACCEPTED,
- (pinfo->pseudo_header->x25.flags & FROM_DCE) ? "Call connected"
- : "Call accepted");
+ X25_CALL_ACCEPTED, "%s", long_name);
}
localoffset = 3;
if (localoffset < x25_pkt_len) /* calling/called addresses */
@@ -1816,10 +1849,25 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
break;
case X25_CLEAR_REQUEST:
+ switch (dir) {
+
+ case X25_FROM_DCE:
+ short_name = "Clear ind.";
+ long_name = "Clear indication";
+ break;
+
+ case X25_FROM_DTE:
+ short_name = "Clear req.";
+ long_name = "Clear request";
+ break;
+
+ case X25_UNKNOWN:
+ short_name = "Clear ind./Clear req.";
+ long_name = "Clear indication/Clear request";
+ break;
+ }
if(check_col(pinfo->cinfo, COL_INFO)) {
- col_add_fstr(pinfo->cinfo, COL_INFO, "%s VC:%d %s - %s",
- (pinfo->pseudo_header->x25.flags & FROM_DCE) ? "Clear ind."
- : "Clear req." ,
+ col_add_fstr(pinfo->cinfo, COL_INFO, "%s VC:%d %s - %s", short_name,
vc, clear_code(tvb_get_guint8(tvb, 3)),
clear_diag(tvb_get_guint8(tvb, 4)));
}
@@ -1827,9 +1875,7 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (x25_tree) {
proto_tree_add_uint(x25_tree, hf_x25_lcn, tvb, 0, 2, bytes0_1);
proto_tree_add_uint_format(x25_tree, hf_x25_type, tvb,
- localoffset+2, 1, X25_CLEAR_REQUEST,
- (pinfo->pseudo_header->x25.flags & FROM_DCE) ? "Clear indication"
- : "Clear request");
+ localoffset+2, 1, X25_CLEAR_REQUEST, "%s", long_name);
proto_tree_add_text(x25_tree, tvb, 3, 1,
"Cause : %s", clear_code(tvb_get_guint8(tvb, 3)));
proto_tree_add_text(x25_tree, tvb, 4, 1,
@@ -1887,20 +1933,33 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
localoffset = x25_pkt_len;
break;
case X25_RESET_REQUEST:
+ switch (dir) {
+
+ case X25_FROM_DCE:
+ short_name = "Reset ind.";
+ long_name = "Reset indication";
+ break;
+
+ case X25_FROM_DTE:
+ short_name = "Reset req.";
+ long_name = "Reset request";
+ break;
+
+ case X25_UNKNOWN:
+ short_name = "Reset ind./Reset req.";
+ long_name = "Reset indication/Reset request";
+ break;
+ }
if(check_col(pinfo->cinfo, COL_INFO)) {
col_add_fstr(pinfo->cinfo, COL_INFO, "%s VC:%d %s - Diag.:%d",
- (pinfo->pseudo_header->x25.flags & FROM_DCE) ? "Reset ind."
- : "Reset req.",
- vc, reset_code(tvb_get_guint8(tvb, 3)),
+ short_name, vc, reset_code(tvb_get_guint8(tvb, 3)),
(int)tvb_get_guint8(tvb, 4));
}
x25_hash_add_proto_end(vc, pinfo->fd->abs_secs, pinfo->fd->abs_usecs);
if (x25_tree) {
proto_tree_add_uint(x25_tree, hf_x25_lcn, tvb, 0, 2, bytes0_1);
proto_tree_add_uint_format(x25_tree, hf_x25_type, tvb, 2, 1,
- X25_RESET_REQUEST,
- (pinfo->pseudo_header->x25.flags & FROM_DCE) ? "Reset indication"
- : "Reset request");
+ X25_RESET_REQUEST, "%s", long_name);
proto_tree_add_text(x25_tree, tvb, 3, 1,
"Cause : %s", reset_code(tvb_get_guint8(tvb, 3)));
proto_tree_add_text(x25_tree, tvb, 4, 1,
@@ -1919,18 +1978,32 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
localoffset = x25_pkt_len;
break;
case X25_RESTART_REQUEST:
+ switch (dir) {
+
+ case X25_FROM_DCE:
+ short_name = "Restart ind.";
+ long_name = "Restart indication";
+ break;
+
+ case X25_FROM_DTE:
+ short_name = "Restart req.";
+ long_name = "Restart request";
+ break;
+
+ case X25_UNKNOWN:
+ short_name = "Restart ind./Restart req.";
+ long_name = "Restart indication/Restart request";
+ break;
+ }
if(check_col(pinfo->cinfo, COL_INFO)) {
col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s - Diag.:%d",
- (pinfo->pseudo_header->x25.flags & FROM_DCE) ? "Restart ind."
- : "Restart req.",
+ short_name,
restart_code(tvb_get_guint8(tvb, 3)),
(int)tvb_get_guint8(tvb, 3));
}
if (x25_tree) {
proto_tree_add_uint_format(x25_tree, hf_x25_type, tvb, 2, 1,
- X25_RESTART_REQUEST,
- (pinfo->pseudo_header->x25.flags & FROM_DCE) ? "Restart indication"
- : "Restart request");
+ X25_RESTART_REQUEST, "%s", long_name);
proto_tree_add_text(x25_tree, tvb, 3, 1,
"Cause : %s", restart_code(tvb_get_guint8(tvb, 3)));
proto_tree_add_text(x25_tree, tvb, 4, 1,
@@ -2175,6 +2248,31 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
call_dissector(data_handle, next_tvb, pinfo, tree);
}
+/*
+ * X.25 dissector for use when "pinfo->pseudo_header" points to a
+ * "struct x25_phdr".
+ */
+static void
+dissect_x25_dir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ dissect_x25_common(tvb, pinfo, tree,
+ (pinfo->pseudo_header->x25.flags & FROM_DCE) ? X25_FROM_DCE :
+ X25_FROM_DTE);
+}
+
+/*
+ * X.25 dissector for use when "pinfo->pseudo_header" doesn't point to a
+ * "struct x25_phdr".
+ */
+static void
+dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ /*
+ * We don't know if this packet is DTE->DCE or DCE->DCE.
+ */
+ dissect_x25_common(tvb, pinfo, tree, X25_UNKNOWN);
+}
+
void
proto_register_x25(void)
{
@@ -2256,6 +2354,7 @@ proto_register_x25(void)
"X.25 secondary protocol identifier", FT_UINT8, BASE_HEX);
register_heur_dissector_list("x.25", &x25_heur_subdissector_list);
+ register_dissector("x.25_dir", dissect_x25_dir, proto_x25);
register_dissector("x.25", dissect_x25, proto_x25);
/* Preferences */
diff --git a/packet-xot.c b/packet-xot.c
index 72696e061c..17b3451528 100644
--- a/packet-xot.c
+++ b/packet-xot.c
@@ -1,9 +1,9 @@
/* packet-xot.c
- * Routines for X25 over TCP dissection (RFC 1613)
+ * Routines for X.25 over TCP dissection (RFC 1613)
*
* Copyright 2000, Paul Ionescu <paul@acorp.ro>
*
- * $Id: packet-xot.c,v 1.9 2002/01/21 07:36:48 guy Exp $
+ * $Id: packet-xot.c,v 1.10 2002/04/09 08:15:02 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -35,6 +35,8 @@
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
+#include "packet-frame.h"
+#include "prefs.h"
#define TCP_PORT_XOT 1998
@@ -44,39 +46,133 @@ static gint hf_xot_length = -1;
static gint ett_xot = -1;
+/* desegmentation of X.25 over TCP */
+static gboolean xot_desegment = TRUE;
+
static dissector_handle_t x25_handle;
static void dissect_xot(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
+ volatile int offset = 0;
+ int length_remaining;
+ guint16 version;
+ guint16 plen;
+ int length;
proto_item *ti;
proto_tree *xot_tree;
- guint16 version,len;
tvbuff_t *next_tvb;
-
- if (check_col(pinfo->cinfo, COL_PROTOCOL))
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "XOT");
- if (check_col(pinfo->cinfo, COL_INFO))
- col_clear(pinfo->cinfo, COL_INFO);
-
- version = tvb_get_ntohs(tvb,0);
- len = tvb_get_ntohs(tvb,2);
-
- if (check_col(pinfo->cinfo, COL_INFO))
- col_add_fstr(pinfo->cinfo, COL_INFO, "XOT Version = %u, size = %u",version,len );
-
- if (tree) {
-
- ti = proto_tree_add_protocol_format(tree, proto_xot, tvb, 0, 4, "X.25 over TCP");
- xot_tree = proto_item_add_subtree(ti, ett_xot);
-
- proto_tree_add_uint(xot_tree, hf_xot_version, tvb, 0, 2, version);
- proto_tree_add_uint(xot_tree, hf_xot_length, tvb, 2, 2, len);
+ while (tvb_reported_length_remaining(tvb, offset) != 0) {
+ length_remaining = tvb_length_remaining(tvb, offset);
+
+ /*
+ * Can we do reassembly?
+ */
+ if (xot_desegment && pinfo->can_desegment) {
+ /*
+ * Yes - is the X.25-over-TCP header split across segment boundaries?
+ */
+ if (length_remaining < 4) {
+ /*
+ * Yes. Tell the TCP dissector where the data for this message
+ * starts in the data it handed us, and how many
+ * more bytes we need, and return.
+ */
+ pinfo->desegment_offset = offset;
+ pinfo->desegment_len = 4 - length_remaining;
+ return;
+ }
+ }
+
+ /*
+ * Get the length of the XOT packet.
+ */
+ version = tvb_get_ntohs(tvb, offset + 0);
+ if (version != 0)
+ return;
+ plen = tvb_get_ntohs(tvb, offset + 2);
+
+ /*
+ * Can we do reassembly?
+ */
+ if (xot_desegment && pinfo->can_desegment) {
+ /*
+ * Yes - is the XOT packet split across segment boundaries?
+ */
+ if (length_remaining < plen + 4) {
+ /*
+ * Yes. Tell the TCP dissector where the data for this message
+ * starts in the data it handed us, and how many more bytes we
+ * need, and return.
+ */
+ pinfo->desegment_offset = offset;
+ pinfo->desegment_len = (plen + 4) - length_remaining;
+ return;
+ }
+ }
+
+ /*
+ * Dissect the X.25-over-TCP packet.
+ *
+ * Catch the ReportedBoundsError exception; if this particular message
+ * happens to get a ReportedBoundsError exception, that doesn't mean
+ * that we should stop dissecting X.25-over-TCP messages within this
+ * frame or chunk of reassembled data.
+ *
+ * If it gets a BoundsError, we can stop, as there's nothing more to see,
+ * so we just re-throw it.
+ */
+ TRY {
+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "XOT");
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_add_fstr(pinfo->cinfo, COL_INFO, "XOT Version = %u, size = %u",
+ version,plen );
+
+ if (tree) {
+ ti = proto_tree_add_protocol_format(tree, proto_xot, tvb, offset, 4,
+ "X.25 over TCP");
+ xot_tree = proto_item_add_subtree(ti, ett_xot);
+
+ proto_tree_add_uint(xot_tree, hf_xot_version, tvb, offset, 2, version);
+ proto_tree_add_uint(xot_tree, hf_xot_length, tvb, offset + 2, 2, plen);
+ }
+
+ /*
+ * Construct a tvbuff containing the amount of the payload we have
+ * available. Make its reported length the amount of data in the
+ * X.25-over-TCP packet.
+ *
+ * XXX - if reassembly isn't enabled. the subdissector will throw a
+ * BoundsError exception, rather than a ReportedBoundsError exception.
+ * We really want a tvbuff where the length is "length", the reported
+ * length is "plen + 4", and the "if the snapshot length were infinite"
+ * length is the minimum of the reported length of the tvbuff handed
+ * to us and "plen+4", with a new type of exception thrown if the offset
+ * is within the reported length but beyond that third length, with that
+ * exception getting the "Unreassembled Packet" error.
+ */
+ length = length_remaining - 4;
+ if (length > plen)
+ length = plen;
+ next_tvb = tvb_new_subset(tvb, offset + 4, length, plen);
+ call_dissector(x25_handle,next_tvb,pinfo,tree);
+ }
+ CATCH(BoundsError) {
+ RETHROW;
+ }
+ CATCH(ReportedBoundsError) {
+ show_reported_bounds_error(tvb, pinfo, tree);
+ }
+ ENDTRY;
+
+ /*
+ * Skip the X.25-over-TCP header and the payload.
+ */
+ offset += plen + 4;
}
- next_tvb = tvb_new_subset(tvb,4, -1 , -1);
- call_dissector(x25_handle,next_tvb,pinfo,tree);
}
-
+
/* Register the protocol with Ethereal */
void
proto_register_xot(void)
@@ -95,11 +191,18 @@ proto_register_xot(void)
static gint *ett[] = {
&ett_xot,
};
+ module_t *xot_module;
proto_xot = proto_register_protocol("X.25 over TCP", "XOT", "xot");
proto_register_field_array(proto_xot, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
-};
+
+ xot_module = prefs_register_protocol(proto_xot, NULL);
+ prefs_register_bool_preference(xot_module, "desegment",
+ "Desegment all X.25-over-TCP messages spanning multiple TCP segments",
+ "Whether the X.25-over-TCP dissector should desegment all messages spanning multiple TCP segments",
+ &xot_desegment);
+}
void
proto_reg_handoff_xot(void)
diff --git a/wiretap/i4btrace.c b/wiretap/i4btrace.c
index 0c2294f521..9b9eec2066 100644
--- a/wiretap/i4btrace.c
+++ b/wiretap/i4btrace.c
@@ -1,6 +1,6 @@
/* i4btrace.c
*
- * $Id: i4btrace.c,v 1.19 2002/03/05 08:39:29 guy Exp $
+ * $Id: i4btrace.c,v 1.20 2002/04/09 08:15:04 guy Exp $
*
* Wiretap Library
* Copyright (c) 1999 by Bert Driehuis <driehuis@playbeing.org>
@@ -338,7 +338,7 @@ i4b_set_pseudo_header(wtap *wth, i4b_trace_hdr_t *hdr,
* V.120.
*/
pseudo_header->x25.flags =
- (hdr->dir == FROM_TE) ? 0x00 : 0x80;
+ (hdr->dir == FROM_TE) ? 0x00 : FROM_DCE;
}
break;
}
diff --git a/wiretap/nettl.c b/wiretap/nettl.c
index 28a111befe..7f6bf20b36 100644
--- a/wiretap/nettl.c
+++ b/wiretap/nettl.c
@@ -1,6 +1,6 @@
/* nettl.c
*
- * $Id: nettl.c,v 1.25 2002/03/05 08:39:29 guy Exp $
+ * $Id: nettl.c,v 1.26 2002/04/09 08:15:04 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -300,7 +300,8 @@ nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
phdr->ts.tv_sec = pntohl(&lapb_hdr.sec);
phdr->ts.tv_usec = pntohl(&lapb_hdr.usec);
- pseudo_header->x25.flags = (lapb_hdr.from_dce & 0x20 ? 0x80 : 0x00);
+ pseudo_header->x25.flags =
+ (lapb_hdr.from_dce & 0x20 ? FROM_DCE : 0x00);
break;
default:
g_message("nettl: network type %u unknown or unsupported",
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
index 88b29b5daa..e867752443 100644
--- a/wiretap/ngsniffer.c
+++ b/wiretap/ngsniffer.c
@@ -1,6 +1,6 @@
/* ngsniffer.c
*
- * $Id: ngsniffer.c,v 1.76 2002/03/05 08:39:29 guy Exp $
+ * $Id: ngsniffer.c,v 1.77 2002/04/09 08:15:04 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -1030,7 +1030,7 @@ static void set_pseudo_header_frame2(union wtap_pseudo_header *pseudo_header,
* or 0xcc, and "flags" was either 0 or 0x18,
* with no obvious correlation with anything.
*/
- pseudo_header->x25.flags = (frame2->fs & 0x80) ? 0x00 : 0x80;
+ pseudo_header->x25.flags = (frame2->fs & 0x80) ? 0x00 : FROM_DCE;
}
static gboolean ngsniffer_read_frame4(wtap *wth, gboolean is_random,
@@ -1294,7 +1294,7 @@ static gboolean ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
rec_hdr.time_high = htoles(t_high);
rec_hdr.size = htoles(phdr->caplen);
if (wdh->encap == WTAP_ENCAP_LAPB || wdh->encap == WTAP_ENCAP_PPP)
- rec_hdr.fs = (pseudo_header->x25.flags & 0x80) ? 0x00 : 0x80;
+ rec_hdr.fs = (pseudo_header->x25.flags & FROM_DCE) ? 0x00 : 0x80;
else
rec_hdr.fs = 0;
rec_hdr.flags = 0;
diff --git a/wiretap/radcom.c b/wiretap/radcom.c
index 4337ea1dda..c603474347 100644
--- a/wiretap/radcom.c
+++ b/wiretap/radcom.c
@@ -1,6 +1,6 @@
/* radcom.c
*
- * $Id: radcom.c,v 1.35 2002/03/05 08:39:29 guy Exp $
+ * $Id: radcom.c,v 1.36 2002/04/09 08:15:04 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -279,7 +279,7 @@ static gboolean radcom_read(wtap *wth, int *err, long *data_offset)
tm.tm_isdst = -1;
wth->phdr.ts.tv_sec = mktime(&tm);
wth->phdr.ts.tv_usec = pletohl(&hdr.date.usec);
- wth->pseudo_header.x25.flags = (hdr.dce & 0x1) ? 0x00 : 0x80;
+ wth->pseudo_header.x25.flags = (hdr.dce & 0x1) ? 0x00 : FROM_DCE;
/*
* Read the packet data.
@@ -332,7 +332,7 @@ radcom_seek_read(wtap *wth, long seek_off,
return FALSE;
}
- pseudo_header->x25.flags = (hdr.dce & 0x1) ? 0x00 : 0x80;
+ pseudo_header->x25.flags = (hdr.dce & 0x1) ? 0x00 : FROM_DCE;
/*
* Read the packet data.
diff --git a/wiretap/visual.c b/wiretap/visual.c
index faa5a99084..100441ae7a 100644
--- a/wiretap/visual.c
+++ b/wiretap/visual.c
@@ -2,7 +2,7 @@
* File read and write routines for Visual Networks cap files.
* Copyright (c) 2001, Tom Nisbet tnisbet@visualnetworks.com
*
- * $Id: visual.c,v 1.5 2002/03/05 08:39:29 guy Exp $
+ * $Id: visual.c,v 1.6 2002/04/09 08:15:04 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -299,7 +299,8 @@ static gboolean visual_read(wtap *wth, int *err, long *data_offset)
case WTAP_ENCAP_FRELAY:
case WTAP_ENCAP_LAPB:
- wth->pseudo_header.x25.flags = (packet_status & PS_SENT) ? 0x00 : 0x80;
+ wth->pseudo_header.x25.flags =
+ (packet_status & PS_SENT) ? 0x00 : FROM_DCE;
break;
}
@@ -376,7 +377,7 @@ static gboolean visual_seek_read (wtap *wth, long seek_off,
case WTAP_ENCAP_FRELAY:
case WTAP_ENCAP_LAPB:
- pseudo_header->x25.flags = (packet_status & PS_SENT) ? 0x00 : 0x80;
+ pseudo_header->x25.flags = (packet_status & PS_SENT) ? 0x00 : FROM_DCE;
break;
}
@@ -523,7 +524,8 @@ static gboolean visual_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
case WTAP_ENCAP_FRELAY:
case WTAP_ENCAP_LAPB:
- packet_status |= ((pseudo_header->x25.flags & 0x80) ? 0x00 : PS_SENT);
+ packet_status |=
+ ((pseudo_header->x25.flags & FROM_DCE) ? 0x00 : PS_SENT);
break;
}
vpkt_hdr.status = htolel(packet_status);
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index 1aa567f210..84bf02f1fc 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -1,6 +1,6 @@
/* wtap.h
*
- * $Id: wtap.h,v 1.109 2002/04/08 09:44:42 guy Exp $
+ * $Id: wtap.h,v 1.110 2002/04/09 08:15:04 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -18,7 +18,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
*/
#ifndef __WTAP_H__
@@ -186,8 +185,9 @@
*/
/* Packet "pseudo-header" information for X.25 capture files. */
+#define FROM_DCE 0x80
struct x25_phdr {
- guint8 flags; /* ENCAP_LAPB : 1st bit means From DCE */
+ guint8 flags; /* ENCAP_LAPB, ENCAP_V120 : 1st bit means From DCE */
};
/* Packet "pseudo-header" for ATM Sniffer capture files. */