OpENer - Open Source EtherNet/IP(TM) I/O Target Stack  2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cipepath.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (c) 2016, Rockwell Automation, Inc.
3  * All rights reserved.
4  *
5  ******************************************************************************/
6 
7 #ifndef SRC_CIP_CIPEPATH_H_
8 #define SRC_CIP_CIPEPATH_H_
9 
10 #include <stdbool.h>
11 
12 #include "ciptypes.h"
13 #include "cipelectronickey.h"
14 
15 #define SEGMENT_TYPE_PORT_SEGMENT 0x00
16 #define SEGMENT_TYPE_LOGICAL_SEGMENT 0x20
17 #define SEGMENT_TYPE_NETWORK_SEGMENT 0x40
18 #define SEGMENT_TYPE_SYMBOLIC_SEGMENT 0x60
19 #define SEGMENT_TYPE_DATA_SEGMENT 0x80
20 #define SEGMENT_TYPE_DATA_TYPE_CONSTRUCTED 0xA0
21 #define SEGMENT_TYPE_DATA_TYPE_ELEMENTARTY 0xC0
22 #define SEGMENT_TYPE_SEGMENT_RESERVED 0xE0
24 #define LOGICAL_SEGMENT_TYPE_CLASS_ID 0x00
25 #define LOGICAL_SEGMENT_TYPE_INSTANCE_ID 0x04
26 #define LOGICAL_SEGMENT_TYPE_MEMBER_ID 0x08
27 #define LOGICAL_SEGMENT_TYPE_CONNECTION_POINT 0x0C
28 #define LOGICAL_SEGMENT_TYPE_ATTRIBUTE_ID 0x10
29 #define LOGICAL_SEGMENT_TYPE_SPECIAL 0x14
30 #define LOGICAL_SEGMENT_TYPE_SERVICE_ID 0x18
31 #define LOGICAL_SEGMENT_TYPE_EXTENDED_LOGICAL 0x1C
33 #define LOGICAL_SEGMENT_FORMAT_EIGHT_BIT 0x00
34 #define LOGICAL_SEGMENT_FORMAT_SIXTEEN_BIT 0x01
35 #define LOGICAL_SEGMENT_FORMAT_THIRTY_TWO_BIT 0x02
37 #define LOGICAL_SEGMENT_EXTENDED_TYPE_RESERVED 0x00
38 #define LOGICAL_SEGMENT_EXTENDED_TYPE_ARRAY_INDEX 0x01
39 #define LOGICAL_SEGMENT_EXTENDED_TYPE_INDIRECT_ARRAY_INDEX 0x02
40 #define LOGICAL_SEGMENT_EXTENDED_TYPE_BIT_INDEX 0x03
41 #define LOGICAL_SEGMENT_EXTENDED_TYPE_INDIRECT_BIT_INDEX 0x04
42 #define LOGICAL_SEGMENT_EXTENDED_TYPE_STRUCTURE_MEMBER_NUMBER 0x05
43 #define LOGICAL_SEGMENT_EXTENDED_TYPE_STRUCTURE_MEMBER_HANDLE 0x06
45 #define LOGICAL_SEGMENT_SPECIAL_TYPE_FORMAT_ELECTRONIC_KEY 0x00
47 #define NETWORK_SEGMENT_SUBTYPE_SCHEDULE 0x01
48 #define NETWORK_SEGMENT_SUBTYPE_FIXED_TAG 0x02
49 #define NETWORK_SEGMENT_SUBTYPE_PRODUCTION_INHIBIT_TIME_IN_MILLISECONDS 0x03
50 #define NETWORK_SEGMENT_SUBTYPE_SAFETY 0x04
51 #define NETWORK_SEGMENT_SUBTYPE_PRODUCTION_INHIBIT_TIME_IN_MICROSECONDS 0x10
52 #define NETWORK_SEGMENT_SUBTYPE_EXTENDED_NETWORK 0x1F
59 typedef enum segment_type {
60  /* Segments */
69 } SegmentType;
70 
72 typedef enum port_segment_type {
75 
77 typedef enum logical_segment_type {
87 
97 
105 
110 
118 
132 
136 typedef enum data_segment_subtype {
141 
149 
161 
162 /* Start - Often used types of EPaths */
163 typedef struct connection_path_epath {
168 /* End - Often used types of EPaths */
169 
175 SegmentType GetPathSegmentType(const CipOctet *const cip_path);
176 
183  unsigned char *const cip_path);
184 
185 /*********************************************************
186 * Port Segment functions
187 *********************************************************/
188 
195  const unsigned char *const cip_path);
196 
203  const unsigned char *const cip_path);
204 
210 void SetPathPortSegmentPortIdentifier(const unsigned int port_identifier,
211  unsigned char *const cip_path);
212 
219  const unsigned char *const cip_path);
220 
227  const unsigned char *const cip_path);
228 
235  const unsigned int extended_port_identifier,
236  CipOctet *const cip_path);
237 
244  const unsigned char *const cip_path);
245 
247  CipOctet *const cip_path);
248 
255  const unsigned char *const cip_path);
256 
258  CipOctet *const cip_path);
259 
260 const CipDword CipEpathGetLogicalValue(const EipUint8 **message);
261 
262 size_t CipEpathSetLogicalValue(const CipDword logical_value,
263  const LogicalSegmentLogicalFormat logical_format,
264  CipOctet **message);
265 
272  const unsigned char *const cip_path);
273 
281  const unsigned char *const cip_path);
282 
289  const unsigned char *const cip_path);
290 
297  const CipOctet **const cip_path,
298  ElectronicKeyFormat4 *key);
299 
306  const unsigned char *const cip_path);
307 
314  const unsigned char *const cip_path);
315 
322  const unsigned char *const cip_path);
323 
330  const unsigned char *const cip_path);
331 
338  const unsigned char *const cip_path);
339 
346  const unsigned char *const cip_path);
347 
354  const unsigned char *const cip_path);
355 
362  const unsigned char *const cip_path);
363 
364 /* Special purpose encoding and decoding functions */
365 
367  const CipConnectionPathEpath *const connection_epath,
368  CipOctet **encoded_path);
369 
370 bool CipEpathEqual(const CipOctet *const path1,
371  const CipUint path1_length,
372  const CipOctet *const path2,
373  const CipUint path2_length);
374 
375 #endif /* SRC_CIP_CIPEPATH_H_ */
LogicalSegmentExtendedLogicalType GetPathLogicalSegmentExtendedLogicalType(const unsigned char *const cip_path)
Gets the Extended Logical Type of a Logical Segment EPath message.
Definition: cipepath.c:379
logical_segment_extended_logical_type
Definition: cipepath.h:88
LogicalSegmentLogicalType GetPathLogicalSegmentLogicalType(const unsigned char *const cip_path)
Gets the Logical Type of an EPath Logical Segment message.
Definition: cipepath.c:213
enum port_segment_type PortSegmentFlag
Port Segment flags.
network_segment_subtype
All types of network segment types for the use in all code.
Definition: cipepath.h:123
SymbolicSegmentFormat GetPathSymbolicSegmentFormat(const unsigned char *const cip_path)
Gets the Symbolic Segment Format of the Symbolic Segment EPath message.
Definition: cipepath.c:534
size_t CipEpathSetLogicalValue(const CipDword logical_value, const LogicalSegmentLogicalFormat logical_format, CipOctet **message)
Definition: cipepath.c:356
CipUdint GetPathNetworkSegmentProductionInhibitTimeInMicroseconds(const unsigned char *const cip_path)
Gets the Production Inhibit Time in Microseconds.
Definition: cipepath.c:514
symbolic_segment_extended_format
Extended symbolic symbol formats.
Definition: cipepath.h:153
logical_segment_special_type_logical_format
Definition: cipepath.h:106
ElectronicKeySegmentFormat GetPathLogicalSegmentElectronicKeyFormat(const unsigned char *const cip_path)
Gets the Electronic Key format of a Logical Segment Special Type EPath message.
Definition: cipepath.c:426
LogicalSegmentLogicalFormat GetPathLogicalSegmentLogicalFormat(const unsigned char *const cip_path)
Gets the Logical Format of a Logical Segment EPath message.
Definition: cipepath.c:287
CipDword instance_id
Definition: cipepath.h:165
CipDword attribute_id_or_connection_point
Definition: cipepath.h:166
struct connection_path_epath CipConnectionPathEpath
void SetPathSegmentType(SegmentType segment_type, unsigned char *const cip_path)
Sets the basic segment type of an CIP EPath to be sent.
Definition: cipepath.c:113
enum data_segment_subtype DataSegmentSubtype
Data segment sub types.
CipUsint GetPathNetworkSegmentProductionInhibitTimeInMilliseconds(const unsigned char *const cip_path)
Gets the Production Inhibit Time in Milliseconds.
Definition: cipepath.c:497
symbolic_segment_format
Symbolic segment formats.
Definition: cipepath.h:145
enum logical_segment_extended_logical_type LogicalSegmentExtendedLogicalType
SegmentType GetPathSegmentType(const CipOctet *const cip_path)
Gets the basic segment type of a CIP EPath.
Definition: cipepath.c:76
uint8_t CipOctet
Data types as defined in the CIP Specification Vol 1 Appendix C.
Definition: typedefs.h:41
unsigned int GetPathPortSegmentPortIdentifier(const unsigned char *const cip_path)
Only to be used on Port Segments. Returns the Port Identifier.
Definition: cipepath.c:158
uint8_t EipUint8
Definition: typedefs.h:32
enum network_segment_subtype NetworkSegmentSubtype
All types of network segment types for the use in all code.
size_t CipEpathEncodeConnectionEpath(const CipConnectionPathEpath *const connection_epath, CipOctet **encoded_path)
Definition: cipepath.c:645
void SetPathPortSegmentExtendedPortIdentifier(const unsigned int extended_port_identifier, CipOctet *const cip_path)
Sets the Extended Port Identifier in a EPath Port Segment message.
Definition: cipepath.c:198
port_segment_type
Port Segment flags.
Definition: cipepath.h:72
enum logical_segment_logical_format LogicalSegmentLogicalFormat
Enum containing values how long the encoded value will be (8, 16, or 32 bit)
enum segment_type SegmentType
Segment type Enum.
void SetPathPortSegmentPortIdentifier(const unsigned int port_identifier, unsigned char *const cip_path)
Sets the Port Identifier form an Port Segment EPath to be sent.
Definition: cipepath.c:168
logical_segment_logical_format
Enum containing values how long the encoded value will be (8, 16, or 32 bit)
Definition: cipepath.h:100
bool GetPathPortSegmentExtendedLinkAddressSizeBit(const unsigned char *const cip_path)
Only to be used on Port Segments. Returns if the Port Segment has the extended link address size bit ...
Definition: cipepath.c:148
SymbolicSegmentExtendedFormat GetPathSymbolicSegmentNumericType(const unsigned char *const cip_path)
Gets the Numeric subtype of a Symbolic Segment Extended Format EPath message.
Definition: cipepath.c:552
CipUsint GetPathDataSegmentSimpleDataWordLength(const unsigned char *const cip_path)
Gets the data word length of a Simple Data segment.
Definition: cipepath.c:616
void SetPathLogicalSegmentLogicalFormat(LogicalSegmentLogicalFormat format, CipOctet *const cip_path)
Definition: cipepath.c:311
const CipDword CipEpathGetLogicalValue(const EipUint8 **message)
Definition: cipepath.c:332
uint8_t CipUsint
Definition: typedefs.h:46
DataSegmentSubtype GetPathDataSegmentSubtype(const unsigned char *const cip_path)
Gets the Data Segment subtype of a Data Segment EPath message.
Definition: cipepath.c:595
bool CipEpathEqual(const CipOctet *const path1, const CipUint path1_length, const CipOctet *const path2, const CipUint path2_length)
Definition: cipepath.c:697
enum symbolic_segment_format SymbolicSegmentFormat
Symbolic segment formats.
SymbolicSegmentExtendedFormat GetPathSymbolicSegmentExtendedFormat(const unsigned char *const cip_path)
Gets the Extended Format subtype of a Symbolic Segment EPath message.
Definition: cipepath.c:570
data_segment_subtype
Data segment sub types.
Definition: cipepath.h:136
logical_segment_type
Enum containing values which kind of logical segment is encoded.
Definition: cipepath.h:77
enum electronic_key_segment_format ElectronicKeySegmentFormat
Electronic key formats.
electronic_key_segment_format
Electronic key formats.
Definition: cipepath.h:114
void SetPathLogicalSegmentLogicalType(LogicalSegmentLogicalType logical_type, CipOctet *const cip_path)
Definition: cipepath.c:252
NetworkSegmentSubtype GetPathNetworkSegmentSubtype(const unsigned char *const cip_path)
Gets the Network Segment Subtype of a EPatch Network Segement EPath message.
Definition: cipepath.c:466
uint32_t CipUdint
Definition: typedefs.h:48
uint16_t CipUint
Definition: typedefs.h:47
LogicalSegmentSpecialTypeLogicalFormat GetPathLogicalSegmentSpecialTypeLogicalType(const unsigned char *const cip_path)
Gets the Special Type Logical Type of a Logical Segment EPath message.
Definition: cipepath.c:407
unsigned int GetPathPortSegmentLinkAddressSize(const unsigned char *const cip_path)
Only to be used on Port Segments. Gets the Link Address Size.
Definition: cipepath.c:177
segment_type
Segment type Enum.
Definition: cipepath.h:59
uint32_t CipDword
Definition: typedefs.h:45
enum symbolic_segment_extended_format SymbolicSegmentExtendedFormat
Extended symbolic symbol formats.
void GetElectronicKeyFormat4FromMessage(const CipOctet **const cip_path, ElectronicKeyFormat4 *key)
Gets the data for an Electronic Key of format 4 from the EPath message.
Definition: cipepath.c:441
enum logical_segment_type LogicalSegmentLogicalType
Enum containing values which kind of logical segment is encoded.
unsigned int GetPathPortSegmentExtendedPortNumber(const unsigned char *const cip_path)
Only to be used on Port Segments with Extended Port Number. Gets the Extended Port Number...
Definition: cipepath.c:186
enum logical_segment_special_type_logical_format LogicalSegmentSpecialTypeLogicalFormat