2009-06-26 02:38:23 +00:00
|
|
|
/* packet-enip.h
|
|
|
|
* Routines for EtherNet/IP (Industrial Protocol) dissection
|
|
|
|
* EtherNet/IP Home: www.odva.org
|
|
|
|
*
|
|
|
|
* Conversation data support for CIP
|
|
|
|
* Jan Bartels, Siempelkamp Maschinen- und Anlagenbau GmbH & Co. KG
|
|
|
|
* Copyright 2007
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-12 11:23:27 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2009-06-26 02:38:23 +00:00
|
|
|
*/
|
|
|
|
|
2012-06-02 12:57:26 +00:00
|
|
|
#ifndef PACKET_ENIP_H
|
|
|
|
#define PACKET_ENIP_H
|
|
|
|
|
2009-07-09 20:44:28 +00:00
|
|
|
/* Offsets of fields within the DLR Common Frame Header */
|
|
|
|
#define DLR_CFH_SUB_TYPE 0
|
|
|
|
#define DLR_CFH_PROTO_VERSION 1
|
|
|
|
|
|
|
|
/* Offsets (from beginning of the packet) of fields within the DLR Message
|
|
|
|
* Payload Fields
|
|
|
|
*/
|
|
|
|
#define DLR_MPF_FRAME_TYPE 2
|
|
|
|
#define DLR_MPF_SOURCE_PORT 3
|
|
|
|
#define DLR_MPF_SOURCE_IP 4
|
|
|
|
#define DLR_MPF_SEQUENCE_ID 8
|
|
|
|
|
|
|
|
/* Offset for Beacon frames */
|
|
|
|
#define DLR_BE_RING_STATE 12
|
|
|
|
#define DLR_BE_SUPERVISOR_PRECEDENCE 13
|
|
|
|
#define DLR_BE_BEACON_INTERVAL 14
|
|
|
|
#define DLR_BE_BEACON_TIMEOUT 18
|
|
|
|
#define DLR_BE_RESERVED 22
|
|
|
|
|
|
|
|
/* Offset for Neighbor_Check_Request frames */
|
|
|
|
#define DLR_NREQ_RESERVED 12
|
|
|
|
|
|
|
|
/* Offset for Neighbor_Check_Response frames */
|
|
|
|
#define DLR_NRES_SOURCE_PORT 12
|
|
|
|
#define DLR_NRES_RESERVED 13
|
|
|
|
|
|
|
|
/* Offset for Link_Status/Neighbor_Status frames */
|
|
|
|
#define DLR_LNS_SOURCE_PORT 12
|
|
|
|
#define DLR_LNS_RESERVED 13
|
|
|
|
|
|
|
|
/* Offset for Locate_Fault frames */
|
|
|
|
#define DLR_LF_RESERVED 12
|
|
|
|
|
|
|
|
/* Offset for Announce frames */
|
|
|
|
#define DLR_AN_RING_STATE 12
|
|
|
|
#define DLR_AN_RESERVED 13
|
|
|
|
|
|
|
|
/* Offset for Sign_On frames */
|
|
|
|
#define DLR_SO_NUM_NODES 12
|
|
|
|
#define DLR_SO_NODE_1_MAC 14
|
|
|
|
|
2013-04-04 14:34:26 +00:00
|
|
|
/* Offset for Advertise frames */
|
|
|
|
#define DLR_ADV_GATEWAY_STATE 12
|
|
|
|
#define DLR_ADV_GATEWAY_PRECEDENCE 13
|
|
|
|
#define DLR_ADV_ADVERTISE_INTERVAL 14
|
|
|
|
#define DLR_ADV_ADVERTISE_TIMEOUT 18
|
2013-10-13 19:56:52 +00:00
|
|
|
#define DLR_ADV_LEARNING_UPDATE_ENABLE 22
|
2013-04-04 14:34:26 +00:00
|
|
|
#define DLR_ADV_RESERVED 23
|
|
|
|
|
|
|
|
/* Offset for Advertise frames */
|
|
|
|
#define DLR_FLUSH_LEARNING_UPDATE_ENABLE 12
|
|
|
|
#define DLR_FLUSH_RESERVED 13
|
|
|
|
|
|
|
|
/* Offset for Advertise frames */
|
|
|
|
#define DLR_LEARN_RESERVED 12
|
|
|
|
|
2015-11-30 18:10:19 +00:00
|
|
|
/* DLR commands */
|
2009-07-09 20:44:28 +00:00
|
|
|
#define DLR_FT_BEACON 1
|
|
|
|
#define DLR_FT_NEIGHBOR_REQ 2
|
|
|
|
#define DLR_FT_NEIGHBOR_RES 3
|
|
|
|
#define DLR_FT_LINK_STAT 4
|
|
|
|
#define DLR_FT_LOCATE_FLT 5
|
|
|
|
#define DLR_FT_ANNOUNCE 6
|
|
|
|
#define DLR_FT_SIGN_ON 7
|
2013-04-04 14:34:26 +00:00
|
|
|
#define DLR_FT_ADVERTISE 8
|
|
|
|
#define DLR_FT_FLUSH_TABLES 9
|
|
|
|
#define DLR_FT_LEARNING_UPDATE 10
|
2009-07-09 20:44:28 +00:00
|
|
|
|
|
|
|
|
2009-06-26 02:38:23 +00:00
|
|
|
typedef struct {
|
|
|
|
guint32 req_num, rep_num;
|
|
|
|
nstime_t req_time;
|
2011-12-01 06:05:39 +00:00
|
|
|
cip_req_info_t* cip_info;
|
2009-06-26 02:38:23 +00:00
|
|
|
} enip_request_info_t;
|
|
|
|
|
2017-03-13 19:20:49 +00:00
|
|
|
typedef struct enip_conn_val {
|
|
|
|
guint32 O2TConnID;
|
|
|
|
guint32 T2OConnID;
|
2018-12-09 17:52:00 +00:00
|
|
|
cip_connection_triad_t triad;
|
2017-03-13 19:20:49 +00:00
|
|
|
guint8 TransportClass_trigger;
|
|
|
|
guint32 open_frame;
|
|
|
|
guint32 open_reply_frame;
|
|
|
|
guint32 close_frame;
|
|
|
|
guint32 connid;
|
|
|
|
cip_safety_epath_info_t safety;
|
|
|
|
guint32 ClassID;
|
2018-02-02 16:47:44 +00:00
|
|
|
guint32 ConnPoint;
|
2018-11-27 20:23:41 +00:00
|
|
|
|
|
|
|
guint32 FwdOpenPathLenBytes;
|
|
|
|
void *pFwdOpenPathData;
|
|
|
|
guint32 O2Tapi;
|
|
|
|
guint32 T2Oapi;
|
2017-03-13 19:20:49 +00:00
|
|
|
} enip_conn_val_t;
|
|
|
|
|
2012-02-27 09:30:26 +00:00
|
|
|
enum enip_connid_type {ECIDT_UNKNOWN, ECIDT_O2T, ECIDT_T2O};
|
|
|
|
|
2018-06-15 14:45:01 +00:00
|
|
|
typedef struct cip_io_data_input {
|
|
|
|
enip_conn_val_t* conn_info;
|
|
|
|
enum enip_connid_type connid_type;
|
|
|
|
} cip_io_data_input;
|
|
|
|
|
2014-05-27 02:58:48 +00:00
|
|
|
/* proto_data types */
|
|
|
|
#define ENIP_REQUEST_INFO 0
|
|
|
|
#define ENIP_CONNECTION_INFO 1
|
|
|
|
|
2018-05-31 11:24:26 +00:00
|
|
|
void enip_close_cip_connection(packet_info *pinfo, const cip_connection_triad_t* triad);
|
|
|
|
void enip_mark_connection_triad(packet_info *pinfo, const cip_connection_triad_t* triad);
|
2011-10-26 04:55:21 +00:00
|
|
|
|
2016-01-28 21:34:14 +00:00
|
|
|
extern attribute_info_t enip_attribute_vals[99];
|
2012-06-02 12:57:26 +00:00
|
|
|
|
|
|
|
#endif /* PACKET_ENIP_H */
|