#include <string.h> and/or #include <stdio.h> not needed.
[obnox/wireshark/wip.git] / epan / dissectors / 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  * $Id$
10  *
11  * Wireshark - Network traffic analyzer
12  * By Gerald Combs <gerald@wireshark.org>
13  * Copyright 1998 Gerald Combs
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software
27  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28  */
29
30 /* Offsets of fields within the DLR Common Frame Header */
31 #define DLR_CFH_SUB_TYPE       0
32 #define DLR_CFH_PROTO_VERSION  1
33
34 /* Offsets (from beginning of the packet) of fields within the DLR Message
35  * Payload Fields
36  */
37 #define DLR_MPF_FRAME_TYPE       2
38 #define DLR_MPF_SOURCE_PORT      3
39 #define DLR_MPF_SOURCE_IP        4
40 #define DLR_MPF_SEQUENCE_ID      8
41
42 /* Offset for Beacon frames */
43 #define DLR_BE_RING_STATE              12
44 #define DLR_BE_SUPERVISOR_PRECEDENCE   13
45 #define DLR_BE_BEACON_INTERVAL         14
46 #define DLR_BE_BEACON_TIMEOUT          18
47 #define DLR_BE_RESERVED                22
48
49 /* Offset for Neighbor_Check_Request frames */
50 #define DLR_NREQ_RESERVED     12
51
52 /* Offset for Neighbor_Check_Response frames */
53 #define DLR_NRES_SOURCE_PORT  12
54 #define DLR_NRES_RESERVED     13
55
56 /* Offset for Link_Status/Neighbor_Status frames */
57 #define DLR_LNS_SOURCE_PORT   12
58 #define DLR_LNS_RESERVED      13
59
60 /* Offset for Locate_Fault frames */
61 #define DLR_LF_RESERVED     12
62
63 /* Offset for Announce frames */
64 #define DLR_AN_RING_STATE   12
65 #define DLR_AN_RESERVED     13
66
67 /* Offset for Sign_On frames */
68 #define DLR_SO_NUM_NODES    12
69 #define DLR_SO_NODE_1_MAC   14
70
71 /* DLR commmands */
72 #define DLR_FT_BEACON            1
73 #define DLR_FT_NEIGHBOR_REQ      2
74 #define DLR_FT_NEIGHBOR_RES      3
75 #define DLR_FT_LINK_STAT         4
76 #define DLR_FT_LOCATE_FLT        5
77 #define DLR_FT_ANNOUNCE          6
78 #define DLR_FT_SIGN_ON           7
79
80
81 typedef struct {
82    guint32 req_num, rep_num;
83    nstime_t req_time;
84    void *cip_info;
85 } enip_request_info_t;
86
87 void enip_open_cip_connection( packet_info *pinfo,
88                                guint16 ConnSerialNumber, guint16 VendorID, guint32 DeviceSerialNumber,
89                                guint32 O2TConnID, guint32 T2OConnID );
90 void enip_close_cip_connection( packet_info *pinfo,
91                                 guint16 ConnSerialNumber, guint16 VendorID, guint32 DeviceSerialNumber );