versadac  1
versadac - Scalable Recorder Firmware
eips_struct.h
1 /*
2  * Copyright (c) 2002-2013 by Real Time Automation, Inc.
3  *
4  * This software is copyrighted by and is the sole property of
5  * Real Time Automation, Inc. (RTA). All rights, title, ownership,
6  * or other interests in the software remain the property of RTA.
7  * This software may only be used in accordance with the corresponding
8  * license agreement. Any unauthorized use, duplication, transmission,
9  * distribution, or disclosure of this software is expressly forbidden.
10  *
11  * This Copyright notice MAY NOT be removed or modified without prior
12  * written consent of RTA.
13  *
14  * RTA reserves the right to modify this software without notice.
15  *
16  * Real Time Automation
17  * 150 S. Sunny Slope Road USA 262.439.4999
18  * Suite 130 www.rtaautomation.com
19  * Brookfield, WI 53005 software@rtaautomation.com
20  *
21  *************************************************************************
22  *
23  * Version Date: 18APR2013
24  * Version: 2.33
25  * Conformed To: EtherNet/IP Protocol Conformance Test A-9 (16-NOV-2011)
26  * Module Name: eips_struct.h
27  * Author: Jamin D. Wendorf (jwendorf@rtaautomation.com)
28  * Language: Ansi C
29  * Compile Options: N/A
30  * Compile defines: N/A
31  * Libraries: N/A
32  * Link Options: N/A
33  *
34  * Description.
35  * =======================================================================
36  * This file contains structure definitions.
37  *
38  */
39 
40 #ifndef __EIPS_STRUCT_H__
41 #define __EIPS_STRUCT_H__
42 
43 /* --------------------------------------------------------------- */
44 /* STRUCTURE DEFINITIONS */
45 /* --------------------------------------------------------------- */
46 /* ====================================================================
47 SOCKET STRUCTURES
48 
49 Socket structures are used to simplify TCP/IP processing.
50 ======================================================================= */
51 typedef struct
52 {
53  uint8 sock_type;
54  EIPS_USERSYS_SOCKTYPE sock_id; /* used for TCP */
55  uint32 sock_addr; /* used for UDP */
56  uint16 sock_port; /* used for UDP */
58 
59 /* ====================================================================
60 CONNECTION DATA STRUCTURE
61 
62 The Connection Data structure contains all of the data needed by the
63 connection class to manage a connection. This data isn't needed over
64 the network, therefore not supported by the object model.
65 ======================================================================= */
66 typedef struct
67 {
68 /* 0001 */ uint8 priority_and_tick;
69 /* 0002 */ uint8 connection_time_out_ticks;
70 /* 0006 */ uint32 O2T_CID;
71 /* 0010 */ uint32 T2O_CID;
72 /* 0012 */ uint16 connection_serial_number;
73 /* 0014 */ uint16 vendor_ID;
74 /* 0018 */ uint32 originator_serial_number;
75 /* 0019 */ uint8 connection_timeout_multiplier;
76 /* 0023 */ uint32 O2T_RPI;
77 /* 0025 */ uint16 O2T_cnxn_params; /* name change with lrg_fwd_open to help find all changes */
78 /* 0027 */ uint16 O2T_cnxn_size; /* new field since lrg_fwd_open is 16 bit */
79 /* 0031 */ uint32 T2O_RPI;
80 /* 0033 */ uint16 T2O_cnxn_params; /* name change with lrg_fwd_open to help find all changes */
81 /* 0035 */ uint16 T2O_cnxn_size; /* new field since lrg_fwd_open is 16 bit */
82 /* 0036 */ uint8 xport_type_and_trigger;
83 /* 0037 */ uint8 connection_path_size;
84 /* 0101 */ uint16 connection_path[205]; /* config data needs 400 bytes, plus encoding */
85 /* 0105 */ uint32 O2T_API;
86 /* 0109 */ uint32 T2O_API;
87 
88  /* Connection Variables (not in ForwardOpen) */
89 /* 0110 */ uint8 state;
90 /* 0114 */ uint32 SessionID;
91 /* 0116 */ uint16 O2T_TimerNum;
92 /* 0118 */ uint16 O2T_SeqNum;
93 /* 0120 */ uint16 T2O_TimerNum;
94 /* 0122 */ uint16 T2O_SeqNum;
95 
96 /* 0119 */ uint16 unused_index; /* used to find a connection in the list easier */
98 
99 /* ====================================================================
100  I/O CONNECTION STRUCTURE
101 ======================================================================= */
102 typedef struct
103 {
104  uint8 state; /* used to determine if an instance is used */
105  uint16 index; /* used to find a connection in the list easier */
106 
107 #ifdef EIPS_QOS_USED
108  uint8 dscp_type;
109  uint8 dscp_value;
110 #endif
111 
112  EIPS_CONNECTION_DATA_STRUCT CnxnStruct;
113 
114  /* ***************** */
115  /* Control Variables */
116  /* ***************** */
117  uint8 IO_Type; /* Input Only, Listen Only, Exclusive Owner */
118  uint32 RunIdleInfo;
119 
120  /* **************** */
121  /* O_to_T Variables */
122  /* **************** */
123  uint32 O2T_IPAddr;
124  uint16 O2T_Port;
125  uint32 O2T_SeqNum;
126  uint16 O2T_InstID;
127  uint16 O2T_Size; /* in units (uint8, uint16 or uint32) */
128 
129 #if EIPS_USEROBJ_ASM_ELEMENT_SIZE == 4 /* DWORDS */
130  uint32 * O2T_DataPtr;
131 #elif EIPS_USEROBJ_ASM_ELEMENT_SIZE == 2 /* WORDS */
132  uint16 * O2T_DataPtr;
133 #else /* BYTES */
134  uint8 * O2T_DataPtr;
135 #endif
136 
137  /* **************** */
138  /* T_to_O Variables */
139  /* **************** */
140  uint32 T2O_IPAddr;
141  uint16 T2O_Port;
142  uint32 T2O_SeqNum;
143  uint16 T2O_InstID;
144  uint16 T2O_Size; /* in units (uint8, uint16 or uint32) */
145 
146 #if EIPS_USEROBJ_ASM_ELEMENT_SIZE == 4 /* DWORDS */
147  uint32 * T2O_DataPtr;
148 #elif EIPS_USEROBJ_ASM_ELEMENT_SIZE == 2 /* WORDS */
149  uint16 * T2O_DataPtr;
150 #else /* BYTES */
151  uint8 * T2O_DataPtr;
152 #endif
154 
155 /* ====================================================================
156  SESSION STRUCTURE (CLIENT SPECIFIC DATA)
157 ======================================================================= */
158 typedef struct
159 {
160  uint32 SessionHandle;
161  EIPS_USERSYS_SOCKTYPE sock_id;
162  EIPS_CONNECTION_DATA_STRUCT *CnxnPtrs[EIPS_USER_MAX_NUM_EM_CNXNS_PER_SESSION];
164 
165 /* ====================================================================
166  ENCAPSULATED MESSAGE STRUCTURE (USED FOR ENCAPSULATION PROCESSING)
167 ======================================================================= */
168 typedef struct
169 {
170  /*0x00*/ uint16 Command;
171  /*0x02*/ uint16 Length;
172  /*0x04*/ uint32 SessionHandle;
173  /*0x08*/ uint32 Status;
174  /*0x0C*/ uint8 SenderContext[8];
175  /*0x0D*/ uint32 Options;
176  /* I need a pointer to the rest of the data, this way I don't need to
177  define the pointer when I use this structure as a pointer to overlay
178  over the passed buffer's memory */
179  /*0x11*/ uint8 *EncapsulatedData;
181 
182 typedef struct
183 {
184  uint16 TypeId;
185  uint16 Length;
186  uint8 Data[EIPS_CPF_MAX_ITEM_DATA_LEN];
188 
189 typedef struct
190 {
191  uint8 service; /* 0 - 0x7F */
192  uint8 path_size; /* 0 - EIPS_USER_MSGRTR_PATH_WORDS */
193  uint16 path[EIPS_USER_MSGRTR_PATH_WORDS];
194  uint16 req_data_size; /* 0 - EIPS_USER_MSGRTR_DATA_SIZE */
195  uint8 req_data[EIPS_USER_MSGRTR_DATA_SIZE];
197 
198 typedef struct
199 {
200  uint8 gen_stat; /* 0 = Success; 1-255 = Error */
201  uint8 ext_stat_size; /* 0 - EIPS_USER_MSGRTR_EXTSTAT_SIZE */
202  uint16 ext_stat[EIPS_USER_MSGRTR_EXTSTAT_SIZE];
203  uint16 rsp_data_size; /* 0 - EIPS_USER_MSGRTR_DATA_SIZE */
204  uint8 rsp_data[EIPS_USER_MSGRTR_DATA_SIZE];
206 
207 typedef struct
208 {
209  EIPS_USER_MSGRTR_REQ_FMT user_struct;
211 
212 typedef struct
213 {
214  uint8 service;
215  uint8 reserved;
216  EIPS_USER_MSGRTR_RSP_FMT user_struct;
218 
219 typedef struct
220 {
221  EIPS_USERSYS_SOCKTYPE sock_id; /* needed for I/O Forward Open */
222 
223  uint8 *encap_data; /* local pointer to encap data */
224  int16 bytes_used; /* validate enough data for items */
225  uint32 InterfaceHandle; /* should be 0 */
226  uint16 Timeout; /* Timeout >0 in seconds */
227  uint16 ItemCount; /* store the number of items */
228  uint32 ConnectionID; /* Used with connected messages */
229  uint16 SequenceNumber; /* Used with connected messages */
230  EIPS_ENCAP_MSG_STRUCT *encap; /* Pointer to encapsulated message */
231  EIPS_CPF_ITEMSTRUCT Items[EIPS_CPF_MAX_ITEM_CNT]; /* store the items */
232  EXPLICIT_REQUEST_STRUCT *emreq; /* EM Request Message Pointer */
233  EXPLICIT_RESPONSE_STRUCT *emrsp; /* EM Response Message Pointer */
235 
236 typedef struct
237 {
238 /* 1 Byte */ uint8 SrvCdMsk;
239 /* 1 Byte */ uint8 ClassID;
240 /* 1 Byte */ uint8 InstID;
241 /* 1 Byte */ uint8 AttrID;
242 /* 1 Byte */ uint8 Type;
243 /* 3 Bytew */ void *DataPtr;
244 /* 3 Bytes */ void (*FnPtr) (CPF_MESSAGE_STRUCT *cpf);
245 /* ======== */
246 /* 11 Bytes Total Per Entry */
248 
249 /* ====================================================================
250 0x01 IDENTITY OBJECT ATTRIBUTES
251 
252 The Identity Attributes structure contains the list of Identity
253 attributes. It is used to make these attibutes global to the system.
254 ======================================================================= */
255 #define EIPS_STRUCT_MAX_PROD_NAME_SIZE 32
256 typedef struct
257 {
258  struct
259  {
260 /* ATTR 01 */ uint16 ClassRev;
261  }Class;
262 
263  struct
264  {
265 /* ATTR 01 */ uint16 Vendor;
266 /* ATTR 02 */ uint16 DeviceType;
267 /* ATTR 03 */ uint16 ProductCode;
268 /* ATTR 04 */ uint16 Revision;
269 /* ATTR 05 */ uint16 Status;
270 /* ATTR 06 */ uint32 SerialNum;
271 /* ATTR 07 */ uint8 ProductName[32]; /* user defined */
272  uint8 SizOfName; /* user defined */
273 /* ATTR 08 */ uint8 State;
274  }Inst;
276 
277 /* ====================================================================
278 0x04 ASSEMBLY OBJECT ATTRIBUTES
279 
280 The Assembly Attributes structure contains the list of Assembly
281 Instances and sizes.
282 ======================================================================= */
283 typedef struct
284 {
285  uint16 Inst; /* Instance ID */
286  uint8 RunIdle32Used; /* set to TRUE if the RUN/IDLE Header is used */
287  uint16 DataSize; /* in units (uint8, uint16, or uint32) */
288  uint8 Owned; /* Outputs are owned */
289 
290 #if EIPS_USEROBJ_ASM_ELEMENT_SIZE == 4 /* DWORDS */
291  uint32 * DataPtr;
292 #elif EIPS_USEROBJ_ASM_ELEMENT_SIZE == 2 /* WORDS */
293  uint16 * DataPtr;
294 #else /* BYTES */
295  uint8 * DataPtr;
296 #endif
298 
299 /* ====================================================================
300 0x48 QoS OBJECT ATTRIBUTES
301 
302 The QoS Attributes structure contains the list of QoS Attributes.
303 It is used to make these attibutes global to the system.
304 ======================================================================= */
305 #ifdef EIPS_QOS_USED
306 #define EIPS_QOS_DFLT_DSCP_URGENT 55
307 #define EIPS_QOS_DFLT_DSCP_SCHEDULED 47
308 #define EIPS_QOS_DFLT_DSCP_HIGH 43
309 #define EIPS_QOS_DFLT_DSCP_LOW 31
310 #define EIPS_QOS_DFLT_DSCP_EXPLICIT 27
311 
312 #define EIPS_QOS_DSCP_TYPE_NOTUSED 0 /* don't mark the DSCP field */
313 #define EIPS_QOS_DSCP_TYPE_URGENT 1
314 #define EIPS_QOS_DSCP_TYPE_SCHEDULED 2
315 #define EIPS_QOS_DSCP_TYPE_HIGH 3
316 #define EIPS_QOS_DSCP_TYPE_LOW 4
317 #define EIPS_QOS_DSCP_TYPE_EXPLICIT 5
318 typedef struct
319 {
320  struct
321  {
322 /* ATTR 01 */ uint16 ClassRev;
323  }Class;
324 
325  struct
326  {
327 /* ATTR 04 */ uint8 DSCP_Urgent;
328 /* ATTR 05 */ uint8 DSCP_Scheduled;
329 /* ATTR 06 */ uint8 DSCP_High;
330 /* ATTR 07 */ uint8 DSCP_Low;
331 /* ATTR 08 */ uint8 DSCP_Explicit;
332  }Inst;
333 }EIPS_QOS_OBJ_STRUCT;
334 #endif
335 
336 /* ====================================================================
337 0xF5 TCP/IP INTERFACE OBJECT ATTRIBUTES
338 
339 The TCP/IP Interface Attributes structure contains the list of TCP/IP
340 Interface Attributes. It is used to make these attibutes global to the
341 system.
342 ======================================================================= */
343 typedef struct
344 {
345  uint16 Bufsiz;
346  uint8 Buf[64];
348 
349 typedef struct
350 {
351  uint16 PathSiz;
352  uint8 Path[12];
354 
355 typedef struct
356 {
357  uint32 IPAddress;
358  uint32 NtwkMask;
359  uint32 GtwyIPAddress;
360  uint32 NameServer;
361  uint32 NameServer2;
362  EIPS_TCPOBJ_BUF_STRUCT DomainName;
364 
365 typedef struct
366 {
367  uint8 alloc_ctrl;
368  uint16 num_mcast;
369  uint32 mcast_start_addr;
371 
372 typedef struct
373 {
374  uint8 acd_activity;
375  uint8 remote_mac[6];
376  uint8 arp_pdu28[28];
378 
379 typedef struct
380 {
381  struct
382  {
383  uint16 ClassRev;
384  }Class;
385 
386 /* pass all instance values from the user */
388 
389 /* ====================================================================
390 0xF6 ETHERNET LINK OBJECT ATTRIBUTES
391 
392 The Ethernet Link Attributes structure contains the list of Ethernet
393 Link Attributes. It is used to make these attibutes global to the
394 system.
395 ======================================================================= */
396 typedef struct
397 {
398  uint32 InOctets;
399  uint32 InUcastPackets;
400  uint32 InNUcastPackets;
401  uint32 InDiscards;
402  uint32 InErrors;
403  uint32 InUnknownProtos;
404  uint32 OutOctets;
405  uint32 OutUcastPackets;
406  uint32 OutNUcastPackets;
407  uint32 OutDiscards;
408  uint32 OutErrors;
410 
411 typedef struct
412 {
413  uint32 AlignmentErrors;
414  uint32 FCSErrors;
415  uint32 SingleCollisions;
416  uint32 MultipleCollisions;
417  uint32 SQETestErrors;
418  uint32 DeferredTransmissions;
419  uint32 LateCollisions;
420  uint32 ExcessiveCollisions;
421  uint32 MACTransmitErrors;
422  uint32 CarrierSenseErrors;
423  uint32 FrameTooLarge;
424  uint32 MACReceiveErrors;
426 
427 typedef struct
428 {
429  uint16 ControlBits;
430  uint16 ForcedInterfaceSpeed;
432 
433 typedef struct
434 {
435  struct
436  {
437 /* ATTR 01 */ uint16 ClassRev;
438  }Class;
439 
440 #if 0 /* pass all values from the user */
441  struct
442  {
443 /* ATTR 01 */ uint32 InterfaceSpeed;
444 /* ATTR 02 */ uint32 InterfaceFlags;
445 /* ATTR 03 */ uint8 PhysicalAddress[6];
446 /* ATTR 04 */ EIPS_ELINKOBJ_INTFCNTS_STRUCT InterfaceCnts;
447 /* ATTR 05 */ EIPS_ELINKOBJ_MEDIACNTS_STRUCT MediaCnts;
448 /* ATTR 06 */ EIPS_ELINKOBJ_INTFCTRL_STRUCT InterfaceControl;
449  }Inst;
450 #endif
452 
453 #ifdef EIPS_TACL_OBJ_USED
454 
455 /* TaCL Connection Point groupings */
456 typedef struct
457 {
458  uint8 o2t_inst;
459  uint8 t2o_inst;
460  uint8 cfg_inst;
461  char name[33];
462 }EIPS_TACL_GROUPING_STRUCT;
463 
464 /* instance types */
465 #define EIPS_TACL_OBJ_INST_TYPE_EXOWNER 1
466 #define EIPS_TACL_OBJ_INST_TYPE_INONLY 2
467 #define EIPS_TACL_OBJ_INST_TYPE_LISTENONLY 3
468 #define EIPS_TACL_OBJ_INST_TYPE_OUTONLY 4
469 #define EIPS_TACL_OBJ_INST_TYPE_DATAEXCHANGE 5
470 
471 /* number of instances */
472 #define EIPS_TACL_OBJ_MAX_NUM_INST (EIPS_TACL_OBJ_MAX_NUM_EXOWNER_CNXNS + \
473  EIPS_TACL_OBJ_MAX_NUM_INONLY_CNXNS + \
474  EIPS_TACL_OBJ_MAX_NUM_LISTENONLY_CNXNS + \
475  EIPS_TACL_OBJ_MAX_NUM_DATAEXCHANGE_CNXNS + \
476  EIPS_TACL_OBJ_MAX_NUM_OUTONLY_CNXNS)
477 /* Class/Instance structure */
478 typedef struct
479 {
480  struct
481  {
482 /* ATTR 01 */ uint16 ClassRev;
483 /* ATTR 02 */ uint16 MaxInst;
484  }ClassLevel;
485 
486  struct
487  {
488 /* ATTR 01 */
489 
490  /* not addressable */
491  uint16 InstID;
492  uint8 InstType;
493  }InstLevel[EIPS_TACL_OBJ_MAX_NUM_INST];
494 
495  /* grouping of o2t, t2o and config instance */
496  EIPS_TACL_GROUPING_STRUCT group[EIPS_TACL_OBJ_MAX_NUM_INST];
497 }EIPS_TACL_OBJ_STRUCT;
498 #endif
499 
500 /* ====================================================================
501  TIMER STRUCTURE (count down)
502 ======================================================================= */
503 typedef struct
504 {
505  uint32 current_value;
506  uint32 reload_value;
507  uint16 *timeout_flag_ptr;
508  void *custom_func_arg;
509 
510  /* standard timeout function, passes just the timer id */
511  void (*timeout_func_ptr) (uint16 timer_id);
512  /* allow the user to pass a function specific data set (like the struct that had the timer) */
513  void (*tmo_custom_func_ptr) (uint16 timer_id, void *ptr);
514 
515 #ifdef EIPS_TIMER_NAME_USED
516  char timer_name[32];
517 #endif
519 
520 typedef struct
521 {
522  uint8 state;
523  uint8 owned;
524  EIPS_TIMER_DATA_STRUCT timer_data;
526 
527 #ifdef EIPS_PCCC_USED
528 #define EIPS_PCCC_MAX_STRING_LEN 82
529 typedef struct
530 {
531  uint16 string_size;
532  uint8 string_data[EIPS_PCCC_MAX_STRING_LEN];
533 }EIPS_PCCC_STRING_TYPE;
534 #endif
535 
536 #endif /* __EIPS_STRUCT_H__ */
Definition: eips_struct.h:51
Definition: eips_struct.h:158
Definition: eips_struct.h:365
Definition: eips_struct.h:503
Definition: eips_struct.h:343
Definition: eips_struct.h:520
Definition: eips_struct.h:396
Definition: eips_struct.h:411
Definition: eips_struct.h:102
Definition: eips_struct.h:212
Definition: eips_struct.h:433
Definition: eips_struct.h:372
Definition: eips_struct.h:236
Definition: eips_struct.h:355
Definition: eips_struct.h:349
Definition: eips_struct.h:66
Definition: eips_struct.h:219
Definition: eips_struct.h:189
Definition: eips_struct.h:379
Definition: eips_struct.h:283
Definition: eips_struct.h:168
Definition: eips_struct.h:182
Definition: eips_struct.h:427
Definition: eips_struct.h:198
Definition: eips_struct.h:207
Definition: eips_struct.h:256