| Wireshark 4.7.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 <gerald@wireshark.org>
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
90 typedef struct {
91 uint32_t req_num, rep_num;
92 nstime_t req_time;
93 cip_req_info_t* cip_info;
94} enip_request_info_t;
95
96// This represents the data direction for connected data.
97 enum enip_connid_type {
98 ECIDT_UNKNOWN = 0,
99 ECIDT_O2T = 1,
100 ECIDT_T2O = 2
101};
102
103 typedef struct cip_io_data_input {
104 cip_conn_info_t* conn_info;
105 enum enip_connid_type connid_type;
106} cip_io_data_input;
107
108// Per packet data for: ENIP_DATA_RATE_INFO
109 struct enip_per_packet_data_t {
110 // Time difference between this message and the previous message in the same connection direction.
111 nstime_t ts_delta;
112};
113/* proto_data types */
114#define ENIP_REQUEST_INFO 0
115#define ENIP_CONNECTION_INFO 1
116#define ENIP_DATA_RATE_INFO 2
117
118 void display_fwd_open_connection_path(cip_conn_info_t* conn_info, proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo);
119 void enip_close_cip_connection(packet_info *pinfo, const cip_connection_triad_t* triad);
120 void enip_mark_connection_triad(packet_info *pinfo, const cip_connection_triad_t* triad);
121
122 cip_service_info_t* cip_get_service_enip(uint32_t class_id, uint8_t service_id);
123
124 extern int dissect_ingress_tcp_udp_ports_supported(packet_info *pinfo, proto_tree *tree, proto_item *item,
125 tvbuff_t *tvb, int offset, int total_len);
126 extern int dissect_ingress_egress_rules(packet_info *pinfo, proto_tree *tree, proto_item *item,
127 tvbuff_t *tvb, int offset, int total_len);
128 extern int dissect_ingress_egress_set_rules(packet_info *pinfo, proto_tree *tree, proto_item *item,
129 tvbuff_t *tvb, int offset, bool request);
130 extern int dissect_cip_mac_address(packet_info* pinfo, proto_tree* tree, proto_item* item,
131 tvbuff_t* tvb, int offset, int total_len);
132 extern int dissect_lldp_cip_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
133 extern const value_string lldp_cip_subtypes[];
134
135 extern const attribute_info_t enip_attribute_vals[164];
136
137#endif /* PACKET_ENIP_H */
_packet_info
Definition packet_info.h:43
_proto_node
Definition proto.h:905
_value_string
Mapping between a 32-bit integer value and its string representation.
Definition value_string.h:33
attribute_info
Definition packet-cip.h:478
cip_conn_info
Definition packet-cip.h:556
cip_connection_triad
Definition packet-cip.h:529
cip_io_data_input
Definition packet-enip.h:103
cip_req_info
Definition packet-cip.h:586
cip_service_info
Definition packet-cip.h:493
enip_per_packet_data_t
Definition packet-enip.h:109
enip_request_info_t
Definition packet-enip.h:90
nstime_t
Definition nstime.h:26
tvbuff
Definition tvbuff-int.h:36