1998-09-17 02:01:50 +00:00
|
|
|
/* packet-osi.c
|
|
|
|
* Routines for ISO/OSI network and transport protocol packet disassembly
|
2000-04-15 22:11:26 +00:00
|
|
|
* Main entrance point and common functions
|
1998-09-17 02:01:50 +00:00
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2003-01-26 19:35:31 +00:00
|
|
|
* Laurent Deniel <laurent.deniel@free.fr>
|
2000-04-15 22:11:26 +00:00
|
|
|
* Ralf Schneider <Ralf.Schneider@t-online.de>
|
1998-09-17 02:01:50 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
1998-09-17 02:01:50 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1998-09-17 02:01:50 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1998-09-17 02:01:50 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1998-09-17 02:01:50 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2000-03-02 07:27:05 +00:00
|
|
|
#include <ctype.h>
|
1999-03-23 03:14:46 +00:00
|
|
|
#include <glib.h>
|
2006-09-08 06:58:40 +00:00
|
|
|
#include <epan/prefs.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
2005-09-17 00:02:31 +00:00
|
|
|
#include <epan/llcsaps.h>
|
|
|
|
#include <epan/aftypes.h>
|
|
|
|
#include <epan/nlpid.h>
|
|
|
|
#include <epan/ppptypes.h>
|
|
|
|
#include <epan/chdlctypes.h>
|
2000-04-15 22:11:26 +00:00
|
|
|
#include "packet-osi.h"
|
|
|
|
#include "packet-isis.h"
|
|
|
|
#include "packet-esis.h"
|
2006-09-08 06:58:40 +00:00
|
|
|
#include "packet-tpkt.h"
|
1998-09-17 02:01:50 +00:00
|
|
|
|
2006-09-08 06:58:40 +00:00
|
|
|
static int proto_osi = -1;
|
|
|
|
static dissector_handle_t osi_handle;
|
|
|
|
|
|
|
|
/* Preferences for OSI over TPKT over TCP */
|
|
|
|
static gboolean tpkt_desegment = FALSE;
|
2008-09-15 16:51:23 +00:00
|
|
|
static guint global_tcp_port_osi_over_tpkt = 0;
|
1998-09-17 02:01:50 +00:00
|
|
|
|
2001-06-05 09:06:19 +00:00
|
|
|
cksum_status_t
|
2002-08-02 23:36:07 +00:00
|
|
|
calc_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum) {
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
const gchar *buffer;
|
|
|
|
guint available_len;
|
2001-06-05 09:06:19 +00:00
|
|
|
const guint8 *p;
|
|
|
|
guint32 c0, c1;
|
2002-08-02 23:36:07 +00:00
|
|
|
guint seglen;
|
|
|
|
guint i;
|
1998-09-17 02:01:50 +00:00
|
|
|
|
2000-04-15 22:11:26 +00:00
|
|
|
if ( 0 == checksum )
|
2001-06-05 09:06:19 +00:00
|
|
|
return( NO_CKSUM );
|
1998-09-17 02:01:50 +00:00
|
|
|
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
available_len = tvb_length_remaining( tvb, offset );
|
|
|
|
if ( available_len < len )
|
2001-06-05 09:06:19 +00:00
|
|
|
return( DATA_MISSING );
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
|
|
|
|
buffer = tvb_get_ptr( tvb, offset, len );
|
2001-06-05 09:06:19 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The maximum values of c0 and c1 will occur if all bytes have the
|
|
|
|
* value 255; if so, then c0 will be len*255 and c1 will be
|
|
|
|
* (len*255 + (len-1)*255 + ... + 255), which is
|
|
|
|
* (len + (len - 1) + ... + 1)*255, or 255*(len*(len + 1))/2.
|
|
|
|
* This means it can overflow if "len" is 5804 or greater.
|
|
|
|
*
|
|
|
|
* (A+B) mod 255 = ((A mod 255) + (B mod 255) mod 255, so
|
|
|
|
* we can solve this by taking c0 and c1 mod 255 every
|
|
|
|
* 5803 bytes.
|
|
|
|
*/
|
|
|
|
p = buffer;
|
|
|
|
c0 = 0;
|
|
|
|
c1 = 0;
|
|
|
|
while (len != 0) {
|
|
|
|
seglen = len;
|
|
|
|
if (seglen > 5803)
|
|
|
|
seglen = 5803;
|
|
|
|
for (i = 0; i < seglen; i++) {
|
|
|
|
c0 = c0 + *(p++);
|
|
|
|
c1 += c0;
|
|
|
|
}
|
|
|
|
|
|
|
|
c0 = c0 % 255;
|
|
|
|
c1 = c1 % 255;
|
|
|
|
|
|
|
|
len -= seglen;
|
1998-09-17 02:01:50 +00:00
|
|
|
}
|
2001-06-05 09:06:19 +00:00
|
|
|
if (c0 != 0 || c1 != 0)
|
2003-05-15 06:35:02 +00:00
|
|
|
return( CKSUM_NOT_OK ); /* XXX - what should the checksum field be? */
|
2000-04-15 22:11:26 +00:00
|
|
|
else
|
2001-06-05 09:06:19 +00:00
|
|
|
return( CKSUM_OK );
|
2000-04-15 22:11:26 +00:00
|
|
|
}
|
1998-09-17 02:01:50 +00:00
|
|
|
|
|
|
|
|
2003-05-15 06:35:02 +00:00
|
|
|
cksum_status_t
|
|
|
|
check_and_get_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum, int offset_check, guint16* result) {
|
|
|
|
const gchar *buffer;
|
|
|
|
guint available_len;
|
|
|
|
const guint8 *p;
|
|
|
|
guint8 discard = 0;
|
|
|
|
guint32 c0, c1, factor;
|
|
|
|
guint seglen, initlen = len;
|
|
|
|
guint i;
|
|
|
|
int block, x, y;
|
|
|
|
|
|
|
|
if ( 0 == checksum )
|
|
|
|
return( NO_CKSUM );
|
|
|
|
|
|
|
|
available_len = tvb_length_remaining( tvb, offset );
|
|
|
|
offset_check -= offset;
|
|
|
|
if ( ( available_len < len ) || ( offset_check < 0 ) || ( (guint)(offset_check+2) > len ) )
|
|
|
|
return( DATA_MISSING );
|
|
|
|
|
|
|
|
buffer = tvb_get_ptr( tvb, offset, len );
|
|
|
|
block = offset_check / 5803;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The maximum values of c0 and c1 will occur if all bytes have the
|
|
|
|
* value 255; if so, then c0 will be len*255 and c1 will be
|
|
|
|
* (len*255 + (len-1)*255 + ... + 255), which is
|
|
|
|
* (len + (len - 1) + ... + 1)*255, or 255*(len*(len + 1))/2.
|
|
|
|
* This means it can overflow if "len" is 5804 or greater.
|
|
|
|
*
|
|
|
|
* (A+B) mod 255 = ((A mod 255) + (B mod 255) mod 255, so
|
|
|
|
* we can solve this by taking c0 and c1 mod 255 every
|
|
|
|
* 5803 bytes.
|
|
|
|
*/
|
|
|
|
p = buffer;
|
|
|
|
c0 = 0;
|
|
|
|
c1 = 0;
|
|
|
|
|
|
|
|
while (len != 0) {
|
|
|
|
seglen = len;
|
|
|
|
if ( block-- == 0 ) {
|
|
|
|
seglen = offset_check % 5803;
|
|
|
|
discard = 1;
|
|
|
|
} else if ( seglen > 5803 )
|
|
|
|
seglen = 5803;
|
|
|
|
for (i = 0; i < seglen; i++) {
|
|
|
|
c0 = c0 + *(p++);
|
|
|
|
c1 += c0;
|
|
|
|
}
|
|
|
|
if ( discard ) {
|
|
|
|
/*
|
|
|
|
* This works even if (offset_check % 5803) == 5802
|
|
|
|
*/
|
|
|
|
p += 2;
|
|
|
|
c1 += 2*c0;
|
|
|
|
len -= 2;
|
|
|
|
discard = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
c0 = c0 % 255;
|
|
|
|
c1 = c1 % 255;
|
|
|
|
|
|
|
|
len -= seglen;
|
|
|
|
}
|
|
|
|
|
|
|
|
factor = ( initlen - offset_check ) * c0;
|
|
|
|
x = factor - c0 - c1;
|
|
|
|
y = c1 - factor - 1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This algorithm uses the 8 bits one's complement arithmetic.
|
|
|
|
* Therefore, we must correct an effect produced
|
|
|
|
* by the "standard" arithmetic (two's complement)
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (x < 0 ) x--;
|
|
|
|
if (y > 0 ) y++;
|
|
|
|
|
|
|
|
x %= 255;
|
|
|
|
y %= 255;
|
|
|
|
|
|
|
|
if (x == 0) x = 0xFF;
|
|
|
|
if (y == 0) y = 0x01;
|
|
|
|
|
|
|
|
*result = ( x << 8 ) | ( y & 0xFF );
|
|
|
|
|
|
|
|
if (*result != checksum)
|
|
|
|
return( CKSUM_NOT_OK ); /* XXX - what should the checksum field be? */
|
|
|
|
else
|
|
|
|
return( CKSUM_OK );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1998-09-17 02:01:50 +00:00
|
|
|
/* main entry point */
|
|
|
|
|
2001-12-02 00:07:46 +00:00
|
|
|
/*
|
|
|
|
* These assume the NLPID is a secondary protocol identifier, not an
|
|
|
|
* initial protocol identifier.
|
|
|
|
*
|
|
|
|
* This is an issue only if, in any packet where an NLPID appears, it's
|
|
|
|
* an initial protocol identifier *AND* it can have the value 1, which
|
|
|
|
* means T.70 for an IPI and X.29 for an SPI.
|
|
|
|
*/
|
2000-01-13 00:41:11 +00:00
|
|
|
const value_string nlpid_vals[] = {
|
|
|
|
{ NLPID_NULL, "NULL" },
|
2001-12-02 00:07:46 +00:00
|
|
|
{ NLPID_SPI_X_29, "X.29" },
|
2000-01-30 05:50:02 +00:00
|
|
|
{ NLPID_X_633, "X.633" },
|
|
|
|
{ NLPID_Q_931, "Q.931" },
|
|
|
|
{ NLPID_Q_2931, "Q.2931" },
|
|
|
|
{ NLPID_Q_2119, "Q.2119" },
|
2000-01-13 00:41:11 +00:00
|
|
|
{ NLPID_SNAP, "SNAP" },
|
|
|
|
{ NLPID_ISO8473_CLNP, "CLNP" },
|
|
|
|
{ NLPID_ISO9542_ESIS, "ESIS" },
|
|
|
|
{ NLPID_ISO10589_ISIS, "ISIS" },
|
2000-04-15 22:11:26 +00:00
|
|
|
{ NLPID_ISO10747_IDRP, "IDRP" },
|
2000-01-13 00:41:11 +00:00
|
|
|
{ NLPID_ISO9542X25_ESIS, "ESIS (X.25)" },
|
2000-01-30 05:50:02 +00:00
|
|
|
{ NLPID_ISO10030, "ISO 10030" },
|
|
|
|
{ NLPID_ISO11577, "ISO 11577" },
|
2001-03-29 08:05:07 +00:00
|
|
|
{ NLPID_COMPRESSED, "Data compression protocol" },
|
2000-01-13 00:41:11 +00:00
|
|
|
{ NLPID_IP, "IP" },
|
2003-02-24 19:49:04 +00:00
|
|
|
{ NLPID_SNDCF, "SubNetwork Dependent Convergence Function"},
|
2001-04-16 10:04:33 +00:00
|
|
|
{ NLPID_IP6, "IPv6" },
|
2000-01-13 05:41:24 +00:00
|
|
|
{ NLPID_PPP, "PPP" },
|
2000-01-13 00:41:11 +00:00
|
|
|
{ 0, NULL },
|
|
|
|
};
|
|
|
|
|
2003-04-29 17:56:49 +00:00
|
|
|
static dissector_table_t osinl_subdissector_table;
|
2005-01-20 05:40:56 +00:00
|
|
|
static dissector_table_t osinl_excl_subdissector_table;
|
2003-09-20 03:31:25 +00:00
|
|
|
static dissector_handle_t data_handle, ppp_handle;
|
2000-04-17 01:36:31 +00:00
|
|
|
|
2006-09-08 06:58:40 +00:00
|
|
|
/* Dissect OSI over TCP over TPKT */
|
|
|
|
static void
|
|
|
|
dissect_osi_tpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
2008-09-15 16:51:23 +00:00
|
|
|
dissect_tpkt_encap(tvb, pinfo, tree, tpkt_desegment, osi_handle);
|
2006-09-08 06:58:40 +00:00
|
|
|
}
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
static void dissect_osi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
1998-09-17 02:01:50 +00:00
|
|
|
{
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
guint8 nlpid;
|
2003-09-20 03:31:25 +00:00
|
|
|
tvbuff_t *new_tvb;
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
|
|
|
|
pinfo->current_proto = "OSI";
|
|
|
|
|
|
|
|
nlpid = tvb_get_guint8(tvb, 0);
|
|
|
|
|
2005-01-20 05:40:56 +00:00
|
|
|
/* try lookup with the subdissector tables that includes the nlpid */
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
if (dissector_try_port(osinl_subdissector_table, nlpid, tvb, pinfo, tree))
|
2008-09-15 16:51:23 +00:00
|
|
|
return;
|
2005-01-20 05:40:56 +00:00
|
|
|
/* try lookup with the subdissector tables that excludes the nlpid */
|
2009-08-16 12:36:22 +00:00
|
|
|
new_tvb = tvb_new_subset_remaining(tvb, 1);
|
2005-01-20 05:40:56 +00:00
|
|
|
if (dissector_try_port(osinl_excl_subdissector_table, nlpid, new_tvb, pinfo, tree))
|
2008-09-15 16:51:23 +00:00
|
|
|
return;
|
2005-01-20 05:40:56 +00:00
|
|
|
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
switch (nlpid) {
|
1998-09-17 02:01:50 +00:00
|
|
|
|
2000-04-15 22:11:26 +00:00
|
|
|
/* ESIS (X.25) is not currently decoded */
|
1998-09-17 02:01:50 +00:00
|
|
|
|
2000-01-13 00:41:11 +00:00
|
|
|
case NLPID_ISO9542X25_ESIS:
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ESIS (X.25)");
|
2001-11-25 22:51:14 +00:00
|
|
|
call_dissector(data_handle,tvb, pinfo, tree);
|
1998-09-17 02:01:50 +00:00
|
|
|
break;
|
2000-04-15 22:11:26 +00:00
|
|
|
case NLPID_ISO10747_IDRP:
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IDRP");
|
2001-11-25 22:51:14 +00:00
|
|
|
call_dissector(data_handle,tvb, pinfo, tree);
|
2000-04-15 22:11:26 +00:00
|
|
|
break;
|
1998-09-17 02:01:50 +00:00
|
|
|
default:
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISO");
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO)) {
|
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown ISO protocol (%02x)", nlpid);
|
1999-09-18 15:51:31 +00:00
|
|
|
}
|
2001-11-25 22:51:14 +00:00
|
|
|
call_dissector(data_handle,tvb, pinfo, tree);
|
1998-09-17 02:01:50 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} /* dissect_osi */
|
2000-04-17 00:32:43 +00:00
|
|
|
|
2006-09-08 06:58:40 +00:00
|
|
|
void
|
|
|
|
proto_reg_handoff_osi(void)
|
|
|
|
{
|
2008-09-15 16:51:23 +00:00
|
|
|
static gboolean osi_prefs_initialized = FALSE;
|
|
|
|
static dissector_handle_t osi_tpkt_handle;
|
|
|
|
static guint tcp_port_osi_over_tpkt;
|
|
|
|
|
|
|
|
if (!osi_prefs_initialized) {
|
|
|
|
osi_handle = create_dissector_handle(dissect_osi, proto_osi);
|
|
|
|
dissector_add("llc.dsap", SAP_OSINL1, osi_handle);
|
|
|
|
dissector_add("llc.dsap", SAP_OSINL2, osi_handle);
|
|
|
|
dissector_add("llc.dsap", SAP_OSINL3, osi_handle);
|
|
|
|
dissector_add("llc.dsap", SAP_OSINL4, osi_handle);
|
|
|
|
dissector_add("llc.dsap", SAP_OSINL5, osi_handle);
|
|
|
|
dissector_add("ppp.protocol", PPP_OSI, osi_handle);
|
|
|
|
dissector_add("chdlctype", CHDLCTYPE_OSI, osi_handle);
|
|
|
|
dissector_add("null.type", BSD_AF_ISO, osi_handle);
|
|
|
|
dissector_add("gre.proto", SAP_OSINL5, osi_handle);
|
|
|
|
data_handle = find_dissector("data");
|
|
|
|
ppp_handle = find_dissector("ppp");
|
|
|
|
|
|
|
|
osi_tpkt_handle = create_dissector_handle(dissect_osi_tpkt, proto_osi);
|
|
|
|
dissector_add_handle("tcp.port", osi_tpkt_handle); /* for 'decode-as' */
|
|
|
|
osi_prefs_initialized = TRUE;
|
|
|
|
} else {
|
|
|
|
if (tcp_port_osi_over_tpkt != 0) {
|
|
|
|
dissector_delete("tcp.port", tcp_port_osi_over_tpkt, osi_tpkt_handle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (global_tcp_port_osi_over_tpkt != 0) {
|
|
|
|
dissector_add("tcp.port", global_tcp_port_osi_over_tpkt, osi_tpkt_handle);
|
|
|
|
}
|
|
|
|
tcp_port_osi_over_tpkt = global_tcp_port_osi_over_tpkt;
|
2006-09-08 06:58:40 +00:00
|
|
|
}
|
|
|
|
|
2000-04-17 01:36:31 +00:00
|
|
|
void
|
|
|
|
proto_register_osi(void)
|
|
|
|
{
|
2008-09-15 16:51:23 +00:00
|
|
|
module_t *osi_module;
|
|
|
|
|
|
|
|
/* There's no "OSI" protocol *per se*, but we do register a
|
|
|
|
dissector table so various protocols running at the
|
|
|
|
network layer can register themselves.
|
|
|
|
all protocols that require inclusion of the NLPID
|
|
|
|
should register here
|
|
|
|
*/
|
|
|
|
osinl_subdissector_table = register_dissector_table("osinl",
|
|
|
|
"OSI incl NLPID", FT_UINT8, BASE_HEX);
|
|
|
|
|
|
|
|
/* This dissector table is for those protocols whose PDUs
|
|
|
|
* aren't* defined to begin with an NLPID.
|
|
|
|
* (typically non OSI protocols like IP,IPv6,PPP */
|
|
|
|
osinl_excl_subdissector_table = register_dissector_table("osinl.excl",
|
|
|
|
"OSI excl NLPID", FT_UINT8, BASE_HEX);
|
2006-09-08 06:58:40 +00:00
|
|
|
|
2008-09-15 16:51:23 +00:00
|
|
|
proto_osi = proto_register_protocol("OSI", "OSI", "osi");
|
|
|
|
/* Preferences how OSI protocols should be dissected */
|
|
|
|
osi_module = prefs_register_protocol(proto_osi, proto_reg_handoff_osi);
|
|
|
|
|
|
|
|
prefs_register_uint_preference(osi_module, "tpkt_port",
|
|
|
|
"TCP port for OSI over TPKT",
|
|
|
|
"TCP port for OSI over TPKT",
|
|
|
|
10, &global_tcp_port_osi_over_tpkt);
|
|
|
|
prefs_register_bool_preference(osi_module, "tpkt_reassemble",
|
|
|
|
"Reassemble segmented TPKT datagrams",
|
|
|
|
"Whether segmented TPKT datagrams should be reassembled",
|
|
|
|
&tpkt_desegment);
|
2000-04-17 01:36:31 +00:00
|
|
|
|
2000-04-17 00:32:43 +00:00
|
|
|
}
|
2006-09-08 06:58:40 +00:00
|
|
|
|