diff options
Diffstat (limited to 'epan/dissectors/packet-caneth.c')
-rw-r--r-- | epan/dissectors/packet-caneth.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/epan/dissectors/packet-caneth.c b/epan/dissectors/packet-caneth.c index e9b320a081..5c6b7ea42a 100644 --- a/epan/dissectors/packet-caneth.c +++ b/epan/dissectors/packet-caneth.c @@ -19,8 +19,8 @@ #include <config.h> #include <epan/packet.h> -#include <epan/dissectors/packet-udp.h> -#include <epan/dissectors/packet-socketcan.h> +#include "packet-udp.h" +#include "packet-socketcan.h" #define CAN_FRAME_LEN 15 @@ -35,26 +35,28 @@ static const gchar magic[] = "ISO11898"; void proto_reg_handoff_caneth(void); void proto_register_caneth(void); -static int proto_caneth = -1; -static int hf_caneth_magic = -1; -static int hf_caneth_version = -1; -static int hf_caneth_frames = -1; -static int hf_caneth_options = -1; +static dissector_handle_t caneth_handle; -static int hf_caneth_can_ident_ext = -1; -static int hf_caneth_can_ident_std = -1; -static int hf_caneth_can_extflag = -1; -static int hf_caneth_can_rtrflag = -1; -static int hf_caneth_can_len = -1; -static int hf_caneth_can_padding = -1; +static int proto_caneth; +static int hf_caneth_magic; +static int hf_caneth_version; +static int hf_caneth_frames; +static int hf_caneth_options; + +static int hf_caneth_can_ident_ext; +static int hf_caneth_can_ident_std; +static int hf_caneth_can_extflag; +static int hf_caneth_can_rtrflag; +static int hf_caneth_can_len; +static int hf_caneth_can_padding; #define CANETH_UDP_PORT 11898 -static gint ett_caneth = -1; -static gint ett_caneth_frames = -1; -static gint ett_caneth_can = -1; +static gint ett_caneth; +static gint ett_caneth_frames; +static gint ett_caneth_can; -static int proto_can = -1; // use CAN protocol for consistent filtering +static int proto_can; // use CAN protocol for consistent filtering /* A sample #define of the minimum length (in bytes) of the protocol data. * If data is received with fewer than this many bytes it is rejected by @@ -150,7 +152,7 @@ dissect_caneth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) ti = proto_tree_add_item(tree, proto_caneth, tvb, 0, -1, ENC_NA); caneth_tree = proto_item_add_subtree(ti, ett_caneth); - proto_tree_add_item(caneth_tree, hf_caneth_magic, tvb, 0, 8, ENC_ASCII|ENC_NA); + proto_tree_add_item(caneth_tree, hf_caneth_magic, tvb, 0, 8, ENC_ASCII); proto_tree_add_item(caneth_tree, hf_caneth_version, tvb, 8, 1, ENC_NA); proto_tree_add_item_ret_uint(caneth_tree, hf_caneth_frames, tvb, 9, 1, ENC_NA, &frame_count); @@ -183,7 +185,7 @@ proto_register_caneth(void) &hf_caneth_magic, { "Magic", "caneth.magic", - FT_STRING, STR_ASCII, + FT_STRING, BASE_NONE, NULL, 0x0, "The magic identifier used to denote the start of a CAN-ETH packet", HFILL } @@ -281,12 +283,13 @@ proto_register_caneth(void) proto_register_field_array(proto_caneth, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + caneth_handle = register_dissector("caneth", dissect_caneth, proto_caneth); } void proto_reg_handoff_caneth(void) { - dissector_handle_t caneth_handle = create_dissector_handle(dissect_caneth, proto_caneth); dissector_add_uint_with_preference("udp.port", CANETH_UDP_PORT, caneth_handle); heur_dissector_add("udp", dissect_caneth_heur_udp, "CAN-ETH over UDP", "caneth_udp", proto_caneth, HEURISTIC_ENABLE); |