2012-08-02 16:54:43 +00:00
|
|
|
/* packet-ax25.c
|
|
|
|
*
|
|
|
|
* Routines for Amateur Packet Radio protocol dissection
|
2012-09-04 20:42:21 +00:00
|
|
|
* AX.25 frames
|
2012-08-02 16:54:43 +00:00
|
|
|
* Copyright 2005,2006,2007,2008,2009,2010,2012 R.W. Stearn <richard@rns-stearn.demon.co.uk>
|
|
|
|
*
|
2012-10-22 20:46:47 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2012-08-02 16:54:43 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* 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.
|
2012-08-02 18:15:44 +00:00
|
|
|
*
|
2012-08-02 16:54:43 +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.
|
2012-08-02 18:15:44 +00:00
|
|
|
*
|
2012-08-02 16:54:43 +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
|
2012-10-22 20:46:47 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2012-08-02 16:54:43 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This dissector is for:
|
|
|
|
* AX.25 Amateur Packet-Radio Link-Layer Protocol, Version 2.0, October 1984
|
2012-08-02 18:15:44 +00:00
|
|
|
*
|
2012-08-02 16:54:43 +00:00
|
|
|
* At the time of writing the specification could be found here:
|
|
|
|
* http://www.tapr.org/pub_ax25.html
|
|
|
|
*
|
2012-08-03 02:05:33 +00:00
|
|
|
* A newer version, Version 2.2, July 1998, can be found at
|
|
|
|
* http://www.ax25.net/AX25.2.2-Jul%2098-2.pdf
|
|
|
|
*
|
2012-08-02 16:54:43 +00:00
|
|
|
* Inspiration on how to build the dissector drawn from
|
|
|
|
* packet-sdlc.c
|
|
|
|
* packet-x25.c
|
|
|
|
* packet-lapb.c
|
|
|
|
* paket-gprs-llc.c
|
|
|
|
* xdlc.c
|
|
|
|
* with the base file built from README.developers.
|
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2012-08-02 16:54:43 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
2015-12-13 04:38:21 +00:00
|
|
|
#include <epan/capture_dissectors.h>
|
2013-11-29 20:53:00 +00:00
|
|
|
#include <wiretap/wtap.h>
|
2013-11-09 13:41:10 +00:00
|
|
|
#include <epan/to_str.h>
|
2012-08-02 16:54:43 +00:00
|
|
|
#include <epan/xdlc.h>
|
2012-08-03 01:58:12 +00:00
|
|
|
#include <epan/ax25_pids.h>
|
2012-08-02 16:54:43 +00:00
|
|
|
#include <epan/ipproto.h>
|
|
|
|
#include "packet-ax25.h"
|
|
|
|
|
|
|
|
#define STRLEN 80
|
|
|
|
|
|
|
|
#define AX25_HEADER_SIZE 15 /* length of src_addr + dst_addr + cntl */
|
2012-10-22 20:46:47 +00:00
|
|
|
#define AX25_MAX_DIGIS 8
|
2012-08-02 16:54:43 +00:00
|
|
|
|
2013-03-13 21:14:20 +00:00
|
|
|
void proto_register_ax25(void);
|
|
|
|
void proto_reg_handoff_ax25(void);
|
|
|
|
|
2012-08-03 01:58:12 +00:00
|
|
|
/* Dissector table */
|
|
|
|
static dissector_table_t ax25_dissector_table;
|
|
|
|
|
2012-08-02 16:54:43 +00:00
|
|
|
/* Initialize the protocol and registered fields */
|
|
|
|
static int proto_ax25 = -1;
|
|
|
|
static int hf_ax25_dst = -1;
|
|
|
|
static int hf_ax25_src = -1;
|
|
|
|
static int hf_ax25_via[ AX25_MAX_DIGIS ] = { -1,-1,-1,-1,-1,-1,-1,-1 };
|
|
|
|
|
|
|
|
static int hf_ax25_ctl = -1;
|
|
|
|
|
|
|
|
static int hf_ax25_n_r = -1;
|
|
|
|
static int hf_ax25_n_s = -1;
|
|
|
|
|
|
|
|
static int hf_ax25_p = -1;
|
|
|
|
static int hf_ax25_f = -1;
|
|
|
|
|
|
|
|
static int hf_ax25_ftype_s = -1;
|
|
|
|
static int hf_ax25_ftype_i = -1;
|
|
|
|
static int hf_ax25_ftype_su = -1;
|
|
|
|
|
|
|
|
static int hf_ax25_u_cmd = -1;
|
|
|
|
static int hf_ax25_u_resp = -1;
|
|
|
|
|
|
|
|
static int hf_ax25_pid = -1;
|
|
|
|
|
|
|
|
static const xdlc_cf_items ax25_cf_items = {
|
|
|
|
&hf_ax25_n_r,
|
|
|
|
&hf_ax25_n_s,
|
|
|
|
&hf_ax25_p,
|
|
|
|
&hf_ax25_f,
|
|
|
|
&hf_ax25_ftype_s,
|
|
|
|
&hf_ax25_u_cmd,
|
|
|
|
&hf_ax25_u_resp,
|
|
|
|
&hf_ax25_ftype_i,
|
|
|
|
&hf_ax25_ftype_su
|
|
|
|
};
|
|
|
|
|
2012-08-03 01:02:27 +00:00
|
|
|
static const value_string pid_vals[] = {
|
2012-10-22 20:46:47 +00:00
|
|
|
{ AX25_P_ROSE, "Rose" },
|
2012-08-03 01:02:27 +00:00
|
|
|
{ AX25_P_RFC1144C, "RFC1144 (compressed)" },
|
2012-10-22 20:46:47 +00:00
|
|
|
{ AX25_P_RFC1144, "RFC1144 (uncompressed)" },
|
|
|
|
{ AX25_P_SEGMENT, "Segment" },
|
|
|
|
{ AX25_P_TEXNET, "Texnet" },
|
|
|
|
{ AX25_P_LCP, "Link Quality protocol" },
|
|
|
|
{ AX25_P_ATALK, "AppleTalk" },
|
2012-08-03 01:02:27 +00:00
|
|
|
{ AX25_P_ATALKARP, "AppleTalk ARP" },
|
2012-10-22 20:46:47 +00:00
|
|
|
{ AX25_P_IP, "IP" },
|
|
|
|
{ AX25_P_ARP, "ARP" },
|
|
|
|
{ AX25_P_FLEXNET, "FlexNet" },
|
|
|
|
{ AX25_P_NETROM, "NetRom" },
|
|
|
|
{ AX25_P_NO_L3, "No L3" },
|
|
|
|
{ AX25_P_L3_ESC, "L3 esc" },
|
2012-08-03 01:02:27 +00:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2012-08-02 16:54:43 +00:00
|
|
|
static gint ett_ax25 = -1;
|
|
|
|
static gint ett_ax25_ctl = -1;
|
|
|
|
|
2013-08-05 18:09:43 +00:00
|
|
|
static dissector_handle_t ax25_handle;
|
|
|
|
|
|
|
|
static dissector_handle_t data_handle;
|
|
|
|
|
2015-11-10 04:01:28 +00:00
|
|
|
static int
|
|
|
|
dissect_ax25( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_ )
|
2012-08-02 16:54:43 +00:00
|
|
|
{
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *ax25_tree;
|
|
|
|
int offset;
|
|
|
|
int via_index;
|
|
|
|
char *info_buffer;
|
2012-08-02 18:15:44 +00:00
|
|
|
/* char v2cmdresp; */
|
2012-12-21 05:34:38 +00:00
|
|
|
const char *ax25_version;
|
2012-08-02 16:54:43 +00:00
|
|
|
int is_response;
|
|
|
|
guint8 control;
|
|
|
|
guint8 pid = AX25_P_NO_L3;
|
|
|
|
guint8 src_ssid;
|
|
|
|
guint8 dst_ssid;
|
|
|
|
tvbuff_t *next_tvb = NULL;
|
|
|
|
|
|
|
|
|
2013-09-12 20:37:30 +00:00
|
|
|
info_buffer = (char *)wmem_alloc( wmem_packet_scope(), STRLEN );
|
2012-10-22 20:46:47 +00:00
|
|
|
info_buffer[0] = '\0';
|
2012-08-02 16:54:43 +00:00
|
|
|
|
|
|
|
col_set_str( pinfo->cinfo, COL_PROTOCOL, "AX.25" );
|
|
|
|
col_clear( pinfo->cinfo, COL_INFO );
|
|
|
|
|
|
|
|
/* start at the dst addr */
|
|
|
|
offset = 0;
|
2012-09-04 20:42:21 +00:00
|
|
|
/* create display subtree for the protocol */
|
|
|
|
ti = proto_tree_add_protocol_format( parent_tree, proto_ax25, tvb, offset, -1, "AX.25");
|
|
|
|
ax25_tree = proto_item_add_subtree( ti, ett_ax25 );
|
2012-08-02 16:54:43 +00:00
|
|
|
|
2015-01-08 21:16:56 +00:00
|
|
|
proto_tree_add_item( ax25_tree, hf_ax25_dst, tvb, offset, AX25_ADDR_LEN, ENC_NA);
|
2015-10-29 03:12:53 +00:00
|
|
|
set_address_tvb(&pinfo->dl_dst, AT_AX25, AX25_ADDR_LEN, tvb, offset);
|
2015-10-21 19:04:16 +00:00
|
|
|
copy_address_shallow(&pinfo->dst, &pinfo->dl_dst);
|
2015-01-08 21:16:56 +00:00
|
|
|
dst_ssid = tvb_get_guint8(tvb, offset+6);
|
2012-09-04 20:42:21 +00:00
|
|
|
|
|
|
|
/* step over dst addr point at src addr */
|
|
|
|
offset += AX25_ADDR_LEN;
|
2012-08-02 16:54:43 +00:00
|
|
|
|
2015-01-08 21:16:56 +00:00
|
|
|
proto_tree_add_item( ax25_tree, hf_ax25_src, tvb, offset, AX25_ADDR_LEN, ENC_NA);
|
2015-10-29 03:12:53 +00:00
|
|
|
set_address_tvb(&pinfo->dl_src, AT_AX25, AX25_ADDR_LEN, tvb, offset);
|
2015-10-21 19:04:16 +00:00
|
|
|
copy_address_shallow(&pinfo->src, &pinfo->dl_src);
|
2015-01-08 21:16:56 +00:00
|
|
|
src_ssid = tvb_get_guint8(tvb, offset+6);
|
2012-08-02 16:54:43 +00:00
|
|
|
|
2012-09-04 20:42:21 +00:00
|
|
|
/* step over src addr point at either 1st via addr or control byte */
|
|
|
|
offset += AX25_ADDR_LEN;
|
|
|
|
|
2014-12-19 23:13:17 +00:00
|
|
|
proto_item_append_text( ti, ", Src: %s, Dst: %s",
|
|
|
|
address_to_str(wmem_packet_scope(), &pinfo->src),
|
|
|
|
address_to_str(wmem_packet_scope(), &pinfo->dst));
|
2012-08-02 16:54:43 +00:00
|
|
|
|
|
|
|
/* decode the cmd/resp field */
|
2012-08-02 18:15:44 +00:00
|
|
|
/* v2cmdresp = '.'; */
|
2012-08-02 16:54:43 +00:00
|
|
|
switch ( ( (dst_ssid >> 6) & 0x02) | ( (src_ssid >> 7) & 0x01 ) )
|
|
|
|
{
|
|
|
|
case 1 : /* V2.0 Response */
|
|
|
|
ax25_version = "V2.0+";
|
2012-08-02 18:15:44 +00:00
|
|
|
/* v2cmdresp = 'R'; */
|
2012-08-02 16:54:43 +00:00
|
|
|
is_response = TRUE;
|
|
|
|
break;
|
|
|
|
case 2 : /* V2.0 Command */
|
|
|
|
ax25_version = "V2.0+";
|
2012-08-02 18:15:44 +00:00
|
|
|
/* v2cmdresp = 'C'; */
|
2012-08-02 16:54:43 +00:00
|
|
|
is_response = FALSE;
|
|
|
|
break;
|
|
|
|
default :
|
|
|
|
ax25_version = "V?.?";
|
2012-08-02 18:15:44 +00:00
|
|
|
/* v2cmdresp = '?'; */
|
2012-08-02 16:54:43 +00:00
|
|
|
is_response = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2012-09-04 20:42:21 +00:00
|
|
|
proto_item_append_text( ti, ", Ver: %s", ax25_version );
|
2012-08-02 16:54:43 +00:00
|
|
|
|
2012-08-03 01:02:27 +00:00
|
|
|
/* handle the vias, if any */
|
|
|
|
via_index = 0;
|
|
|
|
while ( ( tvb_get_guint8( tvb, offset - 1 ) & 0x01 ) == 0 )
|
|
|
|
{
|
|
|
|
if ( via_index < AX25_MAX_DIGIS )
|
2012-08-02 16:54:43 +00:00
|
|
|
{
|
2015-01-08 21:16:56 +00:00
|
|
|
proto_tree_add_item( ax25_tree, hf_ax25_via[ via_index ], tvb, offset, AX25_ADDR_LEN, ENC_NA);
|
2012-08-03 01:02:27 +00:00
|
|
|
via_index++;
|
2012-08-02 16:54:43 +00:00
|
|
|
}
|
2012-08-03 01:02:27 +00:00
|
|
|
/* step over a via addr */
|
|
|
|
offset += AX25_ADDR_LEN;
|
2012-08-02 16:54:43 +00:00
|
|
|
}
|
|
|
|
|
2012-09-04 20:42:21 +00:00
|
|
|
/* XXX - next-to-last argument should be TRUE if modulo 128 operation */
|
|
|
|
control = dissect_xdlc_control( tvb,
|
|
|
|
offset,
|
|
|
|
pinfo,
|
|
|
|
ax25_tree,
|
|
|
|
hf_ax25_ctl,
|
|
|
|
ett_ax25_ctl,
|
|
|
|
&ax25_cf_items,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
is_response,
|
|
|
|
FALSE,
|
|
|
|
FALSE );
|
|
|
|
/* XXX - second argument should be TRUE if modulo 128 operation */
|
|
|
|
offset += XDLC_CONTROL_LEN(control, FALSE); /* step over control field */
|
|
|
|
|
|
|
|
if ( XDLC_IS_INFORMATION( control ) )
|
2012-08-02 16:54:43 +00:00
|
|
|
{
|
2012-08-03 01:02:27 +00:00
|
|
|
|
|
|
|
pid = tvb_get_guint8( tvb, offset );
|
|
|
|
col_append_fstr( pinfo->cinfo, COL_INFO, ", %s", val_to_str(pid, pid_vals, "Unknown (0x%02x)") );
|
|
|
|
proto_tree_add_uint( ax25_tree, hf_ax25_pid, tvb, offset, 1, pid );
|
|
|
|
|
|
|
|
/* Call sub-dissectors here */
|
|
|
|
|
2012-08-02 16:54:43 +00:00
|
|
|
offset += 1; /* step over pid to the 1st byte of the payload */
|
|
|
|
|
2012-09-04 20:42:21 +00:00
|
|
|
proto_item_set_end(ti, tvb, offset);
|
|
|
|
|
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, offset);
|
2012-08-02 16:54:43 +00:00
|
|
|
|
2012-08-03 01:58:12 +00:00
|
|
|
if (!dissector_try_uint(ax25_dissector_table, pid, next_tvb, pinfo, parent_tree))
|
2012-08-02 16:54:43 +00:00
|
|
|
{
|
2012-08-03 01:58:12 +00:00
|
|
|
call_dissector(data_handle, next_tvb, pinfo, parent_tree);
|
2012-08-02 16:54:43 +00:00
|
|
|
}
|
|
|
|
}
|
2012-09-04 20:42:21 +00:00
|
|
|
else
|
|
|
|
proto_item_set_end(ti, tvb, offset);
|
2015-11-10 04:01:28 +00:00
|
|
|
|
|
|
|
return tvb_captured_length(tvb);
|
2012-08-02 16:54:43 +00:00
|
|
|
}
|
|
|
|
|
2015-12-13 21:54:16 +00:00
|
|
|
gboolean
|
2015-12-15 00:25:31 +00:00
|
|
|
capture_ax25( const guchar *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_)
|
2012-10-22 20:46:47 +00:00
|
|
|
{
|
|
|
|
guint8 control;
|
|
|
|
guint8 pid;
|
|
|
|
int l_offset;
|
|
|
|
|
|
|
|
if ( ! BYTES_ARE_IN_FRAME( offset, len, AX25_HEADER_SIZE ) )
|
2015-12-13 21:54:16 +00:00
|
|
|
return FALSE;
|
2012-10-22 20:46:47 +00:00
|
|
|
|
|
|
|
l_offset = offset;
|
|
|
|
l_offset += AX25_ADDR_LEN; /* step over dst addr point at src addr */
|
|
|
|
l_offset += AX25_ADDR_LEN; /* step over src addr point at either 1st via addr or control byte */
|
|
|
|
while ( ( pd[ l_offset - 1 ] & 0x01 ) == 0 )
|
|
|
|
l_offset += AX25_ADDR_LEN; /* step over a via addr */
|
|
|
|
|
|
|
|
control = pd[ l_offset ];
|
|
|
|
|
|
|
|
/* decode the pid field (if appropriate) */
|
|
|
|
if ( XDLC_IS_INFORMATION( control ) )
|
2015-12-13 21:54:16 +00:00
|
|
|
{
|
2012-10-22 20:46:47 +00:00
|
|
|
l_offset += 1; /* step over control byte point at pid */
|
|
|
|
pid = pd[ l_offset ];
|
|
|
|
|
|
|
|
l_offset += 1; /* step over the pid and point to the first byte of the payload */
|
2015-12-15 00:25:31 +00:00
|
|
|
return try_capture_dissector("ax25.pid", pid & 0x0ff, pd, l_offset, len, cpinfo, pseudo_header);
|
2015-12-13 21:54:16 +00:00
|
|
|
}
|
|
|
|
return FALSE;
|
2012-10-22 20:46:47 +00:00
|
|
|
}
|
|
|
|
|
2012-08-02 16:54:43 +00:00
|
|
|
void
|
|
|
|
proto_register_ax25(void)
|
2012-08-02 18:15:44 +00:00
|
|
|
{
|
2012-08-02 16:54:43 +00:00
|
|
|
/* Setup list of header fields */
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_ax25_dst,
|
|
|
|
{ "Destination", "ax25.dst",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_AX25, BASE_NONE, NULL, 0x0,
|
2012-08-02 16:54:43 +00:00
|
|
|
"Destination callsign", HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_ax25_src,
|
|
|
|
{ "Source", "ax25.src",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_AX25, BASE_NONE, NULL, 0x0,
|
2012-08-02 16:54:43 +00:00
|
|
|
"Source callsign", HFILL }
|
|
|
|
},
|
2013-01-29 13:33:04 +00:00
|
|
|
{ &hf_ax25_via[ 0 ],
|
2012-08-02 16:54:43 +00:00
|
|
|
{ "Via 1", "ax25.via1",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_AX25, BASE_NONE, NULL, 0x0,
|
2012-08-02 16:54:43 +00:00
|
|
|
"Via callsign 1", HFILL }
|
|
|
|
},
|
2013-01-29 13:33:04 +00:00
|
|
|
{ &hf_ax25_via[ 1 ],
|
2012-08-02 16:54:43 +00:00
|
|
|
{ "Via 2", "ax25.via2",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_AX25, BASE_NONE, NULL, 0x0,
|
2012-08-02 16:54:43 +00:00
|
|
|
"Via callsign 2", HFILL }
|
|
|
|
},
|
2013-01-29 13:33:04 +00:00
|
|
|
{ &hf_ax25_via[ 2 ],
|
2012-08-02 16:54:43 +00:00
|
|
|
{ "Via 3", "ax25.via3",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_AX25, BASE_NONE, NULL, 0x0,
|
2012-08-02 16:54:43 +00:00
|
|
|
"Via callsign 3", HFILL }
|
|
|
|
},
|
2013-01-29 13:33:04 +00:00
|
|
|
{ &hf_ax25_via[ 3 ],
|
2012-08-02 16:54:43 +00:00
|
|
|
{ "Via 4", "ax25.via4",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_AX25, BASE_NONE, NULL, 0x0,
|
2012-08-02 16:54:43 +00:00
|
|
|
"Via callsign 4", HFILL }
|
|
|
|
},
|
2013-01-29 13:33:04 +00:00
|
|
|
{ &hf_ax25_via[ 4 ],
|
2012-08-02 16:54:43 +00:00
|
|
|
{ "Via 5", "ax25.via5",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_AX25, BASE_NONE, NULL, 0x0,
|
2012-08-02 16:54:43 +00:00
|
|
|
"Via callsign 5", HFILL }
|
|
|
|
},
|
2013-01-29 13:33:04 +00:00
|
|
|
{ &hf_ax25_via[ 5 ],
|
2012-08-02 16:54:43 +00:00
|
|
|
{ "Via 6", "ax25.via6",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_AX25, BASE_NONE, NULL, 0x0,
|
2012-08-02 16:54:43 +00:00
|
|
|
"Via callsign 6", HFILL }
|
|
|
|
},
|
2013-01-29 13:33:04 +00:00
|
|
|
{ &hf_ax25_via[ 6 ],
|
2012-08-02 16:54:43 +00:00
|
|
|
{ "Via 7", "ax25.via7",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_AX25, BASE_NONE, NULL, 0x0,
|
2012-08-02 16:54:43 +00:00
|
|
|
"Via callsign 7", HFILL }
|
|
|
|
},
|
2013-01-29 13:33:04 +00:00
|
|
|
{ &hf_ax25_via[ 7 ],
|
2012-08-02 16:54:43 +00:00
|
|
|
{ "Via 8", "ax25.via8",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_AX25, BASE_NONE, NULL, 0x0,
|
2012-08-02 16:54:43 +00:00
|
|
|
"Via callsign 8", HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_ax25_ctl,
|
|
|
|
{ "Control", "ax25.ctl",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_UINT8, BASE_HEX, NULL, 0x0,
|
2012-08-02 16:54:43 +00:00
|
|
|
"Control field", HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_ax25_n_r,
|
|
|
|
{ "n(r)", "ax25.ctl.n_r",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_UINT8, BASE_DEC, NULL, XDLC_N_R_MASK,
|
2012-10-22 20:46:47 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 16:54:43 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_n_s,
|
|
|
|
{ "n(s)", "ax25.ctl.n_s",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_UINT8, BASE_DEC, NULL, XDLC_N_S_MASK,
|
2012-10-22 20:46:47 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 16:54:43 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_p,
|
|
|
|
{ "Poll", "ax25.ctl.p",
|
2015-12-20 01:56:15 +00:00
|
|
|
FT_BOOLEAN, 8, TFS(&tfs_set_notset), XDLC_P_F,
|
2012-10-22 20:46:47 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 16:54:43 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_f,
|
|
|
|
{ "Final", "ax25.ctl.f",
|
2015-12-20 01:56:15 +00:00
|
|
|
FT_BOOLEAN, 8, TFS(&tfs_set_notset), XDLC_P_F,
|
2012-10-22 20:46:47 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 16:54:43 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_ftype_s,
|
|
|
|
{ "Frame type", "ax25.ctl.ftype_s",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_UINT8, BASE_HEX, VALS(stype_vals), XDLC_S_FTYPE_MASK,
|
2012-10-22 20:46:47 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 16:54:43 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_ftype_i,
|
|
|
|
{ "Frame type", "ax25.ctl.ftype_i",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_UINT8, BASE_HEX, VALS(ftype_vals), XDLC_I_MASK,
|
2012-10-22 20:46:47 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 16:54:43 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_ftype_su,
|
|
|
|
{ "Frame type", "ax25.ctl.ftype_su",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_UINT8, BASE_HEX, VALS(ftype_vals), XDLC_S_U_MASK,
|
2012-10-22 20:46:47 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 16:54:43 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_u_cmd,
|
|
|
|
{ "Frame type", "ax25.ctl.u_cmd",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_UINT8, BASE_HEX, VALS(modifier_vals_cmd), XDLC_U_MODIFIER_MASK,
|
2012-10-22 20:46:47 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 16:54:43 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_u_resp,
|
|
|
|
{ "Frame type", "ax25.ctl.u_resp",
|
2012-08-02 18:15:44 +00:00
|
|
|
FT_UINT8, BASE_HEX, VALS(modifier_vals_resp), XDLC_U_MODIFIER_MASK,
|
2012-10-22 20:46:47 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 16:54:43 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_pid,
|
2012-09-04 20:42:21 +00:00
|
|
|
{ "Protocol ID", "ax25.pid",
|
2012-08-03 01:02:27 +00:00
|
|
|
FT_UINT8, BASE_HEX, VALS(pid_vals), 0x0,
|
2012-09-04 20:42:21 +00:00
|
|
|
"Protocol identifier", HFILL }
|
2012-08-02 16:54:43 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_ax25,
|
|
|
|
&ett_ax25_ctl,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Register the protocol name and description */
|
2012-08-03 01:58:12 +00:00
|
|
|
proto_ax25 = proto_register_protocol("Amateur Radio AX.25", "AX.25", "ax25");
|
2012-08-02 16:54:43 +00:00
|
|
|
|
|
|
|
/* Register the dissector */
|
2015-12-09 04:04:01 +00:00
|
|
|
ax25_handle = register_dissector( "ax25", dissect_ax25, proto_ax25 );
|
2012-08-02 16:54:43 +00:00
|
|
|
|
|
|
|
/* Required function calls to register the header fields and subtrees used */
|
|
|
|
proto_register_field_array( proto_ax25, hf, array_length(hf ) );
|
|
|
|
proto_register_subtree_array(ett, array_length(ett ) );
|
2012-08-03 01:58:12 +00:00
|
|
|
|
|
|
|
/* Register dissector table for protocol IDs */
|
2015-10-29 13:23:55 +00:00
|
|
|
ax25_dissector_table = register_dissector_table("ax25.pid", "AX.25 protocol ID", FT_UINT8, BASE_HEX, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE);
|
2015-12-14 13:48:59 +00:00
|
|
|
register_capture_dissector_table("ax25.pid", "AX.25");
|
2012-08-02 16:54:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_ax25(void)
|
|
|
|
{
|
2012-10-22 20:46:47 +00:00
|
|
|
dissector_add_uint("wtap_encap", WTAP_ENCAP_AX25, ax25_handle);
|
|
|
|
dissector_add_uint("ip.proto", IP_PROTO_AX25, ax25_handle);
|
2012-08-03 01:58:12 +00:00
|
|
|
|
2015-12-13 21:54:16 +00:00
|
|
|
register_capture_dissector("wtap_encap", WTAP_ENCAP_AX25, capture_ax25, proto_ax25);
|
|
|
|
|
2012-10-22 20:46:47 +00:00
|
|
|
data_handle = find_dissector( "data" );
|
2012-08-03 01:58:12 +00:00
|
|
|
|
2012-08-02 16:54:43 +00:00
|
|
|
}
|
|
|
|
|
2014-09-30 20:59:17 +00:00
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|