Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
packet-enip.h
1/* packet-enip.h
2 * Routines for EtherNet/IP (Industrial Protocol) dissection
3 * EtherNet/IP Home: www.odva.org
4 *
5 * Conversation data support for CIP
6 * Jan Bartels, Siempelkamp Maschinen- und Anlagenbau GmbH & Co. KG
7 * Copyright 2007
8 *
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <[email protected]>
11 * Copyright 1998 Gerald Combs
12 *
13 * SPDX-License-Identifier: GPL-2.0-or-later
14 */
15
16#ifndef PACKET_ENIP_H
17#define PACKET_ENIP_H
18
19#include "packet-cip.h" // For structs used in this file.
20
21/* Offsets of fields within the DLR Common Frame Header */
22#define DLR_CFH_SUB_TYPE 0
23#define DLR_CFH_PROTO_VERSION 1
24
25/* Offsets (from beginning of the packet) of fields within the DLR Message
26 * Payload Fields
27 */
28#define DLR_MPF_FRAME_TYPE 2
29#define DLR_MPF_SOURCE_PORT 3
30#define DLR_MPF_SOURCE_IP 4
31#define DLR_MPF_SEQUENCE_ID 8
32
33/* Offset for Beacon frames */
34#define DLR_BE_RING_STATE 12
35#define DLR_BE_SUPERVISOR_PRECEDENCE 13
36#define DLR_BE_BEACON_INTERVAL 14
37#define DLR_BE_BEACON_TIMEOUT 18
38#define DLR_BE_RESERVED 22
39
40/* Offset for Neighbor_Check_Request frames */
41#define DLR_NREQ_RESERVED 12
42
43/* Offset for Neighbor_Check_Response frames */
44#define DLR_NRES_SOURCE_PORT 12
45#define DLR_NRES_RESERVED 13
46
47/* Offset for Link_Status/Neighbor_Status frames */
48#define DLR_LNS_SOURCE_PORT 12
49#define DLR_LNS_RESERVED 13
50
51/* Offset for Locate_Fault frames */
52#define DLR_LF_RESERVED 12
53
54/* Offset for Announce frames */
55#define DLR_AN_RING_STATE 12
56#define DLR_AN_RESERVED 13
57
58/* Offset for Sign_On frames */
59#define DLR_SO_NUM_NODES 12
60#define DLR_SO_NODE_1_MAC 14
61
62/* Offset for Advertise frames */
63#define DLR_ADV_GATEWAY_STATE 12
64#define DLR_ADV_GATEWAY_PRECEDENCE 13
65#define DLR_ADV_ADVERTISE_INTERVAL 14
66#define DLR_ADV_ADVERTISE_TIMEOUT 18
67#define DLR_ADV_LEARNING_UPDATE_ENABLE 22
68#define DLR_ADV_RESERVED 23
69
70/* Offset for Advertise frames */
71#define DLR_FLUSH_LEARNING_UPDATE_ENABLE 12
72#define DLR_FLUSH_RESERVED 13
73
74/* Offset for Advertise frames */
75#define DLR_LEARN_RESERVED 12
76
77/* DLR commands */
78#define DLR_FT_BEACON 1
79#define DLR_FT_NEIGHBOR_REQ 2
80#define DLR_FT_NEIGHBOR_RES 3
81#define DLR_FT_LINK_STAT 4
82#define DLR_FT_LOCATE_FLT 5
83#define DLR_FT_ANNOUNCE 6
84#define DLR_FT_SIGN_ON 7
85#define DLR_FT_ADVERTISE 8
86#define DLR_FT_FLUSH_TABLES 9
87#define DLR_FT_LEARNING_UPDATE 10
88
89
90typedef struct {
91 uint32_t req_num, rep_num;
92 nstime_t req_time;
93 cip_req_info_t* cip_info;
95
96// This represents the data direction for connected data.
97enum enip_connid_type {ECIDT_UNKNOWN, ECIDT_O2T, ECIDT_T2O};
98
99typedef struct cip_io_data_input {
100 cip_conn_info_t* conn_info;
101 enum enip_connid_type connid_type;
103
104/* proto_data types */
105#define ENIP_REQUEST_INFO 0
106#define ENIP_CONNECTION_INFO 1
107
108void display_fwd_open_connection_path(cip_conn_info_t* conn_info, proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo);
109void enip_close_cip_connection(packet_info *pinfo, const cip_connection_triad_t* triad);
110void enip_mark_connection_triad(packet_info *pinfo, const cip_connection_triad_t* triad);
111
112cip_service_info_t* cip_get_service_enip(uint32_t class_id, uint8_t service_id);
113
114extern int dissect_ingress_tcp_udp_ports_supported(packet_info *pinfo, proto_tree *tree, proto_item *item,
115 tvbuff_t *tvb, int offset, int total_len);
116extern int dissect_ingress_egress_rules(packet_info *pinfo, proto_tree *tree, proto_item *item,
117 tvbuff_t *tvb, int offset, int total_len);
118extern int dissect_ingress_egress_set_rules(packet_info *pinfo, proto_tree *tree, proto_item *item,
119 tvbuff_t *tvb, int offset, bool request);
120extern int dissect_lldp_cip_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
121extern const value_string lldp_cip_subtypes[];
122
123extern const attribute_info_t enip_attribute_vals[118];
124
125#endif /* PACKET_ENIP_H */
Definition packet_info.h:43
Definition proto.h:901
Definition value_string.h:25
Definition packet-cip.h:472
Definition packet-cip.h:547
Definition packet-cip.h:520
Definition packet-enip.h:99
Definition packet-cip.h:577
Definition packet-cip.h:487
Definition packet-enip.h:90
Definition nstime.h:26
Definition tvbuff-int.h:35