summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ax25.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-ax25.c')
-rw-r--r--epan/dissectors/packet-ax25.c81
1 files changed, 41 insertions, 40 deletions
diff --git a/epan/dissectors/packet-ax25.c b/epan/dissectors/packet-ax25.c
index d700ade6..60c393c6 100644
--- a/epan/dissectors/packet-ax25.c
+++ b/epan/dissectors/packet-ax25.c
@@ -38,6 +38,7 @@
#include <epan/xdlc.h>
#include <epan/ax25_pids.h>
#include <epan/ipproto.h>
+#include <epan/tfs.h>
#define STRLEN 80
@@ -53,27 +54,27 @@ static dissector_table_t ax25_dissector_table;
static capture_dissector_handle_t ax25_cap_handle;
/* 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 proto_ax25;
+static int hf_ax25_dst;
+static int hf_ax25_src;
+static int hf_ax25_via[ AX25_MAX_DIGIS ];
-static int hf_ax25_ctl = -1;
+static int hf_ax25_ctl;
-static int hf_ax25_n_r = -1;
-static int hf_ax25_n_s = -1;
+static int hf_ax25_n_r;
+static int hf_ax25_n_s;
-static int hf_ax25_p = -1;
-static int hf_ax25_f = -1;
+static int hf_ax25_p;
+static int hf_ax25_f;
-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_ftype_s;
+static int hf_ax25_ftype_i;
+static int hf_ax25_ftype_su;
-static int hf_ax25_u_cmd = -1;
-static int hf_ax25_u_resp = -1;
+static int hf_ax25_u_cmd;
+static int hf_ax25_u_resp;
-static int hf_ax25_pid = -1;
+static int hf_ax25_pid;
static const xdlc_cf_items ax25_cf_items = {
&hf_ax25_n_r,
@@ -105,8 +106,8 @@ static const value_string pid_vals[] = {
{ 0, NULL }
};
-static gint ett_ax25 = -1;
-static gint ett_ax25_ctl = -1;
+static int ett_ax25;
+static int ett_ax25_ctl;
static dissector_handle_t ax25_handle;
@@ -121,10 +122,10 @@ dissect_ax25( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
/* char v2cmdresp; */
const char *ax25_version;
int is_response;
- guint8 control;
- guint8 pid = AX25_P_NO_L3;
- guint8 src_ssid;
- guint8 dst_ssid;
+ uint8_t control;
+ uint8_t pid = AX25_P_NO_L3;
+ uint8_t src_ssid;
+ uint8_t dst_ssid;
tvbuff_t *next_tvb = NULL;
@@ -143,7 +144,7 @@ dissect_ax25( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
proto_tree_add_item( ax25_tree, hf_ax25_dst, tvb, offset, AX25_ADDR_LEN, ENC_NA);
set_address_tvb(&pinfo->dl_dst, AT_AX25, AX25_ADDR_LEN, tvb, offset);
copy_address_shallow(&pinfo->dst, &pinfo->dl_dst);
- dst_ssid = tvb_get_guint8(tvb, offset+6);
+ dst_ssid = tvb_get_uint8(tvb, offset+6);
/* step over dst addr point at src addr */
offset += AX25_ADDR_LEN;
@@ -151,7 +152,7 @@ dissect_ax25( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
proto_tree_add_item( ax25_tree, hf_ax25_src, tvb, offset, AX25_ADDR_LEN, ENC_NA);
set_address_tvb(&pinfo->dl_src, AT_AX25, AX25_ADDR_LEN, tvb, offset);
copy_address_shallow(&pinfo->src, &pinfo->dl_src);
- src_ssid = tvb_get_guint8(tvb, offset+6);
+ src_ssid = tvb_get_uint8(tvb, offset+6);
/* step over src addr point at either 1st via addr or control byte */
offset += AX25_ADDR_LEN;
@@ -167,24 +168,24 @@ dissect_ax25( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
case 1 : /* V2.0 Response */
ax25_version = "V2.0+";
/* v2cmdresp = 'R'; */
- is_response = TRUE;
+ is_response = true;
break;
case 2 : /* V2.0 Command */
ax25_version = "V2.0+";
/* v2cmdresp = 'C'; */
- is_response = FALSE;
+ is_response = false;
break;
default :
ax25_version = "V?.?";
/* v2cmdresp = '?'; */
- is_response = FALSE;
+ is_response = false;
break;
}
proto_item_append_text( ti, ", Ver: %s", ax25_version );
/* handle the vias, if any */
via_index = 0;
- while ( ( tvb_get_guint8( tvb, offset - 1 ) & 0x01 ) == 0 )
+ while ( ( tvb_get_uint8( tvb, offset - 1 ) & 0x01 ) == 0 )
{
if ( via_index < AX25_MAX_DIGIS )
{
@@ -195,7 +196,7 @@ dissect_ax25( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
offset += AX25_ADDR_LEN;
}
- /* XXX - next-to-last argument should be TRUE if modulo 128 operation */
+ /* XXX - next-to-last argument should be true if modulo 128 operation */
control = dissect_xdlc_control( tvb,
offset,
pinfo,
@@ -207,15 +208,15 @@ dissect_ax25( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
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 */
+ 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 ) )
{
- pid = tvb_get_guint8( tvb, offset );
+ pid = tvb_get_uint8( 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 );
@@ -238,15 +239,15 @@ dissect_ax25( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
return tvb_captured_length(tvb);
}
-static gboolean
-capture_ax25( const guchar *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header)
+static bool
+capture_ax25( const unsigned char *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header)
{
- guint8 control;
- guint8 pid;
+ uint8_t control;
+ uint8_t pid;
int l_offset;
if ( ! BYTES_ARE_IN_FRAME( offset, len, AX25_HEADER_SIZE ) )
- return FALSE;
+ return false;
l_offset = offset;
l_offset += AX25_ADDR_LEN; /* step over dst addr point at src addr */
@@ -265,7 +266,7 @@ capture_ax25( const guchar *pd, int offset, int len, capture_packet_info_t *cpin
l_offset += 1; /* step over the pid and point to the first byte of the payload */
return try_capture_dissector("ax25.pid", pid & 0x0ff, pd, l_offset, len, cpinfo, pseudo_header);
}
- return FALSE;
+ return false;
}
void
@@ -381,7 +382,7 @@ proto_register_ax25(void)
};
/* Setup protocol subtree array */
- static gint *ett[] = {
+ static int *ett[] = {
&ett_ax25,
&ett_ax25_ctl,
};