2012-08-02 06:45:51 +00:00
|
|
|
/* packet-ax25-kiss.c
|
|
|
|
*
|
|
|
|
* Routines for AX.25 KISS protocol dissection
|
|
|
|
* Copyright 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 06:45:51 +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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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 06:45:51 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This dissector handles the "KISS" protocol as implemented by the
|
|
|
|
* Linux kernel.
|
|
|
|
*
|
|
|
|
* The original definition of the KISS protocol can be found here:
|
|
|
|
* http://www.ka9q.net/papers/kiss.html
|
|
|
|
* and here:
|
|
|
|
* http://www.ax25.net/kiss.aspx
|
|
|
|
*
|
2012-10-22 20:46:47 +00:00
|
|
|
* The Linux implementation does not appear to attempt to implement that
|
|
|
|
* protocol in full. It does provide the ability to send a KISS command via
|
2012-08-02 06:45:51 +00:00
|
|
|
* ax25_kiss_cmd() and internally will send FULLDUPLEX KISS commands if
|
|
|
|
* DAMA is enabled/disabled.
|
|
|
|
* i.e.:
|
|
|
|
* ax25_dev_dama_on sends FullDuplex ON
|
|
|
|
* ax25_dev_dama_off sends FullDuplex OFF
|
|
|
|
*
|
|
|
|
* Data frames are prefixed with a "Data Frame" command but the port appears to
|
|
|
|
* be always 0.
|
|
|
|
*
|
|
|
|
* Abstract from http://www.ka9q.net/papers/kiss.html
|
|
|
|
* --------------------------------------------------
|
|
|
|
* For reference the first byte of a KISS frame is the frame type and the TNC
|
|
|
|
* port number,
|
|
|
|
* LSB 4 bits = frame type,
|
|
|
|
* MSB 4 bits = port number.
|
|
|
|
*
|
|
|
|
* The frame types are:
|
|
|
|
* Command Function Comments
|
|
|
|
* 0 Data frame The rest of the frame is data to
|
|
|
|
* be sent on the HDLC channel.
|
|
|
|
*
|
|
|
|
* 1 TXDELAY The next byte is the transmitter
|
|
|
|
* keyup delay in 10 ms units.
|
|
|
|
* The default start-up value is 50
|
|
|
|
* (i.e., 500 ms).
|
|
|
|
*
|
|
|
|
* 2 P The next byte is the persistence
|
|
|
|
* parameter, p, scaled to the range
|
|
|
|
* 0 - 255 with the following
|
|
|
|
* formula:
|
|
|
|
*
|
|
|
|
* P = p * 256 - 1
|
|
|
|
*
|
|
|
|
* The default value is P = 63
|
|
|
|
* (i.e., p = 0.25).
|
|
|
|
*
|
|
|
|
* 3 SlotTime The next byte is the slot interval
|
|
|
|
* in 10 ms units.
|
|
|
|
* The default is 10 (i.e., 100ms).
|
|
|
|
*
|
|
|
|
* 4 TXtail The next byte is the time to hold
|
|
|
|
* up the TX after the FCS has been
|
|
|
|
* sent, in 10 ms units. This command
|
|
|
|
* is obsolete, and is included here
|
|
|
|
* only for compatibility with some
|
|
|
|
* existing implementations.
|
|
|
|
*
|
|
|
|
* 5 FullDuplex The next byte is 0 for half duplex,
|
|
|
|
* nonzero for full duplex.
|
|
|
|
* The default is 0
|
|
|
|
* (i.e., half duplex).
|
|
|
|
*
|
|
|
|
* 6 SetHardware Specific for each TNC. In the
|
|
|
|
* TNC-1, this command sets the
|
|
|
|
* modem speed. Other implementations
|
|
|
|
* may use this function for other
|
|
|
|
* hardware-specific functions.
|
|
|
|
*
|
|
|
|
* FF Return Exit KISS and return control to a
|
|
|
|
* higher-level program. This is useful
|
|
|
|
* only when KISS is incorporated
|
2015-04-27 15:08:09 +00:00
|
|
|
* into the TNC along with other
|
2012-08-02 06:45:51 +00:00
|
|
|
* applications.
|
|
|
|
*
|
2015-04-27 15:08:09 +00:00
|
|
|
*
|
|
|
|
* G8BPQ extensions:
|
|
|
|
*
|
|
|
|
* 12 Data frame Data with acknowledge request
|
|
|
|
*
|
|
|
|
* 14 Poll mode Set poll mode
|
|
|
|
*
|
|
|
|
* Checksum mode
|
|
|
|
*
|
2012-08-02 06:45:51 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2012-08-02 06:45:51 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
2015-12-13 04:38:21 +00:00
|
|
|
#include <epan/capture_dissectors.h>
|
2015-04-27 15:08:09 +00:00
|
|
|
#include <epan/prefs.h>
|
2013-11-29 20:53:00 +00:00
|
|
|
#include <wiretap/wtap.h>
|
2012-08-02 16:54:43 +00:00
|
|
|
#include "packet-ax25.h"
|
2012-08-02 06:45:51 +00:00
|
|
|
|
|
|
|
#define STRLEN 80
|
|
|
|
|
2012-10-22 20:46:47 +00:00
|
|
|
#define KISS_HEADER_SIZE 1 /* length of the KISS type header */
|
2012-08-02 06:45:51 +00:00
|
|
|
|
|
|
|
/* KISS frame types */
|
2012-10-22 20:46:47 +00:00
|
|
|
#define KISS_DATA_FRAME 0
|
|
|
|
#define KISS_TXDELAY 1
|
|
|
|
#define KISS_PERSISTENCE 2
|
|
|
|
#define KISS_SLOT_TIME 3
|
|
|
|
#define KISS_TXTAIL 4
|
|
|
|
#define KISS_FULLDUPLEX 5
|
|
|
|
#define KISS_SETHARDWARE 6
|
2015-04-27 15:08:09 +00:00
|
|
|
#define KISS_DATA_FRAME_ACK 12
|
|
|
|
#define KISS_POLL_MODE 14
|
2012-08-02 06:45:51 +00:00
|
|
|
#define KISS_RETURN 15
|
|
|
|
|
|
|
|
#define KISS_CMD_MASK 0x0f
|
|
|
|
#define KISS_PORT_MASK 0xf0
|
|
|
|
|
2015-04-27 15:08:09 +00:00
|
|
|
/* Global preferences */
|
|
|
|
static gboolean gPREF_CKSUM_MODE = FALSE;
|
|
|
|
|
2013-03-13 21:14:20 +00:00
|
|
|
void proto_register_ax25_kiss(void);
|
|
|
|
void proto_reg_handoff_ax25_kiss(void);
|
|
|
|
|
2012-08-02 06:45:51 +00:00
|
|
|
/* Initialize the protocol and registered fields */
|
|
|
|
static int proto_ax25_kiss = -1;
|
2012-10-22 20:46:47 +00:00
|
|
|
|
2012-08-02 06:45:51 +00:00
|
|
|
static int hf_ax25_kiss_cmd = -1;
|
|
|
|
static int hf_ax25_kiss_port = -1;
|
2012-10-22 20:46:47 +00:00
|
|
|
static int hf_ax25_kiss_txdelay = -1;
|
2012-08-02 06:45:51 +00:00
|
|
|
static int hf_ax25_kiss_persistence = -1;
|
|
|
|
static int hf_ax25_kiss_slottime = -1;
|
2012-10-22 20:46:47 +00:00
|
|
|
static int hf_ax25_kiss_txtail = -1;
|
2012-08-02 06:45:51 +00:00
|
|
|
static int hf_ax25_kiss_fullduplex = -1;
|
|
|
|
static int hf_ax25_kiss_sethardware = -1;
|
2015-04-27 15:08:09 +00:00
|
|
|
static int hf_ax25_kiss_data_ack = -1;
|
|
|
|
static int hf_ax25_kiss_cksum = -1;
|
|
|
|
|
2012-08-02 06:45:51 +00:00
|
|
|
|
|
|
|
/* Initialize the subtree pointers */
|
|
|
|
static gint ett_ax25_kiss = -1;
|
|
|
|
|
2013-08-05 18:09:43 +00:00
|
|
|
static dissector_handle_t kiss_handle;
|
|
|
|
|
|
|
|
/* Dissector handles - all the possibles are listed */
|
|
|
|
static dissector_handle_t ax25_handle;
|
|
|
|
|
2012-08-03 02:19:18 +00:00
|
|
|
static const value_string kiss_frame_types[] = {
|
2015-04-27 15:08:09 +00:00
|
|
|
{ KISS_DATA_FRAME, "Data frame" },
|
|
|
|
{ KISS_TXDELAY, "Tx delay" },
|
|
|
|
{ KISS_PERSISTENCE, "Persistence" },
|
|
|
|
{ KISS_SLOT_TIME, "Slot time" },
|
|
|
|
{ KISS_TXTAIL, "Tx tail" },
|
|
|
|
{ KISS_FULLDUPLEX, "Full duplex" },
|
|
|
|
{ KISS_SETHARDWARE, "Set hardware" },
|
|
|
|
{ KISS_DATA_FRAME_ACK, "Data frame ack" },
|
|
|
|
{ KISS_POLL_MODE, "Poll mode" },
|
|
|
|
{ KISS_RETURN, "Return" },
|
2012-08-03 02:19:18 +00:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2015-12-13 21:54:16 +00:00
|
|
|
static gboolean
|
Fix some warnings/errors of type
git/epan/dissectors/packet-a21.c:478:25: error: 'item' was marked unused but was used
[-Werror,-Wused-but-marked-unused]
proto_item_append_text(item, "%s", val_to_str_const(event_id, a21_event_vals, "Unknown"));
^
Added manual change id because file-jpeg.c forced the use of commit -n
Change-Id: Iffff53d6253758c8454d9583f0a11f317c8390cb
Fix warnings/errors of type:
git/epan/dissectors/packet-ax25-kiss.c:205:52: error: 'pseudo_header' was marked unused but was
used [-Werror,-Wused-but-marked-unused]
return capture_ax25( pd, l_offset, len, cpinfo, pseudo_header );
Fix checkhf warnings:
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_address_netswitch
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_address_subswitch
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_poll_reply_trailer
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_rdm_universe
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_tod_data_universe
Change-Id: Id1fa12afb97a8e9cd4ed0ea25351c3b2639c930e
Reviewed-on: https://code.wireshark.org/review/14667
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2016-03-28 11:37:24 +00:00
|
|
|
capture_ax25_kiss( const guchar *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header)
|
2012-10-22 20:46:47 +00:00
|
|
|
{
|
|
|
|
int l_offset;
|
|
|
|
guint8 kiss_cmd;
|
|
|
|
|
|
|
|
if ( ! BYTES_ARE_IN_FRAME( offset, len, KISS_HEADER_SIZE ) )
|
2015-12-13 21:54:16 +00:00
|
|
|
return FALSE;
|
2012-10-22 20:46:47 +00:00
|
|
|
|
|
|
|
l_offset = offset;
|
|
|
|
kiss_cmd = pd[ l_offset ];
|
|
|
|
l_offset += KISS_HEADER_SIZE; /* step over kiss header */
|
|
|
|
switch ( kiss_cmd & KISS_CMD_MASK )
|
2015-12-13 21:54:16 +00:00
|
|
|
{
|
|
|
|
case KISS_DATA_FRAME :
|
2015-12-15 00:25:31 +00:00
|
|
|
return capture_ax25( pd, l_offset, len, cpinfo, pseudo_header );
|
2013-07-15 18:05:04 +00:00
|
|
|
case KISS_TXDELAY : break;
|
|
|
|
case KISS_PERSISTENCE : break;
|
|
|
|
case KISS_SLOT_TIME : break;
|
|
|
|
case KISS_TXTAIL : break;
|
|
|
|
case KISS_FULLDUPLEX : break;
|
|
|
|
case KISS_SETHARDWARE : break;
|
2015-12-13 21:54:16 +00:00
|
|
|
case KISS_DATA_FRAME_ACK:
|
|
|
|
l_offset += 2;
|
2015-12-15 00:25:31 +00:00
|
|
|
return capture_ax25( pd, l_offset, len, cpinfo, pseudo_header );
|
2015-04-27 15:08:09 +00:00
|
|
|
case KISS_POLL_MODE : break;
|
2012-10-22 20:46:47 +00:00
|
|
|
case KISS_RETURN : break;
|
|
|
|
default : break;
|
2015-12-13 21:54:16 +00:00
|
|
|
}
|
|
|
|
return FALSE;
|
2012-10-22 20:46:47 +00:00
|
|
|
}
|
|
|
|
|
2012-08-02 06:45:51 +00:00
|
|
|
/* Code to actually dissect the packets */
|
2015-11-10 04:01:28 +00:00
|
|
|
static int
|
|
|
|
dissect_ax25_kiss( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_ )
|
2012-08-02 06:45:51 +00:00
|
|
|
{
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *kiss_tree;
|
2012-10-22 20:46:47 +00:00
|
|
|
int offset;
|
|
|
|
int kiss_cmd;
|
|
|
|
int kiss_type;
|
|
|
|
int kiss_port;
|
|
|
|
int kiss_param;
|
|
|
|
int kiss_param_len;
|
2015-04-27 15:08:09 +00:00
|
|
|
int kiss_cksum;
|
|
|
|
int kiss_cksum_index;
|
|
|
|
int kiss_tvb_length;
|
2012-08-03 02:19:18 +00:00
|
|
|
const char *frame_type_text;
|
2012-10-22 20:46:47 +00:00
|
|
|
char *info_buffer;
|
|
|
|
tvbuff_t *next_tvb = NULL;
|
2012-08-02 06:45:51 +00:00
|
|
|
|
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 06:45:51 +00:00
|
|
|
|
2012-08-02 16:54:43 +00:00
|
|
|
col_set_str( pinfo->cinfo, COL_PROTOCOL, "AX.25 KISS" );
|
2012-08-02 06:45:51 +00:00
|
|
|
col_clear( pinfo->cinfo, COL_INFO );
|
|
|
|
|
|
|
|
/* protocol offset for the KISS header */
|
|
|
|
offset = 0;
|
|
|
|
|
2012-10-22 20:46:47 +00:00
|
|
|
kiss_cmd = tvb_get_guint8( tvb, offset ) & 0xff;
|
|
|
|
kiss_type = kiss_cmd & KISS_CMD_MASK;
|
|
|
|
kiss_port = (kiss_cmd & KISS_PORT_MASK) >> 4;
|
|
|
|
offset += KISS_HEADER_SIZE;
|
2012-08-02 06:45:51 +00:00
|
|
|
|
2012-10-22 20:46:47 +00:00
|
|
|
kiss_param = 0;
|
|
|
|
kiss_param_len = 0;
|
2012-08-02 06:45:51 +00:00
|
|
|
switch ( kiss_type )
|
|
|
|
{
|
2012-08-03 02:19:18 +00:00
|
|
|
case KISS_TXDELAY : kiss_param_len = 1; kiss_param = tvb_get_guint8( tvb, offset ) & 0xff; break;
|
|
|
|
case KISS_PERSISTENCE : kiss_param_len = 1; kiss_param = tvb_get_guint8( tvb, offset ) & 0xff; break;
|
|
|
|
case KISS_SLOT_TIME : kiss_param_len = 1; kiss_param = tvb_get_guint8( tvb, offset ) & 0xff; break;
|
|
|
|
case KISS_TXTAIL : kiss_param_len = 1; kiss_param = tvb_get_guint8( tvb, offset ) & 0xff; break;
|
|
|
|
case KISS_FULLDUPLEX : kiss_param_len = 1; kiss_param = tvb_get_guint8( tvb, offset ) & 0xff; break;
|
2015-04-27 15:08:09 +00:00
|
|
|
case KISS_SETHARDWARE :
|
|
|
|
kiss_param_len = tvb_captured_length_remaining( tvb, offset );
|
|
|
|
if ( kiss_param_len < 0 )
|
|
|
|
kiss_param_len = 0;
|
|
|
|
if ( (kiss_param_len > 0) && gPREF_CKSUM_MODE )
|
|
|
|
kiss_param_len--;
|
|
|
|
break;
|
|
|
|
case KISS_DATA_FRAME_ACK: kiss_param_len = 2; kiss_param = tvb_get_guint8( tvb, offset ) & 0xff; break;
|
2012-08-02 06:45:51 +00:00
|
|
|
default : break;
|
|
|
|
}
|
2012-08-03 02:19:18 +00:00
|
|
|
frame_type_text = val_to_str(kiss_type, kiss_frame_types, "Unknown (%u)");
|
2012-08-02 06:45:51 +00:00
|
|
|
g_snprintf( info_buffer, STRLEN, "%s, Port %u", frame_type_text, kiss_port );
|
|
|
|
if ( kiss_param_len > 0 )
|
2012-10-22 20:46:47 +00:00
|
|
|
g_snprintf( info_buffer, STRLEN, "%s %u, Port %u", frame_type_text, kiss_param, kiss_port );
|
2012-08-02 06:45:51 +00:00
|
|
|
|
|
|
|
offset += kiss_param_len;
|
|
|
|
|
|
|
|
col_add_str( pinfo->cinfo, COL_INFO, info_buffer );
|
|
|
|
|
|
|
|
if ( parent_tree )
|
|
|
|
{
|
|
|
|
/* protocol offset for the KISS header */
|
|
|
|
offset = 0;
|
|
|
|
|
|
|
|
/* create display subtree for the protocol */
|
|
|
|
ti = proto_tree_add_protocol_format( parent_tree, proto_ax25_kiss, tvb, offset,
|
2015-04-27 15:08:09 +00:00
|
|
|
tvb_captured_length_remaining( tvb, offset ),
|
2012-08-02 06:45:51 +00:00
|
|
|
"KISS: %s",
|
|
|
|
info_buffer
|
|
|
|
);
|
|
|
|
|
|
|
|
kiss_tree = proto_item_add_subtree( ti, ett_ax25_kiss );
|
|
|
|
|
|
|
|
proto_tree_add_uint( kiss_tree, hf_ax25_kiss_cmd, tvb, offset, KISS_HEADER_SIZE,
|
|
|
|
kiss_cmd );
|
|
|
|
proto_tree_add_uint( kiss_tree, hf_ax25_kiss_port, tvb, offset, KISS_HEADER_SIZE,
|
2013-10-27 16:03:11 +00:00
|
|
|
kiss_port );
|
2012-08-02 06:45:51 +00:00
|
|
|
offset += KISS_HEADER_SIZE;
|
|
|
|
|
|
|
|
switch ( kiss_type )
|
|
|
|
{
|
|
|
|
case KISS_DATA_FRAME : break;
|
|
|
|
case KISS_TXDELAY :
|
|
|
|
proto_tree_add_uint( kiss_tree, hf_ax25_kiss_txdelay,
|
|
|
|
tvb, offset, kiss_param_len, kiss_param );
|
|
|
|
offset += kiss_param_len;
|
|
|
|
break;
|
|
|
|
case KISS_PERSISTENCE :
|
|
|
|
proto_tree_add_uint( kiss_tree, hf_ax25_kiss_persistence,
|
|
|
|
tvb, offset, kiss_param_len, kiss_param );
|
|
|
|
offset += kiss_param_len;
|
|
|
|
break;
|
|
|
|
case KISS_SLOT_TIME :
|
|
|
|
proto_tree_add_uint( kiss_tree, hf_ax25_kiss_slottime,
|
|
|
|
tvb, offset, kiss_param_len, kiss_param );
|
|
|
|
offset += kiss_param_len;
|
|
|
|
break;
|
|
|
|
case KISS_TXTAIL :
|
|
|
|
proto_tree_add_uint( kiss_tree, hf_ax25_kiss_txtail,
|
|
|
|
tvb, offset, kiss_param_len, kiss_param );
|
|
|
|
offset += kiss_param_len;
|
|
|
|
break;
|
|
|
|
case KISS_FULLDUPLEX :
|
|
|
|
proto_tree_add_uint( kiss_tree, hf_ax25_kiss_fullduplex,
|
|
|
|
tvb, offset, kiss_param_len, kiss_param );
|
|
|
|
offset += kiss_param_len;
|
|
|
|
break;
|
|
|
|
case KISS_SETHARDWARE :
|
2015-04-27 15:08:09 +00:00
|
|
|
proto_tree_add_item( kiss_tree, hf_ax25_kiss_sethardware,
|
|
|
|
tvb, offset, kiss_param_len, ENC_NA );
|
|
|
|
offset += kiss_param_len;
|
|
|
|
break;
|
|
|
|
case KISS_DATA_FRAME_ACK:
|
|
|
|
proto_tree_add_uint( kiss_tree, hf_ax25_kiss_data_ack,
|
2012-08-02 06:45:51 +00:00
|
|
|
tvb, offset, kiss_param_len, kiss_param );
|
|
|
|
offset += kiss_param_len;
|
|
|
|
break;
|
2015-04-27 15:08:09 +00:00
|
|
|
case KISS_POLL_MODE : break;
|
2012-08-02 06:45:51 +00:00
|
|
|
case KISS_RETURN : break;
|
|
|
|
default : break;
|
|
|
|
}
|
|
|
|
|
2015-04-27 15:08:09 +00:00
|
|
|
if ( gPREF_CKSUM_MODE )
|
|
|
|
{
|
|
|
|
kiss_cksum = 0;
|
|
|
|
kiss_tvb_length = tvb_captured_length_remaining( tvb, 0 ) - 1;
|
|
|
|
if ( kiss_tvb_length > 0 )
|
|
|
|
{
|
|
|
|
for ( kiss_cksum_index = 0; kiss_cksum_index < kiss_tvb_length; kiss_cksum_index++ )
|
|
|
|
kiss_cksum ^= (tvb_get_guint8( tvb, kiss_cksum_index ) & 0xff);
|
|
|
|
proto_tree_add_uint( kiss_tree, hf_ax25_kiss_cksum,
|
|
|
|
tvb, kiss_cksum_index, 1, kiss_cksum );
|
|
|
|
}
|
|
|
|
}
|
2012-08-02 06:45:51 +00:00
|
|
|
}
|
2015-04-27 15:08:09 +00:00
|
|
|
|
2012-08-02 06:45:51 +00:00
|
|
|
/* Call sub-dissectors here */
|
|
|
|
|
2015-04-27 15:08:09 +00:00
|
|
|
if ( ( kiss_type == KISS_DATA_FRAME ) || ( kiss_type == KISS_DATA_FRAME_ACK ) )
|
2012-08-02 16:54:43 +00:00
|
|
|
{
|
2013-02-19 23:17:07 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining( tvb, offset );
|
2012-08-02 16:54:43 +00:00
|
|
|
call_dissector( ax25_handle, next_tvb, pinfo, parent_tree );
|
|
|
|
}
|
2015-11-10 04:01:28 +00:00
|
|
|
|
|
|
|
return tvb_captured_length(tvb);
|
2012-08-02 06:45:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_ax25_kiss(void)
|
|
|
|
{
|
2015-04-27 15:08:09 +00:00
|
|
|
module_t *ax25_kiss_module;
|
|
|
|
|
2012-08-02 06:45:51 +00:00
|
|
|
/* Setup list of header fields */
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_ax25_kiss_cmd,
|
|
|
|
{ "Cmd", "ax25_kiss.cmd",
|
2012-08-03 02:19:18 +00:00
|
|
|
FT_UINT8, BASE_DEC, VALS(kiss_frame_types), KISS_CMD_MASK,
|
2012-08-02 14:10:43 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 06:45:51 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_kiss_port,
|
|
|
|
{ "Port", "ax25_kiss.port",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, KISS_PORT_MASK,
|
2012-08-02 14:10:43 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 06:45:51 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_kiss_txdelay,
|
|
|
|
{ "Tx delay", "ax25_kiss.txdelay",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
2012-08-02 14:10:43 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 06:45:51 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_kiss_persistence,
|
|
|
|
{ "Persistence", "ax25_kiss.persistence",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
2012-08-02 14:10:43 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 06:45:51 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_kiss_slottime,
|
|
|
|
{ "Slot time", "ax25_kiss.slottime",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
2012-08-02 14:10:43 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 06:45:51 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_kiss_txtail,
|
|
|
|
{ "Tx tail", "ax25_kiss.txtail",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
2012-08-02 14:10:43 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 06:45:51 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_kiss_fullduplex,
|
|
|
|
{ "Full duplex", "ax25_kiss.fullduplex",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
2012-08-02 14:10:43 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 06:45:51 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax25_kiss_sethardware,
|
|
|
|
{ "Set hardware", "ax25_kiss.sethardware",
|
2015-04-27 15:08:09 +00:00
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_ax25_kiss_data_ack,
|
|
|
|
{ "Data ack", "ax25_kiss.data_ack",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_ax25_kiss_cksum,
|
|
|
|
{ "Checksum", "ax25_kiss.cksum",
|
|
|
|
FT_UINT16, BASE_HEX, NULL, 0x0,
|
2012-08-02 14:10:43 +00:00
|
|
|
NULL, HFILL }
|
2012-08-02 06:45:51 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_ax25_kiss,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Register the protocol name and description */
|
|
|
|
proto_ax25_kiss = proto_register_protocol( "AX.25 KISS", "AX.25 KISS", "ax25_kiss" );
|
|
|
|
|
|
|
|
/* Register the dissector */
|
2015-12-09 04:04:01 +00:00
|
|
|
kiss_handle = register_dissector( "ax25_kiss", dissect_ax25_kiss, proto_ax25_kiss );
|
2012-08-02 06:45:51 +00:00
|
|
|
|
|
|
|
/* Required function calls to register the header fields and subtrees used */
|
|
|
|
proto_register_field_array( proto_ax25_kiss, hf, array_length( hf ) );
|
|
|
|
proto_register_subtree_array( ett, array_length( ett ) );
|
2015-04-27 15:08:09 +00:00
|
|
|
|
|
|
|
/* Register preferences module */
|
|
|
|
ax25_kiss_module = prefs_register_protocol( proto_ax25_kiss, NULL);
|
|
|
|
|
|
|
|
prefs_register_bool_preference(ax25_kiss_module, "showcksum",
|
|
|
|
"Set checksum mode",
|
|
|
|
"Enable checksum calculation.",
|
|
|
|
&gPREF_CKSUM_MODE );
|
|
|
|
|
2012-08-02 06:45:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_ax25_kiss(void)
|
|
|
|
{
|
2012-10-22 20:46:47 +00:00
|
|
|
dissector_add_uint( "wtap_encap", WTAP_ENCAP_AX25_KISS, kiss_handle );
|
2015-12-13 21:54:16 +00:00
|
|
|
register_capture_dissector("wtap_encap", WTAP_ENCAP_AX25_KISS, capture_ax25_kiss, proto_ax25_kiss);
|
2012-08-02 06:45:51 +00:00
|
|
|
|
2012-10-22 20:46:47 +00:00
|
|
|
/* only currently implemented for AX.25 */
|
2016-03-16 13:02:52 +00:00
|
|
|
ax25_handle = find_dissector_add_dependency( "ax25", proto_ax25_kiss );
|
2012-08-02 06:45:51 +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:
|
|
|
|
*/
|