1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /********************************************************************20**
21 Name: Common transport file
25 Desc: Common file for transport related data structures
29 *********************************************************************21*/
47 #endif /* _cplusplus */
49 #ifdef __CMINETX__ /* Put cm_inet dependencies here */
51 typedef CmInetIpv4Addr CmIpv4TptAddr;
52 typedef CmInetIpAddr CmIpv4NetAddr;
54 #ifndef IPV6_SUPPORTED
55 typedef U8 CmInetIpAddr6[16]; /* 16 byte IPV6 address */
58 typedef struct cmInetIpv6Addr
61 CmInetIpAddr6 ipv6NetAddr;
63 #endif /* IPV6_SUPPORTED */
65 /* IPV6 Network address */
66 typedef CmInetIpv6Addr CmIpv6TptAddr;
67 typedef CmInetIpAddr6 CmIpv6NetAddr;
69 #endif /* __CMINETX__ */
72 typedef struct cmNetAddr
74 U8 type; /* type of network address */
77 CmIpv4NetAddr ipv4NetAddr; /* IP network address */
78 CmIpv6NetAddr ipv6NetAddr; /* IPv6 network address */
82 /* list of addresses */
83 typedef struct _cmNetAddrTbl
85 U16 count; /* Number of Table Entries */
86 CmNetAddr netAddr[CM_MAX_NET_ADDR]; /* IPV4/IPV6 addresses */
89 /* Added new structure for Local Interface */
91 /* used to pass local interface (on which packet was received) to upper user */
92 typedef struct cmTptLocalInf
94 Bool intfPrsnt; /* valid intf is present or not */
95 U32 localIf; /* interface index IPv4(32 bit) or IPv6(32 bit) */
96 CmNetAddr localIfAddr; /* interface address */
98 #endif /* LOCAL_INTF */
101 /* Multicast information */
102 typedef struct cmNetMCastInf
104 CmNetAddr mCastAddr; /* Multicast adddress */
105 CmNetAddr localAddr; /* Local address */
108 #ifdef IPV6_SUPPORTED
109 typedef CmInetMCastInf6 CmNetMCastInf6;
110 #endif /* IPV6_SUPPORTED */
111 #endif /* CM_INET2 */
113 /* Transport address */
114 typedef struct cmTptAddr
116 U8 type; /* type of transport address */
119 CmIpv4TptAddr ipv4TptAddr; /* IP transport address */
120 CmIpv6TptAddr ipv6TptAddr; /* IPv6 transport address */
122 AtmVccId aalTptAddr; /* AAL transport address */
127 /*cm_tpt_x_001.main_12 Updated for TUCL 2.1 Release (Kernel SCTP Support) */
129 /* Array of Transport Addresses */
130 typedef struct cmTptAddrLst
132 U8 nmb; /* Number of Network Addresses */
133 CmTptAddr tptAddr[CM_MAX_NET_ADDR]; /* List of Network Addresses */
136 typedef CmInetSockLinger CmSockLinger;
137 typedef CmInetSctpSockEvent CmSctpEvent;
138 typedef CmInetSctpPeerAddrParams CmSctpPeerAddrParams;
139 typedef CmInetSctpPrimAddr CmSctpPrimAddr;
140 typedef CmInetSctpPeerAddrInfo CmSctpPeerAddrInfo;
141 typedef CmInetSctpStatus CmSctpStatus;
142 typedef CmInetSctpRtoInfo CmSctpRtoInfo;
143 typedef CmInetSctpInitMsg CmSctpInitMsg;
144 typedef CmInetSctpAssocParams CmSctpAssocParams;
148 typedef struct cmSockOpts
150 U32 level; /* option level */
151 U32 option; /* option name */
152 union /* option parameters */
155 #ifdef IPV6_SUPPORTED
156 CmNetMCastInf6 mCastInfo6; /* IPV6 multicast information */
157 U32 infId; /* IPV6 multicast outgoing interface */
158 #endif /* IPV6_SUPPORTED */
159 CmNetMCastInf mCastInfo; /* multicast information */
161 CmNetAddr mCastAddr; /* multicast information */
162 #endif /* CM_INET2 */
163 CmNetAddr lclAddr; /* local outgoing interface */
164 U32 value; /* option value */
165 /*cm_tpt_x_001.main_12 Updated for TUCL 2.1 Release (Kernel SCTP Support) */
167 CmSockLinger sockLinger;
168 CmSctpEvent sctpEvent;
169 CmSctpPeerAddrParams sctpPeerAddrParams;
170 CmSctpPrimAddr sctpPrimAddr;
171 CmSctpPeerAddrInfo sctpPeerAddrInfo;
172 CmSctpStatus sctpStatus;
173 /*cm_tpt_x_001.main_13 Updated for the support of configurable RTO parameters,
174 HBeat value Max retransmissions (Init, Path, Association)*/
175 CmSctpRtoInfo sctpRtoInfo;
176 CmSctpInitMsg sctpInitMsg;
177 CmSctpAssocParams sctpPeerAssocParams;
182 /* socket parameters */
183 typedef struct cmSockParam
185 U8 listenQSize; /* listen queue size */
186 U8 numOpts; /* number of socket options */
187 CmSockOpts sockOpts[CM_MAX_SOCK_OPTS]; /* socket options */
191 typedef struct tlsTptParam
196 CmSockOpts sockOpts[CM_MAX_SOCK_OPTS];
201 /*cm_tpt_x_001.main_12 Updated for TUCL 2.1 Release (Kernel SCTP Support) */
203 typedef struct sctpSockParam
205 U8 numOpts; /* number of socket options */
206 CmSockOpts sockOpts[CM_MAX_SOCK_OPTS]; /* socket options */
210 /* Transport parameters */
211 typedef struct cmTptParam
213 U8 type; /* type of transport parameters */
217 CmSockParam sockParam; /* socket parameters */
219 AalConParam aalParam; /* AAL connection parameters */
222 TlsTptParam tlsParam; /* TLS parameters */
224 /*cm_tpt_x_001.main_12 Updated for TUCL 2.1 Release (Kernel SCTP Support) */
226 SctpSockParam sctpParam; /* LKSCTP parameters */
233 /* IPv4 header parameters */
234 typedef struct cmIpv4HdrParm
236 TknU8 proto; /* Protocol value */
237 TknU8 dfBit; /* Don't fragment flag */
238 TknU8 tos; /* Type of Service */
239 TknU8 ttl; /* Time to Live */
240 /* added new field */
241 #ifdef IPV4_OPTS_SUPPORTED
242 TknStr64 ipv4HdrOpt; /* IPV4 hdr opt */
243 #endif /* IPV4_OPTS_SUPPORTED */
246 #ifdef IPV6_SUPPORTED
247 /* added new structures for IPv6 ext hdr support */
248 #ifdef IPV6_OPTS_SUPPORTED
249 /* structure to hold TLV of each HBH option */
250 typedef struct cmIpv6HBHHdr
257 /* structure to hold TLV of each Destination option */
258 typedef struct cmIpv6DestOptsHdr
265 /* structure to hold IPV6 addresses of the Route header */
266 typedef struct cmIpv6RtHdr
270 CmIpv6NetAddr *ipv6Addrs;
273 /* array of all HBH options */
274 typedef struct cmIpv6HBHHdrArr
277 CmIpv6HBHHdr *hbhOpts;
280 /* array of all Destination options */
281 typedef struct cmIpv6DestOptsArr
284 CmIpv6DestOptsHdr *destOpts;
287 /* structure having 3 substructures for 3 types of ext headers */
288 typedef struct cmIpv6ExtHdr
291 CmIpv6HBHHdrArr hbhOptsArr;
294 CmIpv6DestOptsArr destOptsArr;
299 #endif /* IPV6_OPTS_SUPPORTED */
301 /* IPV6 header parameters */
302 typedef struct cmIpv6HdrParm
304 TknU8 ttl; /* Set the hop limit */
306 /* added new field */
307 CmNetAddr srcAddr6; /* src addr to set on send pkt(IPv6) */
309 /* added new field */
310 #ifdef IPV6_OPTS_SUPPORTED
311 CmIpv6ExtHdr ipv6ExtHdr;
312 #endif /* IPV6_OPTS_SUPPORTED */
314 #endif /* IPV6_SUPPORTED */
316 /* IP header paramters */
317 typedef struct cmIpHdrParm
319 U8 type; /* Type of IP header parameters */
322 CmIpv4HdrParm hdrParmIpv4; /* IPv4 header parameters */
323 #ifdef IPV6_SUPPORTED
324 CmIpv6HdrParm hdrParmIpv6; /* IPv6 header parameters */
325 #endif /* IPV6_SUPPORTED */
331 typedef struct cmIpv4Hdr
333 U8 hdrVer; /* Header and Version */
334 U8 tos; /* Type Of Service */
335 S16 length; /* Total length */
336 U16 id; /* Identification */
337 S16 off; /* Flags and Offset */
338 U8 ttl; /* Time to Live */
339 U8 proto; /* Protocol */
340 U16 chkSum; /* Checksum */
341 U32 srcAddr; /* Source Address */
342 U32 destAddr; /* Destination Address */
346 #ifdef IPV6_SUPPORTED
348 typedef struct cmIpv6Hdr
361 CmIpv6NetAddr ip6_src;
362 CmIpv6NetAddr ip6_dst;
364 #endif /* IPV6_SUPPORTED */
366 typedef struct cmIcmpError
368 U8 errType; /* ICMP Error Type */
369 U32 errCodeMask; /* ICMP Error Code Mask */
373 /* ICMP v4 filter parameters */
374 typedef struct cmIcmpv4Filter
376 U8 icmpMsgFlag; /* Flag to listen to any ICMP msgs */
377 U8 allMsg; /* Flag to listen to ICMP messages */
378 U8 protocol; /* ICMP packets with protocol only */
379 U8 num; /* Number of valid type - code
380 * combinations in the error array */
381 CmIcmpError icmpError[CM_MAX_ICMP_ERROR]; /* Error type & Code array */
385 #ifdef IPV6_SUPPORTED
386 typedef struct cmIcmpv6Filter
388 U8 icmpMsgFlag; /* Flag to listen to any ICMP msgs */
389 U8 allMsg; /* Flag to listen to all ICMP messages */
390 U8 num; /* Number of valid type - code
391 * combinations in the error array */
392 CmIcmpError icmpError[CM_MAX_ICMP_ERROR]; /* Error type & Code array */
395 #endif /* IPV6_SUPPORTED */
397 /* ICMP filter paramters */
398 typedef struct cmIcmpFilter
400 U8 type; /* ICMP version */
403 CmIcmpv4Filter icmpv4Filter; /* ICMPv4 filter structure */
404 #ifdef IPV6_SUPPORTED
405 CmIcmpv6Filter icmpv6Filter; /* ICMPv6 filter structure */
406 #endif /* IPV6_SUPPORTED */
412 typedef struct cmIcmpv4Hdr
414 U8 icmpType; /* Type of message */
415 U8 icmpCode; /* Message code */
416 U16 chkSum; /* Ones complement cksum of struct */
420 U8 ihPptr; /* ICMP parameter problem */
421 U32 rdrctAddr; /* ICMP redirect address */
424 S16 icdId; /* Identifier */
425 S16 icdSeq; /* Sequence Number */
434 U32 itOtime; /* Original time stamp */
435 U32 itRtime; /* Received time stamp */
436 U32 itTtime; /* Transmit time stamp */
438 CmIpv4Hdr icmpIpHdr; /* IP header */
444 #ifdef IPV6_SUPPORTED
445 typedef struct cmIcmpv6Hdr
447 U8 icmp6_type; /* type field */
448 U8 icmp6_code; /* code field */
449 U16 icmp6_cksum; /* checksum field */
453 U32 icmp6_un_data32[1]; /* type-specific field */
454 U16 icmp6_un_data16[2]; /* type-specific field */
455 U8 icmp6_un_data8[4]; /* type-specific field */
458 #endif /* IPV6_SUPPORTED */
460 #endif /* CM_INET2 */
462 /* packing/unpacking function prototypes */
463 /* Added packing and unpacking function prototypes */
464 EXTERN S16 cmPkCmIpv4TptAddr ARGS((CmIpv4TptAddr *pkParam, Buffer *mBuf));
465 EXTERN S16 cmPkCmNetAddrTbl ARGS((CmNetAddrTbl *pkParam, Buffer *mBuf));
466 EXTERN S16 cmPkCmNetAddr ARGS((CmNetAddr *pkParam, Buffer *mBuf));
467 EXTERN S16 cmPkCmTptAddr ARGS((CmTptAddr *pkParam, Buffer *mBuf));
468 #ifdef IPV6_SUPPORTED
469 EXTERN S16 cmPkCmNetMCastInf6 ARGS((CmNetMCastInf6 *pkParam, Buffer *mBuf));
470 #endif /* IPV6_SUPPORTED */
471 EXTERN S16 cmPkCmTptParam ARGS((CmTptParam *pkParam, Buffer *mBuf));
472 EXTERN S16 cmUnpkCmNetAddrTbl ARGS((CmNetAddrTbl *unpkParam, Buffer *mBuf));
473 EXTERN S16 cmUnpkCmIpv4TptAddr ARGS((CmIpv4TptAddr *unpkParam, Buffer *mBuf));
474 EXTERN S16 cmUnpkCmNetAddr ARGS((CmNetAddr *unpkParam, Buffer *mBuf));
475 EXTERN S16 cmUnpkCmTptAddr ARGS((CmTptAddr *unpkParam, Buffer *mBuf));
476 #ifdef IPV6_SUPPORTED
477 EXTERN S16 cmUnpkCmNetMCastInf6 ARGS((CmNetMCastInf6 *unpkParam, Buffer *mBuf));
478 #endif /* IPV6_SUPPORTED */
480 EXTERN S16 cmUnpkCmTptParam ARGS((CmTptParam *unpkParam, Buffer *mBuf));
483 EXTERN S16 cmPkCmIpHdrParm ARGS((CmIpHdrParm *pkParam, Buffer *mBuf));
485 /* changed to include meminfo required to hold IPv6
487 #ifdef IPV6_OPTS_SUPPORTED
488 EXTERN S16 cmUnpkCmIpHdrParm ARGS((CmIpHdrParm *unpkParam, Buffer *mBuf,
491 EXTERN S16 cmUnpkCmIpHdrParm ARGS((CmIpHdrParm *unpkParam, Buffer *mBuf));
494 /* added new packing/unpacking function */
496 EXTERN S16 cmPkCmTptLocalInf ARGS((CmTptLocalInf *pkParam, Buffer *mBuf));
497 EXTERN S16 cmUnpkCmTptLocalInf ARGS((CmTptLocalInf *unpkParam, Buffer *mBuf));
498 #endif /* LOCAL_INTF */
500 EXTERN S16 cmPkCmIcmpFilter ARGS((CmIcmpFilter *pkParam, Buffer *mBuf));
501 EXTERN S16 cmUnpkCmIcmpFilter ARGS((CmIcmpFilter *unpkParam, Buffer *mBuf));
503 /* added new packing/unpacking functions */
504 #ifdef IPV6_OPTS_SUPPORTED
505 EXTERN S16 cmPkCmIpv6ExtHdr ARGS((CmIpv6ExtHdr *pkParam, Buffer *mBuf));
506 EXTERN S16 cmPkCmIpv6RtHdr ARGS((CmIpv6RtHdr *pkParam, Buffer *mBuf));
507 EXTERN S16 cmUnpkCmIpv6RtHdr ARGS((CmIpv6RtHdr *unpkParam, Buffer *mBuf,
509 EXTERN S16 cmUnpkCmIpv6ExtHdr ARGS((CmIpv6ExtHdr *unpkParam, Buffer *mBuf,
511 EXTERN S16 cmPkCmIpv6DestOptsArr ARGS((CmIpv6DestOptsArr *pkParam,
513 EXTERN S16 cmPkCmIpv6DestOptsHdr ARGS((CmIpv6DestOptsHdr *pkParam,
515 EXTERN S16 cmUnpkCmIpv6DestOptsHdr ARGS((CmIpv6DestOptsHdr *unpkParam,
516 Buffer *mBuf, Mem *memInfo));
517 EXTERN S16 cmUnpkCmIpv6DestOptsArr ARGS((CmIpv6DestOptsArr *unpkParam,
518 Buffer *mBuf, Mem *memInfo));
519 EXTERN S16 cmPkCmIpv6HBHHdrArr ARGS((CmIpv6HBHHdrArr *pkParam, Buffer *mBuf));
520 EXTERN S16 cmPkCmIpv6HBHHdr ARGS((CmIpv6HBHHdr *pkParam, Buffer *mBuf));
521 EXTERN S16 cmUnpkCmIpv6HBHHdr ARGS((CmIpv6HBHHdr *unpkParam, Buffer *mBuf,
523 EXTERN S16 cmUnpkCmIpv6HBHHdrArr ARGS((CmIpv6HBHHdrArr *unpkParam,
524 Buffer *mBuf, Mem *memInfo));
525 #endif /* IPV6_OPTS_SUPPORTED */
526 #endif /* CM_INET2 */
532 #endif /* __CMTPTX__ */
534 /********************************************************************30**
536 *********************************************************************31*/