* Routines for x25 packet disassembly
* Olivier Abad <oabad@cybercable.fr>
*
- * $Id: packet-x25.c,v 1.46 2001/02/12 09:06:17 guy Exp $
+ * $Id: packet-x25.c,v 1.53 2001/07/18 15:49:29 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
-#include "etypes.h"
#include "llcsaps.h"
#include "packet.h"
-#include "packet-ip.h"
-#include "packet-osi.h"
#include "nlpid.h"
#define FROM_DCE 0x80
return "DTE Originated";
if (code == 0x01)
return "Number Busy";
+ if (code == 0x03)
+ return "Invalid Facility Requested";
+ if (code == 0x05)
+ return "Network Congestion";
if (code == 0x09)
return "Out Of Order";
+ if (code == 0x0B)
+ return "Access Barred";
+ if (code == 0x0D)
+ return "Not Obtainable";
if (code == 0x11)
return "Remote Procedure Error";
+ if (code == 0x13)
+ return "Local Procedure Error";
+ if (code == 0x15)
+ return "RPOA Out Of Order";
if (code == 0x19)
return "Reverse Charging Acceptance Not Subscribed";
if (code == 0x21)
return "Fast Select Acceptance Not Subscribed";
if (code == 0x39)
return "Destination Absent";
- if (code == 0x03)
- return "Invalid Facility Requested";
- if (code == 0x0B)
- return "Access Barred";
- if (code == 0x13)
- return "Local Procedure Error";
- if (code == 0x05)
- return "Network Congestion";
- if (code == 0x0D)
- return "Not Obtainable";
- if (code == 0x15)
- return "RPOA Out Of Order";
sprintf(buffer, "Unknown %02X", code);
return "Unknown called DNIC";
if (code == 122)
return "Maintenance action";
+ if (code == 144)
+ return "Timer expired or retransmission count surpassed";
+ if (code == 145)
+ return "Timer expired or retransmission count surpassed for INTERRUPT";
+ if (code == 146)
+ return "Timer expired or retransmission count surpassed for DATA "
+ "packet transmission";
+ if (code == 147)
+ return "Timer expired or retransmission count surpassed for REJECT";
+ if (code == 160)
+ return "DTE-specific signals";
+ if (code == 161)
+ return "DTE operational";
+ if (code == 162)
+ return "DTE not operational";
+ if (code == 163)
+ return "DTE resource constraint";
+ if (code == 164)
+ return "Fast select not subscribed";
+ if (code == 165)
+ return "Invalid partially full DATA packet";
+ if (code == 166)
+ return "D-bit procedure not supported";
+ if (code == 167)
+ return "Registration/Cancellation confirmed";
+ if (code == 224)
+ return "OSI network service problem";
+ if (code == 225)
+ return "Disconnection (transient condition)";
+ if (code == 226)
+ return "Disconnection (permanent condition)";
+ if (code == 227)
+ return "Connection rejection - reason unspecified (transient "
+ "condition)";
+ if (code == 228)
+ return "Connection rejection - reason unspecified (permanent "
+ "condition)";
+ if (code == 229)
+ return "Connection rejection - quality of service not available "
+ "transient condition)";
+ if (code == 230)
+ return "Connection rejection - quality of service not available "
+ "permanent condition)";
+ if (code == 231)
+ return "Connection rejection - NSAP unreachable (transient condition)";
+ if (code == 232)
+ return "Connection rejection - NSAP unreachable (permanent condition)";
+ if (code == 233)
+ return "reset - reason unspecified";
+ if (code == 234)
+ return "reset - congestion";
+ if (code == 235)
+ return "Connection rejection - NSAP address unknown (permanent "
+ "condition)";
+ if (code == 240)
+ return "Higher layer initiated";
+ if (code == 241)
+ return "Disconnection - normal";
+ if (code == 242)
+ return "Disconnection - abnormal";
+ if (code == 243)
+ return "Disconnection - incompatible information in user data";
+ if (code == 244)
+ return "Connection rejection - reason unspecified (transient "
+ "condition)";
+ if (code == 245)
+ return "Connection rejection - reason unspecified (permanent "
+ "condition)";
+ if (code == 246)
+ return "Connection rejection - quality of service not available "
+ "(transient condition)";
+ if (code == 247)
+ return "Connection rejection - quality of service not available "
+ "(permanent condition)";
+ if (code == 248)
+ return "Connection rejection - incompatible information in user data";
+ if (code == 249)
+ return "Connection rejection - unrecognizable protocol indentifier "
+ "in user data";
+ if (code == 250)
+ return "Reset - user resynchronization";
sprintf(buffer, "Unknown %d", code);
static int
get_x25_pkt_len(tvbuff_t *tvb)
{
- int length, called_len, calling_len, dte_len, dce_len;
+ guint length, called_len, calling_len, dte_len, dce_len;
guint8 byte2, bytex;
byte2 = tvb_get_guint8(tvb, 2);
return MIN(tvb_reported_length(tvb),length);
case X25_CALL_ACCEPTED:
+ /* The calling/called address length byte (following the packet type)
+ * is not mandatory, so we must check the packet length before trying
+ * to read it */
+ if (tvb_reported_length(tvb) == 3)
+ return(3);
bytex = tvb_get_guint8(tvb, 3);
called_len = (bytex >> 0) & 0x0F;
calling_len = (bytex >> 4) & 0x0F;
{
proto_tree *x25_tree=0, *gfi_tree=0;
proto_item *ti;
- int localoffset=0;
- int x25_pkt_len;
+ guint localoffset=0;
+ guint x25_pkt_len;
int modulo;
guint16 vc;
dissector_handle_t dissect;
spi = tvb_get_guint8(tvb, localoffset);
switch (spi) {
- /* XXX - handle other NLPIDs, e.g. PPP? */
-
+ /*
+ * XXX - handle other NLPIDs, e.g. PPP?
+ * See RFC 1356 for information on at least some other
+ * ways of running other protocols atop X.25.
+ */
case NLPID_IP:
x25_hash_add_proto_start(vc, pinfo->fd->abs_secs,
pinfo->fd->abs_usecs, ip_handle);
static hf_register_info hf[] = {
{ &hf_x25_gfi,
{ "GFI", "x.25.gfi", FT_UINT16, BASE_BIN, NULL, 0xF000,
- "General format identifier" } },
+ "General format identifier", HFILL }},
{ &hf_x25_abit,
{ "A Bit", "x.25.a", FT_BOOLEAN, 16, NULL, 0x8000,
- "Address Bit" } },
+ "Address Bit", HFILL }},
{ &hf_x25_qbit,
{ "Q Bit", "x.25.q", FT_BOOLEAN, 16, NULL, 0x8000,
- "Qualifier Bit" } },
+ "Qualifier Bit", HFILL }},
{ &hf_x25_dbit,
{ "D Bit", "x.25.d", FT_BOOLEAN, 16, NULL, 0x4000,
- "Delivery Confirmation Bit" } },
+ "Delivery Confirmation Bit", HFILL }},
{ &hf_x25_mod,
{ "Modulo", "x.25.mod", FT_UINT16, BASE_DEC, VALS(vals_modulo), 0x3000,
- "Specifies whether the frame is modulo 8 or 128" } },
+ "Specifies whether the frame is modulo 8 or 128", HFILL }},
{ &hf_x25_lcn,
{ "Logical Channel", "x.25.lcn", FT_UINT16, BASE_DEC, NULL, 0x0FFF,
- "Logical Channel Number" } },
+ "Logical Channel Number", HFILL }},
{ &hf_x25_type,
{ "Packet Type", "x.25.type", FT_UINT8, BASE_HEX, VALS(vals_x25_type), 0x0,
- "Packet Type" } },
+ "Packet Type", HFILL }},
{ &hf_x25_p_r_mod8,
{ "P(R)", "x.25.p_r", FT_UINT8, BASE_HEX, NULL, 0xE0,
- "Packet Receive Sequence Number" } },
+ "Packet Receive Sequence Number", HFILL }},
{ &hf_x25_p_r_mod128,
{ "P(R)", "x.25.p_r", FT_UINT8, BASE_HEX, NULL, 0xFE,
- "Packet Receive Sequence Number" } },
+ "Packet Receive Sequence Number", HFILL }},
{ &hf_x25_mbit_mod8,
{ "M Bit", "x.25.m", FT_BOOLEAN, 8, NULL, 0x10,
- "More Bit" } },
+ "More Bit", HFILL }},
{ &hf_x25_mbit_mod128,
{ "M Bit", "x.25.m", FT_BOOLEAN, 8, NULL, 0x01,
- "More Bit" } },
+ "More Bit", HFILL }},
{ &hf_x25_p_s_mod8,
{ "P(S)", "x.25.p_s", FT_UINT8, BASE_HEX, NULL, 0x0E,
- "Packet Send Sequence Number" } },
+ "Packet Send Sequence Number", HFILL }},
{ &hf_x25_p_s_mod128,
{ "P(S)", "x.25.p_s", FT_UINT8, BASE_HEX, NULL, 0xFE,
- "Packet Send Sequence Number" } },
+ "Packet Send Sequence Number", HFILL }},
};
static gint *ett[] = {
&ett_x25,