Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
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 /* Offsets of fields within the DLR Common Frame Header */
20 #define DLR_CFH_SUB_TYPE 0
21 #define DLR_CFH_PROTO_VERSION 1
22 
23 /* Offsets (from beginning of the packet) of fields within the DLR Message
24  * Payload Fields
25  */
26 #define DLR_MPF_FRAME_TYPE 2
27 #define DLR_MPF_SOURCE_PORT 3
28 #define DLR_MPF_SOURCE_IP 4
29 #define DLR_MPF_SEQUENCE_ID 8
30 
31 /* Offset for Beacon frames */
32 #define DLR_BE_RING_STATE 12
33 #define DLR_BE_SUPERVISOR_PRECEDENCE 13
34 #define DLR_BE_BEACON_INTERVAL 14
35 #define DLR_BE_BEACON_TIMEOUT 18
36 #define DLR_BE_RESERVED 22
37 
38 /* Offset for Neighbor_Check_Request frames */
39 #define DLR_NREQ_RESERVED 12
40 
41 /* Offset for Neighbor_Check_Response frames */
42 #define DLR_NRES_SOURCE_PORT 12
43 #define DLR_NRES_RESERVED 13
44 
45 /* Offset for Link_Status/Neighbor_Status frames */
46 #define DLR_LNS_SOURCE_PORT 12
47 #define DLR_LNS_RESERVED 13
48 
49 /* Offset for Locate_Fault frames */
50 #define DLR_LF_RESERVED 12
51 
52 /* Offset for Announce frames */
53 #define DLR_AN_RING_STATE 12
54 #define DLR_AN_RESERVED 13
55 
56 /* Offset for Sign_On frames */
57 #define DLR_SO_NUM_NODES 12
58 #define DLR_SO_NODE_1_MAC 14
59 
60 /* Offset for Advertise frames */
61 #define DLR_ADV_GATEWAY_STATE 12
62 #define DLR_ADV_GATEWAY_PRECEDENCE 13
63 #define DLR_ADV_ADVERTISE_INTERVAL 14
64 #define DLR_ADV_ADVERTISE_TIMEOUT 18
65 #define DLR_ADV_LEARNING_UPDATE_ENABLE 22
66 #define DLR_ADV_RESERVED 23
67 
68 /* Offset for Advertise frames */
69 #define DLR_FLUSH_LEARNING_UPDATE_ENABLE 12
70 #define DLR_FLUSH_RESERVED 13
71 
72 /* Offset for Advertise frames */
73 #define DLR_LEARN_RESERVED 12
74 
75 /* DLR commands */
76 #define DLR_FT_BEACON 1
77 #define DLR_FT_NEIGHBOR_REQ 2
78 #define DLR_FT_NEIGHBOR_RES 3
79 #define DLR_FT_LINK_STAT 4
80 #define DLR_FT_LOCATE_FLT 5
81 #define DLR_FT_ANNOUNCE 6
82 #define DLR_FT_SIGN_ON 7
83 #define DLR_FT_ADVERTISE 8
84 #define DLR_FT_FLUSH_TABLES 9
85 #define DLR_FT_LEARNING_UPDATE 10
86 
87 
88 typedef struct {
89  guint32 req_num, rep_num;
90  nstime_t req_time;
91  cip_req_info_t* cip_info;
93 
94 typedef struct enip_conn_val {
95  guint16 ConnSerialNumber;
96  guint16 VendorID;
97  guint32 DeviceSerialNumber;
98  guint32 O2TConnID;
99  guint32 T2OConnID;
100  guint8 TransportClass_trigger;
101  guint32 open_frame;
102  guint32 open_reply_frame;
103  guint32 close_frame;
104  guint32 connid;
106  gboolean motion;
107  guint32 ClassID;
108  guint32 ConnPoint;
110 
111 enum enip_connid_type {ECIDT_UNKNOWN, ECIDT_O2T, ECIDT_T2O};
112 
113 /* proto_data types */
114 #define ENIP_REQUEST_INFO 0
115 #define ENIP_CONNECTION_INFO 1
116 
117 void enip_close_cip_connection( packet_info *pinfo, guint16 ConnSerialNumber, guint16 VendorID, guint32 DeviceSerialNumber );
118 void enip_mark_connection_triad( packet_info *pinfo, guint16 ConnSerialNumber, guint16 VendorID, guint32 DeviceSerialNumber );
119 
120 extern attribute_info_t enip_attribute_vals[99];
121 
122 #endif /* PACKET_ENIP_H */
Definition: packet-cip.h:464
Definition: packet_info.h:44
Definition: packet-cip.h:444
Definition: nstime.h:27
Definition: packet-enip.h:94
Definition: packet-enip.h:88
Definition: packet-cip.h:488