Wireshark 5.1.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;
30extern int proto_pn_io_station_info;
31
32extern bool pnio_ps_selection; /* given by pnio preferences */
33
37typedef struct tagStationInfo {
38 /* general information */
41 uint16_t u16Vendor_id;
42 uint16_t u16Device_id;
43
44 /* frame structure */
47 uint16_t iocsNr_in;
48 uint16_t iocsNr_out;
49
50 /* GSD file station information */
51 bool gsdFound;
54
55 /* IOCS object data */
58
59 /* IOData object data */
62
63 /* Different ModuleIdentnumber */
65
66 /* Flag for the extraction of PNIO Objects without AR */
68} stationInfo;
69
73typedef struct tagApduStatusSwitch
74{
78} apduStatusSwitch;
79
83typedef struct tagIocsObject {
84 uint16_t slotNr;
85 uint16_t subSlotNr;
86 uint16_t frameOffset;
87} iocsObject;
88
92typedef struct tagIoDataObject {
93 uint16_t slotNr;
94 uint16_t subSlotNr;
95 uint32_t api;
96 uint32_t moduleIdentNr;
98 uint16_t frameOffset;
99 uint16_t length;
100 uint16_t amountInGSDML;
102 uint16_t f_par_crc1;
103 uint16_t f_src_adr;
104 uint16_t f_dest_adr;
106 uint8_t f_crc_len;
112 tvbuff_t *tvb_slot;
113 tvbuff_t *tvb_subslot;
114
115 /* Status- or Controlbyte data */
116 uint8_t last_sb_cb;
118} ioDataObject;
119
123typedef struct tagModuleDiffInfo {
124 uint16_t slotNr;
125 uint32_t modulID;
126} moduleDiffInfo;
127
131typedef struct tagARUUIDFrame {
133 uint32_t setupframe;
134 uint32_t releaseframe;
135 uint16_t outputframe;
136 uint16_t inputframe;
137} ARUUIDFrame;
138
139extern wmem_list_t *aruuid_frame_setup_list;
140
146extern void init_pn(int proto);
147
153extern void init_pn_io_rtc1(int proto);
154
160extern void init_pn_rsi(int proto);
161
165extern void pn_rsi_reassemble_init(void);
166
172extern void init_pnio_rtc1_station(stationInfo *station_info);
173
185extern unsigned dissect_pn_uint8(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
186 proto_tree *tree, int hfindex, uint8_t *pdata);
187
200extern unsigned dissect_pn_uint16_ret_item(tvbuff_t *tvb, unsigned offset, packet_info *pinfo _U_,
201 proto_tree *tree, int hfindex, uint16_t *pdata, proto_item ** new_item);
202
214extern unsigned dissect_pn_uint16(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
215 proto_tree *tree, int hfindex, uint16_t *pdata);
216
228extern unsigned dissect_pn_int16(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
229 proto_tree *tree, int hfindex, int16_t *pdata);
230
242extern unsigned dissect_pn_oid(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
243 proto_tree *tree, int hfindex, uint32_t *pdata);
244
256extern unsigned dissect_pn_mac(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
257 proto_tree *tree, int hfindex, uint8_t *pdata);
258
270extern unsigned dissect_pn_ipv4(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
271 proto_tree *tree, int hfindex, uint32_t *pdata);
272
284extern unsigned dissect_pn_uuid(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
285 proto_tree *tree, int hfindex, e_guid_t *uuid);
286
297extern unsigned dissect_pn_undecoded(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
298 proto_tree *tree, uint32_t length);
299
311extern unsigned dissect_pn_user_data(tvbuff_t *tvb, unsigned offset, packet_info *pinfo _U_,
312 proto_tree *tree, uint32_t length, const char *text);
313
327extern unsigned dissect_pn_pa_profile_data(tvbuff_t *tvb, unsigned offset, packet_info *pinfo _U_,
328 proto_tree *tree, uint32_t length, const char *text);
329
340extern unsigned dissect_blocks(tvbuff_t *tvb, unsigned offset,
341 packet_info *pinfo, proto_tree *tree, uint8_t *drep);
342
343#define PDU_TYPE_REQ 0x05
344#define PDU_TYPE_RSP 0x06
345
358extern unsigned dissect_rsi_blocks(tvbuff_t* tvb, unsigned offset, packet_info* pinfo, proto_tree* tree, uint8_t* drep, uint32_t u32FOpnumOffsetOpnum, int type);
359
360#define SUBST_DATA 1
361#define FRAG_DATA 2
362
374extern unsigned dissect_pn_user_data_bytes(tvbuff_t *tvb, unsigned offset, packet_info *pinfo _U_,
375 proto_tree *tree, uint32_t length, int iSelect);
376
387extern unsigned dissect_pn_malformed(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
388 proto_tree *tree, uint32_t length);
389
400extern unsigned dissect_pn_padding(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
401 proto_tree *tree, unsigned length);
402
412extern unsigned dissect_pn_align4(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree);
413
424extern unsigned dissect_PNIO_status(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
425 proto_tree *tree, uint8_t *drep);
426
438
439extern unsigned dissect_PNIO_C_SDU_RTC1(tvbuff_t* tvb, unsigned offset, packet_info* pinfo,
440 proto_tree* tree, uint8_t* drep _U_, uint16_t frameid);
441
453
454extern unsigned dissect_PNIO_RTC1_with_security(tvbuff_t* tvb, unsigned offset, packet_info* pinfo,
455 proto_tree* tree, uint8_t* drep _U_, uint16_t frameid);
456
468extern unsigned dissect_RTC3_with_security(tvbuff_t* tvb, unsigned offset, packet_info* pinfo,
469 proto_tree* tree, uint8_t* drep _U_, void* data);
470
481extern unsigned dissect_PNIO_RSI(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
482 proto_tree *tree, uint8_t *drep);
483
494extern unsigned dissect_PNIO_RSI_with_security(tvbuff_t* tvb, unsigned offset, packet_info* pinfo,
495 proto_tree* tree, uint8_t* drep);
496
508extern unsigned dissect_SecurityMetaData_block(tvbuff_t* tvb, unsigned offset,
509 packet_info* pinfo, proto_item* item, proto_tree* tree, uint8_t* drep);
510
519extern unsigned dissect_SecurityChecksum(tvbuff_t* tvb, unsigned offset, proto_tree* tree);
520
521
535extern unsigned dissect_PDRsiInstances_block(tvbuff_t *tvb, unsigned offset,
536 packet_info *pinfo, proto_tree *tree, proto_item *item _U_, uint8_t *drep, uint8_t u8BlockVersionHigh, uint8_t u8BlockVersionLow);
537
545extern void pn_append_info(packet_info *pinfo, proto_item *dcp_item, const char *text);
546
553extern void pn_init_append_aruuid_frame_setup_list(e_guid_t aruuid, uint32_t setup);
554
561extern ARUUIDFrame* pn_find_aruuid_frame_setup(packet_info* pinfo);
562
571extern void pn_find_dcp_station_info(stationInfo* station_info, conversation_t* conversation);
572
586extern stationInfo* pn_find_station_info(conversation_t* conversation, uint32_t aruuid);
587
598extern void pn_add_station_info(conversation_t* conversation, uint32_t aruuid, stationInfo* station_info);
599
611extern bool dissect_CSF_SDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data);
612
621extern bool pn_is_valid_security_metadata(tvbuff_t *tvb, unsigned security_meta_data_offset, int expected_security_data_length);
struct _address address
Holds a network or link-layer address of any supported type.
struct conversation conversation_t
struct _packet_info packet_info
Represents the metadata and indexing information for a single captured frame.
proto_node proto_item
Definition proto.h:952
struct _wmem_list_t wmem_list_t
Opaque type representing a scoped, doubly-linked list in the wmem system.
Definition wmem_list.h:42
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...
Definition conversation.h:284
Associates an AR UUID with the frame numbers of its setup, release, and cyclic data frames.
Definition packet-pn.h:131
uint16_t inputframe
Definition packet-pn.h:136
uint16_t outputframe
Definition packet-pn.h:135
uint32_t releaseframe
Definition packet-pn.h:134
uint32_t setupframe
Definition packet-pn.h:133
e_guid_t aruuid
Definition packet-pn.h:132
Carries the link-layer addressing context needed to correlate APDU status frames in a redundant PROFI...
Definition packet-pn.h:74
bool isRedundancyActive
Definition packet-pn.h:75
address dl_src
Definition packet-pn.h:77
address dl_dst
Definition packet-pn.h:76
Describes a single IO data object within a cyclic PROFINET frame, including PROFIsafe parameters and ...
Definition packet-pn.h:92
uint32_t fParameterIndexNr
Definition packet-pn.h:101
tvbuff_t * tvb_slot
Definition packet-pn.h:112
uint32_t api
Definition packet-pn.h:95
tvbuff_t * tvb_subslot
Definition packet-pn.h:113
uint16_t frameOffset
Definition packet-pn.h:98
uint16_t slotNr
Definition packet-pn.h:93
uint16_t f_src_adr
Definition packet-pn.h:103
uint16_t f_dest_adr
Definition packet-pn.h:104
bool profisafeSupported
Definition packet-pn.h:109
bool f_crc_seed
Definition packet-pn.h:105
uint16_t length
Definition packet-pn.h:99
uint8_t f_crc_len
Definition packet-pn.h:106
uint16_t f_par_crc1
Definition packet-pn.h:102
char * moduleNameStr
Definition packet-pn.h:111
address srcAddr
Definition packet-pn.h:107
uint8_t lastToggleBit
Definition packet-pn.h:117
uint8_t last_sb_cb
Definition packet-pn.h:116
uint32_t moduleIdentNr
Definition packet-pn.h:96
address dstAddr
Definition packet-pn.h:108
uint16_t amountInGSDML
Definition packet-pn.h:100
bool discardIOXS
Definition packet-pn.h:110
uint32_t subModuleIdentNr
Definition packet-pn.h:97
uint16_t subSlotNr
Definition packet-pn.h:94
Describes a single IOCS (IO Consumer Status) object entry within a cyclic PROFINET frame.
Definition packet-pn.h:83
uint16_t subSlotNr
Definition packet-pn.h:85
uint16_t slotNr
Definition packet-pn.h:84
uint16_t frameOffset
Definition packet-pn.h:86
Records a module whose actual ModuleIdentNumber differs from the value expected by the IO controller.
Definition packet-pn.h:123
uint16_t slotNr
Definition packet-pn.h:124
uint32_t modulID
Definition packet-pn.h:125
Holds all dissection state for a single PROFINET IO station, spanning identity, frame layout,...
Definition packet-pn.h:37
uint16_t u16Vendor_id
Definition packet-pn.h:41
char * nameofstation
Definition packet-pn.h:40
uint16_t ioDataObjectNr_out
Definition packet-pn.h:46
uint16_t iocsNr_in
Definition packet-pn.h:47
bool filled_with_objects
Definition packet-pn.h:67
wmem_list_t * iocs_data_out
Definition packet-pn.h:57
bool gsdPathLength
Definition packet-pn.h:52
wmem_list_t * iocs_data_in
Definition packet-pn.h:56
wmem_list_t * ioobject_data_in
Definition packet-pn.h:60
uint16_t iocsNr_out
Definition packet-pn.h:48
uint16_t ioDataObjectNr_in
Definition packet-pn.h:45
wmem_list_t * diff_module
Definition packet-pn.h:64
char * typeofstation
Definition packet-pn.h:39
uint16_t u16Device_id
Definition packet-pn.h:42
wmem_list_t * ioobject_data_out
Definition packet-pn.h:61
char * gsdLocation
Definition packet-pn.h:53
bool gsdFound
Definition packet-pn.h:51