Wireshark 4.5.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 <[email protected]>
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 */
34typedef 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;
58
59typedef struct tagApduStatusSwitch
60{
61 bool isRedundancyActive;
62 address dl_dst;
63 address dl_src;
65
66/* Structure for IOCS Frames */
67typedef struct tagIocsObject {
68 uint16_t slotNr;
69 uint16_t subSlotNr;
70 uint16_t frameOffset;
72
73/* Structure for IO Data Objects */
74typedef struct tagIoDataObject {
75 uint16_t slotNr;
76 uint16_t subSlotNr;
77 uint32_t api;
78 uint32_t moduleIdentNr;
79 uint32_t subModuleIdentNr;
80 uint16_t frameOffset;
81 uint16_t length;
82 uint16_t amountInGSDML;
83 uint32_t fParameterIndexNr;
84 uint16_t f_par_crc1;
85 uint16_t f_src_adr;
86 uint16_t f_dest_adr;
87 bool f_crc_seed;
88 uint8_t f_crc_len;
89 address srcAddr;
90 address dstAddr;
91 bool profisafeSupported;
92 bool discardIOXS;
93 char *moduleNameStr;
94 tvbuff_t *tvb_slot;
95 tvbuff_t *tvb_subslot;
96 /* Status- or Controlbyte data*/
97 uint8_t last_sb_cb;
98 uint8_t lastToggleBit;
100
101/* Structure for Modules with different ModuleIdentnumber */
102typedef struct tagModuleDiffInfo {
103 uint16_t slotNr;
104 uint32_t modulID;
106
107typedef struct tagARUUIDFrame {
108 e_guid_t aruuid;
109 uint32_t setupframe;
110 uint32_t releaseframe;
111 uint16_t outputframe;
112 uint16_t inputframe;
114
115extern wmem_list_t *aruuid_frame_setup_list;
116
117extern void init_pn(int proto);
118extern void init_pn_io_rtc1(int proto);
119extern void init_pn_rsi(int proto);
120extern void pn_rsi_reassemble_init(void);
121
122extern void init_pnio_rtc1_station(stationInfo *station_info);
123
124extern int dissect_pn_uint8(tvbuff_t *tvb, int offset, packet_info *pinfo,
125 proto_tree *tree, int hfindex, uint8_t *pdata);
126
127extern int dissect_pn_uint16_ret_item(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
128 proto_tree *tree, int hfindex, uint16_t *pdata, proto_item ** new_item);
129extern int dissect_pn_uint16(tvbuff_t *tvb, int offset, packet_info *pinfo,
130 proto_tree *tree, int hfindex, uint16_t *pdata);
131
132extern int dissect_pn_int16(tvbuff_t *tvb, int offset, packet_info *pinfo,
133 proto_tree *tree, int hfindex, int16_t *pdata);
134
135extern int dissect_pn_oid(tvbuff_t *tvb, int offset, packet_info *pinfo,
136 proto_tree *tree, int hfindex, uint32_t *pdata);
137
138extern int dissect_pn_mac(tvbuff_t *tvb, int offset, packet_info *pinfo,
139 proto_tree *tree, int hfindex, uint8_t *pdata);
140
141extern int dissect_pn_ipv4(tvbuff_t *tvb, int offset, packet_info *pinfo,
142 proto_tree *tree, int hfindex, uint32_t *pdata);
143
144extern int dissect_pn_uuid(tvbuff_t *tvb, int offset, packet_info *pinfo,
145 proto_tree *tree, int hfindex, e_guid_t *uuid);
146
147extern int dissect_pn_undecoded(tvbuff_t *tvb, int offset, packet_info *pinfo,
148 proto_tree *tree, uint32_t length);
149
150extern int dissect_pn_user_data(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
151 proto_tree *tree, uint32_t length, const char *text);
152
153extern int dissect_pn_pa_profile_data(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
154 proto_tree *tree, uint32_t length, const char *text);
155
156extern int dissect_blocks(tvbuff_t *tvb, int offset,
157 packet_info *pinfo, proto_tree *tree, uint8_t *drep);
158
159#define PDU_TYPE_REQ 0x05
160#define PDU_TYPE_RSP 0x06
161
162extern int dissect_rsi_blocks(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, uint8_t* drep, uint32_t u32FOpnumOffsetOpnum, int type);
163
164#define SUBST_DATA 1
165#define FRAG_DATA 2
166
167extern int dissect_pn_user_data_bytes(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
168 proto_tree *tree, uint32_t length, int iSelect);
169
170extern int dissect_pn_malformed(tvbuff_t *tvb, int offset, packet_info *pinfo,
171 proto_tree *tree, uint32_t length);
172
173extern int dissect_pn_padding(tvbuff_t *tvb, int offset, packet_info *pinfo,
174 proto_tree *tree, int length);
175
176extern int dissect_pn_align4(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
177
178extern int dissect_PNIO_status(tvbuff_t *tvb, int offset, packet_info *pinfo,
179 proto_tree *tree, uint8_t *drep);
180
181extern int dissect_PNIO_C_SDU_RTC1(tvbuff_t* tvb, int offset, packet_info* pinfo,
182 proto_tree* tree, uint8_t* drep _U_, uint16_t frameid);
183
184extern int dissect_PNIO_RSI(tvbuff_t *tvb, int offset, packet_info *pinfo,
185 proto_tree *tree, uint8_t *drep);
186
187extern int dissect_PDRsiInstances_block(tvbuff_t *tvb, int offset,
188 packet_info *pinfo, proto_tree *tree, proto_item *item _U_, uint8_t *drep, uint8_t u8BlockVersionHigh, uint8_t u8BlockVersionLow);
189
190extern void pn_append_info(packet_info *pinfo, proto_item *dcp_item, const char *text);
191
192extern void pn_init_append_aruuid_frame_setup_list(e_guid_t aruuid, uint32_t setup);
193
194extern ARUUIDFrame* pn_find_aruuid_frame_setup(packet_info* pinfo);
195
196extern void pn_find_dcp_station_info(stationInfo* station_info, conversation_t* conversation);
197
198extern bool dissect_CSF_SDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data);
199
200#define MAX_LINE_LENGTH 1024 /* used for fgets() */
201
202/* Read a string from an "xml" file, dropping xml comment blocks */
203#include <stdio.h>
204extern char *pn_fgets(char *str, int n, FILE *stream, wmem_allocator_t *scope);
Definition address.h:56
Definition guid-utils.h:23
Definition packet_info.h:43
Definition proto.h:903
Definition wmem_allocator.h:27
Definition wmem_list.c:23
Definition conversation.h:224
Definition stream.c:41
Definition packet-pn.h:107
Definition packet-pn.h:60
Definition packet-pn.h:74
Definition packet-pn.h:67
Definition packet-pn.h:102
Definition packet-pn.h:34
Definition tvbuff-int.h:35