| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
packet-pn.h
1/* packet-pn.h
2 * Common functions for other PROFINET protocols like DCP, MRP, ...
3 *
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1999 Gerald Combs
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10
11/*
12 * Cyclic PNIO RTC1 Data Dissection:
13 *
14 * Added new structures to packet-pn.h to transfer the gained data of
15 * packet-pn-dcp.c and packet-dcerpc-pn-io.c to packet-pn-rtc-one.c for
16 * detailed dissection of cyclic PNIO RTC1 dataframes.
17 *
18 */
19
20#define FRAME_ID_DCP_HELLO 0xfefc
21#define FRAME_ID_DCP_GETORSET 0xfefd
22#define FRAME_ID_DCP_IDENT_REQ 0xfefe
23#define FRAME_ID_DCP_IDENT_RES 0xfeff
24
25
26/* ---- Structures for pnio_rtc1 ---- */
27extern int proto_pn_dcp;
28extern int proto_pn_io_apdu_status;
29extern int proto_pn_io_time_aware_status;
30
31extern bool pnio_ps_selection; /* given by pnio preferences */
32
33/* Structure for general station information */
34 typedef struct tagStationInfo {
35 /* general information */
36 char *typeofstation;
37 char *nameofstation;
38 uint16_t u16Vendor_id;
39 uint16_t u16Device_id;
40 /* frame structure */
41 uint16_t ioDataObjectNr_in;
42 uint16_t ioDataObjectNr_out;
43 uint16_t iocsNr_in;
44 uint16_t iocsNr_out;
45 /* GSDfile station information */
46 bool gsdFound;
47 bool gsdPathLength;
48 char *gsdLocation;
49 /* IOCS object data */
50 wmem_list_t *iocs_data_in;
51 wmem_list_t *iocs_data_out;
52 /* IOData object data */
53 wmem_list_t *ioobject_data_in;
54 wmem_list_t *ioobject_data_out;
55 /* Different ModuleIdentnumber */
56 wmem_list_t *diff_module;
57 /* Flag for the extraction of PNIO Objects without AR */
58 bool filled_with_objects;
59} stationInfo;
60
61 typedef struct tagApduStatusSwitch
62{
63 bool isRedundancyActive;
64 address dl_dst;
65 address dl_src;
66}apduStatusSwitch;
67
68/* Structure for IOCS Frames */
69 typedef struct tagIocsObject {
70 uint16_t slotNr;
71 uint16_t subSlotNr;
72 uint16_t frameOffset;
73} iocsObject;
74
75/* Structure for IO Data Objects */
76 typedef struct tagIoDataObject {
77 uint16_t slotNr;
78 uint16_t subSlotNr;
79 uint32_t api;
80 uint32_t moduleIdentNr;
81 uint32_t subModuleIdentNr;
82 uint16_t frameOffset;
83 uint16_t length;
84 uint16_t amountInGSDML;
85 uint32_t fParameterIndexNr;
86 uint16_t f_par_crc1;
87 uint16_t f_src_adr;
88 uint16_t f_dest_adr;
89 bool f_crc_seed;
90 uint8_t f_crc_len;
91 address srcAddr;
92 address dstAddr;
93 bool profisafeSupported;
94 bool discardIOXS;
95 char *moduleNameStr;
96 tvbuff_t *tvb_slot;
97 tvbuff_t *tvb_subslot;
98 /* Status- or Controlbyte data*/
99 uint8_t last_sb_cb;
100 uint8_t lastToggleBit;
101} ioDataObject;
102
103/* Structure for Modules with different ModuleIdentnumber */
104 typedef struct tagModuleDiffInfo {
105 uint16_t slotNr;
106 uint32_t modulID;
107} moduleDiffInfo;
108
109 typedef struct tagARUUIDFrame {
110 e_guid_t aruuid;
111 uint32_t setupframe;
112 uint32_t releaseframe;
113 uint16_t outputframe;
114 uint16_t inputframe;
115} ARUUIDFrame;
116
117extern wmem_list_t *aruuid_frame_setup_list;
118
119extern void init_pn(int proto);
120extern void init_pn_io_rtc1(int proto);
121extern void init_pn_rsi(int proto);
122extern void pn_rsi_reassemble_init(void);
123
124extern void init_pnio_rtc1_station(stationInfo *station_info);
125
126extern int dissect_pn_uint8(tvbuff_t *tvb, int offset, packet_info *pinfo,
127 proto_tree *tree, int hfindex, uint8_t *pdata);
128
129extern int dissect_pn_uint16_ret_item(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
130 proto_tree *tree, int hfindex, uint16_t *pdata, proto_item ** new_item);
131extern int dissect_pn_uint16(tvbuff_t *tvb, int offset, packet_info *pinfo,
132 proto_tree *tree, int hfindex, uint16_t *pdata);
133
134extern int dissect_pn_int16(tvbuff_t *tvb, int offset, packet_info *pinfo,
135 proto_tree *tree, int hfindex, int16_t *pdata);
136
137extern int dissect_pn_oid(tvbuff_t *tvb, int offset, packet_info *pinfo,
138 proto_tree *tree, int hfindex, uint32_t *pdata);
139
140extern int dissect_pn_mac(tvbuff_t *tvb, int offset, packet_info *pinfo,
141 proto_tree *tree, int hfindex, uint8_t *pdata);
142
143extern int dissect_pn_ipv4(tvbuff_t *tvb, int offset, packet_info *pinfo,
144 proto_tree *tree, int hfindex, uint32_t *pdata);
145
146extern int dissect_pn_uuid(tvbuff_t *tvb, int offset, packet_info *pinfo,
147 proto_tree *tree, int hfindex, e_guid_t *uuid);
148
149extern int dissect_pn_undecoded(tvbuff_t *tvb, int offset, packet_info *pinfo,
150 proto_tree *tree, uint32_t length);
151
152extern int dissect_pn_user_data(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
153 proto_tree *tree, uint32_t length, const char *text);
154
155extern int dissect_pn_pa_profile_data(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
156 proto_tree *tree, uint32_t length, const char *text);
157
158extern int dissect_blocks(tvbuff_t *tvb, int offset,
159 packet_info *pinfo, proto_tree *tree, uint8_t *drep);
160
161#define PDU_TYPE_REQ 0x05
162#define PDU_TYPE_RSP 0x06
163
164extern int dissect_rsi_blocks(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, uint8_t* drep, uint32_t u32FOpnumOffsetOpnum, int type);
165
166#define SUBST_DATA 1
167#define FRAG_DATA 2
168
169extern int dissect_pn_user_data_bytes(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
170 proto_tree *tree, uint32_t length, int iSelect);
171
172extern int dissect_pn_malformed(tvbuff_t *tvb, int offset, packet_info *pinfo,
173 proto_tree *tree, uint32_t length);
174
175extern int dissect_pn_padding(tvbuff_t *tvb, int offset, packet_info *pinfo,
176 proto_tree *tree, int length);
177
178extern int dissect_pn_align4(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
179
180extern int dissect_PNIO_status(tvbuff_t *tvb, int offset, packet_info *pinfo,
181 proto_tree *tree, uint8_t *drep);
182
183extern int dissect_PNIO_C_SDU_RTC1(tvbuff_t* tvb, int offset, packet_info* pinfo,
184 proto_tree* tree, uint8_t* drep _U_, uint16_t frameid);
185
186extern int dissect_PNIO_RTC1_with_security(tvbuff_t* tvb, int offset, packet_info* pinfo,
187 proto_tree* tree, uint8_t* drep _U_, uint16_t frameid);
188
189extern int dissect_RTC3_with_security(tvbuff_t* tvb, int offset, packet_info* pinfo,
190 proto_tree* tree, uint8_t* drep _U_, void* data);
191
192extern int dissect_PNIO_RSI(tvbuff_t *tvb, int offset, packet_info *pinfo,
193 proto_tree *tree, uint8_t *drep);
194
195extern int dissect_PNIO_RSI_with_security(tvbuff_t* tvb, int offset, packet_info* pinfo,
196 proto_tree* tree, uint8_t* drep);
197
198extern int dissect_SecurityMetaData_block(tvbuff_t* tvb, int offset,
199 packet_info* pinfo, proto_item* item, proto_tree* tree, uint8_t* drep);
200
201extern int dissect_SecurityChecksum(tvbuff_t* tvb, int offset, proto_tree* tree);
202
203
204extern int dissect_PDRsiInstances_block(tvbuff_t *tvb, int offset,
205 packet_info *pinfo, proto_tree *tree, proto_item *item _U_, uint8_t *drep, uint8_t u8BlockVersionHigh, uint8_t u8BlockVersionLow);
206
207extern void pn_append_info(packet_info *pinfo, proto_item *dcp_item, const char *text);
208
209extern void pn_init_append_aruuid_frame_setup_list(e_guid_t aruuid, uint32_t setup);
210
211extern ARUUIDFrame* pn_find_aruuid_frame_setup(packet_info* pinfo);
212
213extern void pn_find_dcp_station_info(stationInfo* station_info, conversation_t* conversation);
214
215extern bool dissect_CSF_SDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data);
_address
Definition address.h:58
_e_guid_t
Definition guid-utils.h:23
_packet_info
Definition packet_info.h:43
_proto_node
Definition proto.h:907
_wmem_list_t
Definition wmem_list.c:23
conversation
Definition conversation.h:230
tagARUUIDFrame
Definition packet-pn.h:109
tagApduStatusSwitch
Definition packet-pn.h:62
tagIoDataObject
Definition packet-pn.h:76
tagIocsObject
Definition packet-pn.h:69
tagModuleDiffInfo
Definition packet-pn.h:104
tagStationInfo
Definition packet-pn.h:34
tvbuff
Definition tvbuff-int.h:35