| Wireshark 4.7.3 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 ---- */
27 extern int proto_pn_dcp;
28 extern int proto_pn_io_apdu_status;
29 extern int proto_pn_io_time_aware_status;
30
31 extern bool pnio_ps_selection; /* given by pnio preferences */
32
36 typedef struct tagStationInfo {
37 /* general information */
38 char *typeofstation;
39 char *nameofstation;
40 uint16_t u16Vendor_id;
41 uint16_t u16Device_id;
42
43 /* frame structure */
44 uint16_t ioDataObjectNr_in;
45 uint16_t ioDataObjectNr_out;
46 uint16_t iocsNr_in;
47 uint16_t iocsNr_out;
48
49 /* GSD file station information */
50 bool gsdFound;
51 bool gsdPathLength;
52 char *gsdLocation;
53
54 /* IOCS object data */
55 wmem_list_t *iocs_data_in;
56 wmem_list_t *iocs_data_out;
57
58 /* IOData object data */
59 wmem_list_t *ioobject_data_in;
60 wmem_list_t *ioobject_data_out;
61
62 /* Different ModuleIdentnumber */
63 wmem_list_t *diff_module;
64
65 /* Flag for the extraction of PNIO Objects without AR */
66 bool filled_with_objects;
67} stationInfo;
68
72 typedef struct tagApduStatusSwitch
73{
74 bool isRedundancyActive;
75 address dl_dst;
76 address dl_src;
77} apduStatusSwitch;
78
82 typedef struct tagIocsObject {
83 uint16_t slotNr;
84 uint16_t subSlotNr;
85 uint16_t frameOffset;
86} iocsObject;
87
91 typedef struct tagIoDataObject {
92 uint16_t slotNr;
93 uint16_t subSlotNr;
94 uint32_t api;
95 uint32_t moduleIdentNr;
96 uint32_t subModuleIdentNr;
97 uint16_t frameOffset;
98 uint16_t length;
99 uint16_t amountInGSDML;
100 uint32_t fParameterIndexNr;
101 uint16_t f_par_crc1;
102 uint16_t f_src_adr;
103 uint16_t f_dest_adr;
104 bool f_crc_seed;
105 uint8_t f_crc_len;
106 address srcAddr;
107 address dstAddr;
108 bool profisafeSupported;
109 bool discardIOXS;
110 char *moduleNameStr;
111 tvbuff_t *tvb_slot;
112 tvbuff_t *tvb_subslot;
113
114 /* Status- or Controlbyte data */
115 uint8_t last_sb_cb;
116 uint8_t lastToggleBit;
117} ioDataObject;
118
122 typedef struct tagModuleDiffInfo {
123 uint16_t slotNr;
124 uint32_t modulID;
125} moduleDiffInfo;
126
130 typedef struct tagARUUIDFrame {
131 e_guid_t aruuid;
132 uint32_t setupframe;
133 uint32_t releaseframe;
134 uint16_t outputframe;
135 uint16_t inputframe;
136} ARUUIDFrame;
137
138 extern wmem_list_t *aruuid_frame_setup_list;
139
145 extern void init_pn(int proto);
146
152 extern void init_pn_io_rtc1(int proto);
153
159 extern void init_pn_rsi(int proto);
160
164 extern void pn_rsi_reassemble_init(void);
165
171 extern void init_pnio_rtc1_station(stationInfo *station_info);
172
184 extern unsigned dissect_pn_uint8(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
185 proto_tree *tree, int hfindex, uint8_t *pdata);
186
199 extern unsigned dissect_pn_uint16_ret_item(tvbuff_t *tvb, unsigned offset, packet_info *pinfo _U_,
200 proto_tree *tree, int hfindex, uint16_t *pdata, proto_item ** new_item);
201
213 extern unsigned dissect_pn_uint16(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
214 proto_tree *tree, int hfindex, uint16_t *pdata);
215
227 extern unsigned dissect_pn_int16(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
228 proto_tree *tree, int hfindex, int16_t *pdata);
229
241 extern unsigned dissect_pn_oid(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
242 proto_tree *tree, int hfindex, uint32_t *pdata);
243
255 extern unsigned dissect_pn_mac(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
256 proto_tree *tree, int hfindex, uint8_t *pdata);
257
269 extern unsigned dissect_pn_ipv4(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
270 proto_tree *tree, int hfindex, uint32_t *pdata);
271
283 extern unsigned dissect_pn_uuid(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
284 proto_tree *tree, int hfindex, e_guid_t *uuid);
285
296 extern unsigned dissect_pn_undecoded(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
297 proto_tree *tree, uint32_t length);
298
310 extern unsigned dissect_pn_user_data(tvbuff_t *tvb, unsigned offset, packet_info *pinfo _U_,
311 proto_tree *tree, uint32_t length, const char *text);
312
326 extern unsigned dissect_pn_pa_profile_data(tvbuff_t *tvb, unsigned offset, packet_info *pinfo _U_,
327 proto_tree *tree, uint32_t length, const char *text);
328
339 extern unsigned dissect_blocks(tvbuff_t *tvb, unsigned offset,
340 packet_info *pinfo, proto_tree *tree, uint8_t *drep);
341
342#define PDU_TYPE_REQ 0x05
343#define PDU_TYPE_RSP 0x06
344
357 extern unsigned dissect_rsi_blocks(tvbuff_t* tvb, unsigned offset, packet_info* pinfo, proto_tree* tree, uint8_t* drep, uint32_t u32FOpnumOffsetOpnum, int type);
358
359#define SUBST_DATA 1
360#define FRAG_DATA 2
361
373 extern unsigned dissect_pn_user_data_bytes(tvbuff_t *tvb, unsigned offset, packet_info *pinfo _U_,
374 proto_tree *tree, uint32_t length, int iSelect);
375
386 extern unsigned dissect_pn_malformed(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
387 proto_tree *tree, uint32_t length);
388
399 extern unsigned dissect_pn_padding(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
400 proto_tree *tree, unsigned length);
401
411 extern unsigned dissect_pn_align4(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree);
412
423 extern unsigned dissect_PNIO_status(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
424 proto_tree *tree, uint8_t *drep);
425
437
438 extern unsigned dissect_PNIO_C_SDU_RTC1(tvbuff_t* tvb, unsigned offset, packet_info* pinfo,
439 proto_tree* tree, uint8_t* drep _U_, uint16_t frameid);
440
452
453 extern unsigned dissect_PNIO_RTC1_with_security(tvbuff_t* tvb, unsigned offset, packet_info* pinfo,
454 proto_tree* tree, uint8_t* drep _U_, uint16_t frameid);
455
467 extern unsigned dissect_RTC3_with_security(tvbuff_t* tvb, unsigned offset, packet_info* pinfo,
468 proto_tree* tree, uint8_t* drep _U_, void* data);
469
480 extern unsigned dissect_PNIO_RSI(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
481 proto_tree *tree, uint8_t *drep);
482
493 extern unsigned dissect_PNIO_RSI_with_security(tvbuff_t* tvb, unsigned offset, packet_info* pinfo,
494 proto_tree* tree, uint8_t* drep);
495
507 extern unsigned dissect_SecurityMetaData_block(tvbuff_t* tvb, unsigned offset,
508 packet_info* pinfo, proto_item* item, proto_tree* tree, uint8_t* drep);
509
518 extern unsigned dissect_SecurityChecksum(tvbuff_t* tvb, unsigned offset, proto_tree* tree);
519
520
534 extern unsigned dissect_PDRsiInstances_block(tvbuff_t *tvb, unsigned offset,
535 packet_info *pinfo, proto_tree *tree, proto_item *item _U_, uint8_t *drep, uint8_t u8BlockVersionHigh, uint8_t u8BlockVersionLow);
536
544 extern void pn_append_info(packet_info *pinfo, proto_item *dcp_item, const char *text);
545
552 extern void pn_init_append_aruuid_frame_setup_list(e_guid_t aruuid, uint32_t setup);
553
560 extern ARUUIDFrame* pn_find_aruuid_frame_setup(packet_info* pinfo);
561
570 extern void pn_find_dcp_station_info(stationInfo* station_info, conversation_t* conversation);
571
583 extern bool dissect_CSF_SDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data);
584
593 extern bool pn_is_valid_security_metadata(tvbuff_t *tvb, unsigned security_meta_data_offset, int expected_security_data_length);
address
struct _address address
Holds a network or link-layer address of any supported type.
conversation_t
struct conversation conversation_t
packet_info
struct _packet_info packet_info
Represents the metadata and indexing information for a single captured frame.
proto_item
proto_node proto_item
Definition proto.h:927
wmem_list_t
struct _wmem_list_t wmem_list_t
Opaque type representing a scoped, doubly-linked list in the wmem system.
Definition wmem_list.h:42
e_guid_t
struct _e_guid_t e_guid_t
Represents a GUID/UUID value; may be larger than GUID_LEN so must not be used to directly overlay pac...
conversation
Definition conversation.h:282
tagARUUIDFrame
Associates an AR UUID with the frame numbers of its setup, release, and cyclic data frames.
Definition packet-pn.h:130
tagARUUIDFrame::inputframe
uint16_t inputframe
Definition packet-pn.h:135
tagARUUIDFrame::outputframe
uint16_t outputframe
Definition packet-pn.h:134
tagARUUIDFrame::releaseframe
uint32_t releaseframe
Definition packet-pn.h:133
tagARUUIDFrame::setupframe
uint32_t setupframe
Definition packet-pn.h:132
tagARUUIDFrame::aruuid
e_guid_t aruuid
Definition packet-pn.h:131
tagApduStatusSwitch
Carries the link-layer addressing context needed to correlate APDU status frames in a redundant PROFI...
Definition packet-pn.h:73
tagApduStatusSwitch::isRedundancyActive
bool isRedundancyActive
Definition packet-pn.h:74
tagApduStatusSwitch::dl_src
address dl_src
Definition packet-pn.h:76
tagApduStatusSwitch::dl_dst
address dl_dst
Definition packet-pn.h:75
tagIoDataObject
Describes a single IO data object within a cyclic PROFINET frame, including PROFIsafe parameters and ...
Definition packet-pn.h:91
tagIoDataObject::fParameterIndexNr
uint32_t fParameterIndexNr
Definition packet-pn.h:100
tagIoDataObject::tvb_slot
tvbuff_t * tvb_slot
Definition packet-pn.h:111
tagIoDataObject::api
uint32_t api
Definition packet-pn.h:94
tagIoDataObject::tvb_subslot
tvbuff_t * tvb_subslot
Definition packet-pn.h:112
tagIoDataObject::frameOffset
uint16_t frameOffset
Definition packet-pn.h:97
tagIoDataObject::slotNr
uint16_t slotNr
Definition packet-pn.h:92
tagIoDataObject::f_src_adr
uint16_t f_src_adr
Definition packet-pn.h:102
tagIoDataObject::f_dest_adr
uint16_t f_dest_adr
Definition packet-pn.h:103
tagIoDataObject::profisafeSupported
bool profisafeSupported
Definition packet-pn.h:108
tagIoDataObject::f_crc_seed
bool f_crc_seed
Definition packet-pn.h:104
tagIoDataObject::length
uint16_t length
Definition packet-pn.h:98
tagIoDataObject::f_crc_len
uint8_t f_crc_len
Definition packet-pn.h:105
tagIoDataObject::f_par_crc1
uint16_t f_par_crc1
Definition packet-pn.h:101
tagIoDataObject::moduleNameStr
char * moduleNameStr
Definition packet-pn.h:110
tagIoDataObject::srcAddr
address srcAddr
Definition packet-pn.h:106
tagIoDataObject::lastToggleBit
uint8_t lastToggleBit
Definition packet-pn.h:116
tagIoDataObject::last_sb_cb
uint8_t last_sb_cb
Definition packet-pn.h:115
tagIoDataObject::moduleIdentNr
uint32_t moduleIdentNr
Definition packet-pn.h:95
tagIoDataObject::dstAddr
address dstAddr
Definition packet-pn.h:107
tagIoDataObject::amountInGSDML
uint16_t amountInGSDML
Definition packet-pn.h:99
tagIoDataObject::discardIOXS
bool discardIOXS
Definition packet-pn.h:109
tagIoDataObject::subModuleIdentNr
uint32_t subModuleIdentNr
Definition packet-pn.h:96
tagIoDataObject::subSlotNr
uint16_t subSlotNr
Definition packet-pn.h:93
tagIocsObject
Describes a single IOCS (IO Consumer Status) object entry within a cyclic PROFINET frame.
Definition packet-pn.h:82
tagIocsObject::subSlotNr
uint16_t subSlotNr
Definition packet-pn.h:84
tagIocsObject::slotNr
uint16_t slotNr
Definition packet-pn.h:83
tagIocsObject::frameOffset
uint16_t frameOffset
Definition packet-pn.h:85
tagModuleDiffInfo
Records a module whose actual ModuleIdentNumber differs from the value expected by the IO controller.
Definition packet-pn.h:122
tagModuleDiffInfo::slotNr
uint16_t slotNr
Definition packet-pn.h:123
tagModuleDiffInfo::modulID
uint32_t modulID
Definition packet-pn.h:124
tagStationInfo
Holds all dissection state for a single PROFINET IO station, spanning identity, frame layout,...
Definition packet-pn.h:36
tagStationInfo::u16Vendor_id
uint16_t u16Vendor_id
Definition packet-pn.h:40
tagStationInfo::nameofstation
char * nameofstation
Definition packet-pn.h:39
tagStationInfo::ioDataObjectNr_out
uint16_t ioDataObjectNr_out
Definition packet-pn.h:45
tagStationInfo::iocsNr_in
uint16_t iocsNr_in
Definition packet-pn.h:46
tagStationInfo::filled_with_objects
bool filled_with_objects
Definition packet-pn.h:66
tagStationInfo::iocs_data_out
wmem_list_t * iocs_data_out
Definition packet-pn.h:56
tagStationInfo::gsdPathLength
bool gsdPathLength
Definition packet-pn.h:51
tagStationInfo::iocs_data_in
wmem_list_t * iocs_data_in
Definition packet-pn.h:55
tagStationInfo::ioobject_data_in
wmem_list_t * ioobject_data_in
Definition packet-pn.h:59
tagStationInfo::iocsNr_out
uint16_t iocsNr_out
Definition packet-pn.h:47
tagStationInfo::ioDataObjectNr_in
uint16_t ioDataObjectNr_in
Definition packet-pn.h:44
tagStationInfo::diff_module
wmem_list_t * diff_module
Definition packet-pn.h:63
tagStationInfo::typeofstation
char * typeofstation
Definition packet-pn.h:38
tagStationInfo::u16Device_id
uint16_t u16Device_id
Definition packet-pn.h:41
tagStationInfo::ioobject_data_out
wmem_list_t * ioobject_data_out
Definition packet-pn.h:60
tagStationInfo::gsdLocation
char * gsdLocation
Definition packet-pn.h:52
tagStationInfo::gsdFound
bool gsdFound
Definition packet-pn.h:50