Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-enip.h
blobf6fb8012d1083e3041da4fbe12463efdc49246dc
1 /* packet-enip.h
2 * Routines for EtherNet/IP (Industrial Protocol) dissection
3 * EtherNet/IP Home: www.odva.org
5 * Conversation data support for CIP
6 * Jan Bartels, Siempelkamp Maschinen- und Anlagenbau GmbH & Co. KG
7 * Copyright 2007
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1998 Gerald Combs
13 * SPDX-License-Identifier: GPL-2.0-or-later
16 #ifndef PACKET_ENIP_H
17 #define PACKET_ENIP_H
19 #include "packet-cip.h" // For structs used in this file.
21 /* Offsets of fields within the DLR Common Frame Header */
22 #define DLR_CFH_SUB_TYPE 0
23 #define DLR_CFH_PROTO_VERSION 1
25 /* Offsets (from beginning of the packet) of fields within the DLR Message
26 * Payload Fields
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
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
40 /* Offset for Neighbor_Check_Request frames */
41 #define DLR_NREQ_RESERVED 12
43 /* Offset for Neighbor_Check_Response frames */
44 #define DLR_NRES_SOURCE_PORT 12
45 #define DLR_NRES_RESERVED 13
47 /* Offset for Link_Status/Neighbor_Status frames */
48 #define DLR_LNS_SOURCE_PORT 12
49 #define DLR_LNS_RESERVED 13
51 /* Offset for Locate_Fault frames */
52 #define DLR_LF_RESERVED 12
54 /* Offset for Announce frames */
55 #define DLR_AN_RING_STATE 12
56 #define DLR_AN_RESERVED 13
58 /* Offset for Sign_On frames */
59 #define DLR_SO_NUM_NODES 12
60 #define DLR_SO_NODE_1_MAC 14
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
70 /* Offset for Advertise frames */
71 #define DLR_FLUSH_LEARNING_UPDATE_ENABLE 12
72 #define DLR_FLUSH_RESERVED 13
74 /* Offset for Advertise frames */
75 #define DLR_LEARN_RESERVED 12
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
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;
96 // This represents the data direction for connected data.
97 enum enip_connid_type {ECIDT_UNKNOWN, ECIDT_O2T, ECIDT_T2O};
99 typedef struct cip_io_data_input {
100 cip_conn_info_t* conn_info;
101 enum enip_connid_type connid_type;
102 } cip_io_data_input;
104 /* proto_data types */
105 #define ENIP_REQUEST_INFO 0
106 #define ENIP_CONNECTION_INFO 1
108 void display_fwd_open_connection_path(cip_conn_info_t* conn_info, proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo);
109 void enip_close_cip_connection(packet_info *pinfo, const cip_connection_triad_t* triad);
110 void enip_mark_connection_triad(packet_info *pinfo, const cip_connection_triad_t* triad);
112 cip_service_info_t* cip_get_service_enip(uint32_t class_id, uint8_t service_id);
114 extern 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);
116 extern int dissect_ingress_egress_rules(packet_info *pinfo, proto_tree *tree, proto_item *item,
117 tvbuff_t *tvb, int offset, int total_len);
118 extern int dissect_ingress_egress_set_rules(packet_info *pinfo, proto_tree *tree, proto_item *item,
119 tvbuff_t *tvb, int offset, bool request);
120 extern int dissect_lldp_cip_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
121 extern const value_string lldp_cip_subtypes[];
123 extern const attribute_info_t enip_attribute_vals[118];
125 #endif /* PACKET_ENIP_H */