Adding new commiter to ODU-High repo
[o-du/l2.git] / src / cm / cm_inet.x
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 *******************************************************************************/
18
19 /********************************************************************20**
20   
21         Name:     common Internet socket library
22     
23         Type:     header file 
24   
25         Desc:     common library for Internet sockets
26                     
27         File:     cm_inet.x
28   
29 *********************************************************************21*/
30  
31 \f
32 /*
33  *      This software may be combined with the following TRILLIUM
34  *      software:
35  *
36  *      part no.                      description
37  *      --------    ----------------------------------------------
38  *      1000151     TCAP over TCP/IP   
39  */
40
41 /* cm_inet_x_001.main_29: SS_4GMX_LCORE changes */
42 #ifdef SS_4GMX_LCORE
43 #define __CMINETX__ 1
44 #endif
45 #ifndef __CMINETX__
46 #define __CMINETX__
47
48 #ifdef __cplusplus
49 extern "C" {
50 #endif /* __cplusplus */
51
52 #ifdef WIN32
53 #ifdef SS_WINCE
54 #ifndef IN
55 #define IN
56 #include <winsock2.h>
57 #undef IN
58 #else /*IN*/
59 #include <winsock2.h>
60 #endif /*IN*/
61 #else  /*SS_WINCE*/
62    /* cm_inet_x_001.main_28: Added #define IN */
63 #ifndef IN
64 #define IN
65 #include <winsock2.h>
66 #undef IN
67 #else /*IN*/
68 #include <winsock2.h>
69 #endif /*IN*/
70 #endif /* SS_WINCE */
71 #else
72 #include <string.h>
73 #ifdef SS_LINUX
74 #include <sys/select.h>
75 #include <sys/poll.h>
76 #endif /* SS_LINUX */
77 #include <sys/types.h>
78 #ifdef SS_PS
79 #include <pna.h>
80 #else
81 #include <sys/socket.h>
82 #include <netinet/in.h>
83 #endif /* SS_PS */
84 #endif /* WIN32 */
85
86 #ifdef IPV6_SUPPORTED
87 #if (defined(SUNOS) || defined(HPOS)) 
88 #include <netinet/icmp6.h>
89 #endif /* SUNOS || HPOS */
90 #endif /* IPV6_SUPPORTED */
91
92  /* cm_inet_x_001.main_27 : Added header file inclusion */
93 #if (defined(SS_VW) && defined(SS_VW6_7)) 
94 #include <ipcom_inet.h>
95 #include <ipcom_sock6.h>
96 #include <netinet/icmp6.h>
97 #endif
98
99 /* cm_inet_x_001.main_21:Added wrapper function for getaddrinfo and freeaddrinfo */
100 #if (!defined(SS_VW) && !defined(SS_PS) && !defined(WIN32))
101 #include <netdb.h>
102 #endif
103
104 /* Redifining the CmInetIpAddr &  CmInetIpAddr6 */
105 typedef CmIpAddr CmInetIpAddr;        /* 4 byte IP address */
106 #ifdef IPV6_SUPPORTED
107 typedef CmIpAddr6 CmInetIpAddr6;   /* 16 byte IPV6 address */
108 #endif /* IPV6_SUPPORTED */
109
110 typedef struct cmInetIpAddrTbl
111 {
112    uint16_t             count;           /* Number of addresses in table */
113    CmInetIpAddr    netAddr[CM_INET_IPV4_NUM_ADDR];  /* Address table */
114 }CmInetIpAddrTbl;
115
116 typedef CmInetIpAddrTbl CmInetIpv4AddrArr;
117
118 #ifdef IPV6_SUPPORTED
119 typedef struct cmInetIpv6AddrArr
120 {
121    uint16_t             count;           /* Number of addresses in array */
122    CmInetIpAddr6   netAddr[CM_INET_IPV6_NUM_ADDR];  /* Address array */
123 }CmInetIpv6AddrArr;
124 #endif /* IPV6_SUPPORTED */
125
126 typedef struct cmInetIpAddrArr
127 {
128    uint8_t       type;
129    union
130    {
131       CmInetIpv4AddrArr   ipv4AddrArr;   
132 #ifdef IPV6_SUPPORTED
133       CmInetIpv6AddrArr   ipv6AddrArr;   
134 #endif /* IPV6_SUPPORTED */
135    } u;
136
137 } CmInetIpAddrArr;
138
139
140 /* Adding a type for socket Address */
141 typedef struct cmInetCmnSockAddr
142 {
143    uint32_t type;
144    uint32_t len;
145    union
146    {
147       struct sockaddr_in addr;
148 #ifdef IPV6_SUPPORTED
149       struct sockaddr_in6 addr6;
150 #endif
151    }u;
152 }CmInetCmnSockAddr;
153
154
155
156 /* Adding a type for socket descriptors */
157 #ifdef WIN32
158 typedef SOCKET CmInetFdType;
159 #else
160 #if (defined(SUNOS) || defined(HPOS)) 
161 typedef S32 CmInetFdType;
162 #else
163 #ifdef SS_LINUX
164 typedef S32 CmInetFdType;
165 #else
166 typedef S16 CmInetFdType;
167 #endif /* SS_LINUX */
168 #endif /* SUNOS || HPOS */
169 #endif /* WIN32 */
170 /* cm_inet_x_001.main_29 Poll Implementation Changes */
171 typedef struct pollfd CmInetPollFd;
172
173 typedef struct cmInetFd          /* trillium socket file descriptor */
174 {
175    CmInetFdType fd;              /* socket descriptor */
176    uint8_t     blocking;              /* true if socket is blocking */
177    uint8_t     type;                  /* socket type (stream|datagram) */
178
179 #ifdef IPV6_SUPPORTED
180    uint8_t     protType;              /* indicates whether IPv4 or IPv6 socket */
181 #endif /* IPV6_SUPPORTED */  
182 }CmInetFd;
183
184 typedef fd_set CmInetFdSet;      /* socket file descriptor set */
185
186 #ifdef IPV6_SUPPORTED 
187 /* IPV4 Address */
188 typedef struct cmInetIpv4Addr
189 {
190    uint16_t             port;
191    CmInetIpAddr    address;
192 } CmInetIpv4Addr;
193
194 /* IPV6 Address */
195 typedef struct cmInetIpv6Addr
196 {
197    uint16_t             port;
198    CmInetIpAddr6   ipv6NetAddr;
199 } CmInetIpv6Addr;
200
201 typedef struct CmInetAddr        /* Internet address */
202 {
203    uint8_t           type;            /* type of address present in the union */
204    union
205    {
206       CmInetIpv4Addr    ipv4Addr;   /* IPV4 Address */
207       CmInetIpv6Addr    ipv6Addr;   /* IPV6 Address */
208    }u;
209 }CmInetAddr;
210
211 typedef struct cmInetMCastInf6   /* multicast interface information */
212 {
213    CmInetIpAddr6 mCastAddr;      /* multicast address */
214    uint32_t           localInf;       /* local interface */
215 } CmInetMCastInf6;
216 #else
217 /* IPV4 Address */
218 typedef struct cmInetAddr1    
219 {
220    uint16_t             port;
221    CmInetIpAddr    address;
222 } CmInetAddr;
223 typedef CmInetAddr CmInetIpv4Addr; 
224 #endif /* IPV6_SUPPORTED */
225
226 typedef struct cmInetMemInfo     /* memory information */
227 {
228    Region   region;              /* memory region */
229    Pool     pool;                /* memory pool */
230 } CmInetMemInfo;
231
232 typedef struct cmInetMCastInf    /* multicast information */
233 {
234    CmInetIpAddr  mCastAddr;      /* multicast class D address */
235    CmInetIpAddr  localAddr;      /* local interface address */
236 }CmInetMCastInf;
237
238 /* this is the same structure as cmNetAddr in cm_tpt.x
239    used here for cmInetConvertStrToIpAddr */
240 typedef struct cmInetNetAddr
241 {
242    uint8_t   type;      /* type of network address */
243    union
244    {
245       CmInetIpAddr   ipv4NetAddr; /* IP network address */
246 #ifdef IPV6_SUPPORTED
247       CmInetIpAddr6  ipv6NetAddr; /* IPv6 network address */
248 #endif /* IPV6_SUPPORTED */
249    }u;
250 } CmInetNetAddr;
251
252 /*cm_inet_x_001.main_23 Updated for TUCL 2.1 Release (Kernel SCTP Support) */
253 #ifdef CM_LKSCTP
254 typedef struct cmInetNetAddrLst
255 {
256    uint8_t   count;
257    CmInetNetAddr   addrs[CM_INET_NUM_NET_ADDR];
258 } CmInetNetAddrLst;
259 #endif
260
261 #ifdef LOCAL_INTF
262 /* used to pass local interface (on which packet was received) to upper user */
263 typedef struct cmInetLocalInf
264 {
265    Bool          intfPrsnt;   /* bool to indicate if this is a valid loc intf */
266    uint32_t           localIf;     /* interface index IPv4(32 bit) or IPv6(32 bit) */
267    CmInetNetAddr localIfAddr; /* interface address */
268 }CmInetLocalInf;
269 #endif /* LOCAL_INTF */
270
271 #ifdef IPV6_SUPPORTED
272 #if (defined(SUNOS) || defined(HPOS) || defined(SS_VW))
273 typedef struct icmp6_filter CmInetIcmp6Filter;
274 #endif /* SUNOS || HPOS */
275 #endif /* IPV6_SUPPORTED */
276
277 /* New data structures needed to support 3 types of IPV6 extension 
278  * headers - HBH, Destination Option & Route Header */
279 #ifdef IPV6_SUPPORTED
280 #ifdef IPV6_OPTS_SUPPORTED
281
282 /* structure to hold TLV of each HBH option */ 
283 typedef struct cmInetIpv6HBHHdr
284 {
285    uint8_t type;
286    uint8_t length;
287    uint8_t *value;
288 } CmInetIpv6HBHHdr;
289
290 /* structure to hold TLV of each Destination option */
291 typedef struct cmInetIpv6DestOptsHdr
292 {
293    uint8_t type;
294    uint8_t length;
295    uint8_t *value;
296 } CmInetIpv6DestOptsHdr;
297
298 /* structure to hold IPV6 addresses of the Route header */
299 typedef struct cmInetIpv6RtHdr
300 {
301    uint8_t numAddrs;
302    uint32_t slMap;
303    CmInetIpAddr6 *ipv6Addrs; 
304 } CmInetIpv6RtHdr;
305
306 /* array of all HBH options */
307 typedef struct cmInetIpv6HBHHdrArr
308 {
309    uint8_t numHBHOpts;
310    CmInetIpv6HBHHdr *hbhOpts;
311 } CmInetIpv6HBHHdrArr;
312
313 /* array of all Destination options */
314 typedef struct cmInetIpv6DestOptsArr
315 {
316    uint8_t numDestOpts;
317    CmInetIpv6DestOptsHdr *destOpts;
318 } CmInetIpv6DestOptsArr;
319
320 /* structure having 3 substructures for 3 types of ext headers */
321 typedef struct cmInetIpv6ExtHdr
322 {
323    Bool hbhHdrPrsnt;
324    CmInetIpv6HBHHdrArr hbhOptsArr;
325    Bool destOptsPrsnt;
326    CmInetIpv6DestOptsArr destOptsArr;
327    Bool rtOptsPrsnt;
328    CmInetIpv6RtHdr rtOptsArr;
329 } CmInetIpv6ExtHdr;
330
331 /* structure for type 0 Route Header */
332 typedef struct cmInetIpv6RtHdr0 
333 {
334    uint8_t ip6r0_nextHdr;
335    uint8_t ip6r0_hdrExtLen;
336    uint8_t ip6r0_type;
337    uint8_t ip6r0_segLeft;
338    uint32_t ip6r0_resrvAndSLmap; /* first byte reserved, last 3 srtict/loose map */
339 } CmInetIpv6RtHdr0;
340 #endif /* IPV6_OPTS_SUPPORTED */
341
342 typedef struct cmInetIpv6HdrParm
343 {
344    TknUInt8 ttl;
345    CmInetNetAddr srcAddr6;/* used to set src addr on sending pkt(IPv6) */
346 #ifdef IPV6_OPTS_SUPPORTED   
347    CmInetIpv6ExtHdr ipv6ExtHdr;
348 #endif /* IPV6_OPTS_SUPPORTED */
349 } CmInetIpv6HdrParm;
350 #endif /* IPV6_SUPPORTED */
351
352 typedef struct cmInetIpv4HdrParm 
353 {
354    TknUInt8    proto;                 /* Protocol value */
355    TknUInt8    dfBit;                 /* Don't fragment flag */
356    TknUInt8    tos;                   /* Type of Service */
357    TknUInt8    ttl;                   /* Time to Live */
358    /* added new field */
359 #ifdef IPV4_OPTS_SUPPORTED 
360    TknStr64 ipv4HdrOpt;            /* IPV4 hdr opt */
361 #endif /* IPV4_OPTS_SUPPORTED */
362 } CmInetIpv4HdrParm;
363 typedef struct cmInetIpHdrParm
364 {
365    uint8_t type;
366    union
367    {
368       CmInetIpv4HdrParm  hdrParmIpv4;  /* IPv4 header parameters */
369 #ifdef IPV6_SUPPORTED
370       CmInetIpv6HdrParm ipv6HdrParm;
371 #endif /* IPV6_SUPPORTED */    
372    } u;
373 } CmInetIpHdrParm;
374
375 /* New data structures to peek into the file descriptor set. */
376 /* fdSetInfo structure */
377 #ifdef WIN32
378 typedef struct cmInetFdSetInfo
379 {
380    Bool           initDone;      /* Initialisation done */
381    uint32_t            numFds;        /* Number of file descriptors scanned */
382 } CmInetFdSetInfo;
383 #else
384 #if (defined(SUNOS) || defined(SS_LINUX) || defined(SS_VW) || defined(HPOS)) 
385 typedef struct cmInetFdSetInfo
386 {
387    Bool        initDone;         /* Initialisation done */
388    Bool        bigEndian;        /* Big endian architecture */
389    uint16_t         arIdx;            /* Current index in fd_set array */
390    uint32_t         numArElems;       /* Number of array elements */
391    uint8_t          ar[256];          /* Array of bit positions */
392 } CmInetFdSetInfo;
393 #endif /* SUNOS || SS_LINUX || SS_VW */
394 #endif /* WIN32 */
395
396 /*cm_inet_x_001.main_23 Updated for TUCL 2.1 Release (Kernel SCTP Support) */
397 #ifdef CM_LKSCTP
398 typedef struct cmInetSctpSndRcvInfo
399 {
400    uint16_t   stream;
401    uint16_t   ssn;
402    uint16_t   flags;
403    uint32_t   ppid;
404    uint32_t   context;
405    uint32_t   timetolive;
406    uint32_t   tsn;
407    uint32_t   cumtsn;
408    uint32_t   assocId;
409 } CmInetSctpSndRcvInfo;
410
411 typedef struct cmInetSctpNotification 
412 {
413    struct 
414    {
415       uint16_t nType;  
416       uint16_t nFlags;
417       uint32_t nLen;
418    } header;
419
420    union 
421    {
422       struct  
423       {
424          uint16_t state;
425          uint16_t error;
426          uint16_t outStreams;
427          uint16_t inStreams;
428          uint32_t assocId;
429          uint8_t  *info;
430       }assocChange;
431       struct  
432       {
433          CmInetNetAddr addr;
434          S32           state;
435          S32           error;
436          uint32_t           assocId;
437       }paddrChange;
438       struct 
439       {
440          uint16_t error;
441          uint32_t assocId;
442          uint8_t  *data;
443       }remoteErr;
444       struct 
445       {
446          uint32_t error;
447          CmInetSctpSndRcvInfo info;
448          uint32_t assocId;
449          uint8_t  *data;
450       }sndFailed;
451       struct 
452       {
453          uint32_t assocId;
454       }shutdownEvt;
455       struct 
456       {
457          uint32_t adaptationInd;
458          uint32_t assocId;
459       }adaptationEvt;
460       struct 
461       {
462          uint32_t indication;
463          uint32_t assocId;
464       }pdapiEvt;
465    }u;
466 }CmInetSctpNotification;
467
468 typedef struct cmInetSockLinger
469 {
470    Bool   enable;
471    uint32_t    lingerTime;
472 } CmInetSockLinger;
473
474 typedef struct cmInetSctpSockEvent
475 {
476    Bool   dataIoEvent;
477    Bool   associationEvent;
478    Bool   addressEvent;
479    Bool   sendFailureEvent;
480    Bool   peerErrorEvent;
481    Bool   shutdownEvent;
482    Bool   partialDeliveryEvent;
483    Bool   adaptationLayerEvent;
484 } CmInetSctpSockEvent;
485
486 typedef struct cmInetSctpPeerAddrParams
487 {
488    uint32_t            assocId;
489    struct
490    {
491       Bool           addrPres;
492       CmInetNetAddr  addr;
493       uint16_t            port;
494    }s;
495    uint32_t            pathMaxRxt;
496    uint32_t            pathMtu;
497    uint32_t            sackDelay;
498    uint8_t             pmtudFlag;
499    uint8_t             sackDelayFlag;
500    uint8_t             hbEnblFlag;
501    uint32_t            hbInterval;
502 } CmInetSctpPeerAddrParams;
503
504 typedef struct cmInetSctpPrimAddr 
505 {
506    uint32_t            assocId;
507    CmInetNetAddr  addr;
508    uint16_t            port;
509 }CmInetSctpPrimAddr;
510
511 typedef struct cmInetSctpPeerAddrInfo
512 {
513    uint32_t           assocId;
514    CmInetNetAddr addr;
515    uint16_t           port;
516    Bool          isActive;
517    uint32_t           cwnd;
518    uint32_t           srtt;
519    uint32_t           rto;
520    uint32_t           mtu;
521 }CmInetSctpPeerAddrInfo;
522
523 typedef struct cmInetSctpStatus
524 {
525    uint32_t   assocId;
526    S32   state;
527    uint32_t   rwnd;
528    uint16_t   unackdata;
529    uint16_t   penddata;
530    uint16_t   instrms;
531    uint16_t   outstrms;
532    uint32_t   fragPoint; 
533    CmInetSctpPeerAddrInfo primary;
534 }CmInetSctpStatus;
535
536 /*cm_inet_x_001.main_24 Updated for the support of configurable RTO parameters, 
537                         HBeat value Max retransmissions (Init, Path, Association)*/
538 typedef struct cmInetSctpRtoInfo
539 {
540    uint32_t   assocId;
541    uint32_t   rtoInitial;
542    uint32_t   rtoMax;
543    uint32_t   rtoMin;
544 }CmInetSctpRtoInfo;
545
546 typedef struct cmInetSctpInitMsg
547 {
548    uint16_t  maxInitReTx;
549    uint16_t  maxInitTimeout;
550    uint16_t  maxInstreams;
551    uint16_t  numOstreams;
552 }CmInetSctpInitMsg;
553
554 typedef struct cmInetSctpAssocParams
555 {
556    uint32_t   assocId;
557    uint16_t   assocMaxReTx; 
558    uint16_t   numberOfPeerDest;
559    uint32_t   peerRwnd;
560    uint32_t   localRwnd;
561    uint32_t   cookieLife;
562 }CmInetSctpAssocParams;
563
564 #endif
565
566 /* added a new type CmInetSockAddr */
567 #ifdef SUNOS
568 #ifdef SS_LINUX
569 typedef struct iovec CmInetIovec;
570 #else
571 typedef iovec_t CmInetIovec;
572 #endif /* SS_LINUX */
573 typedef struct sockaddr CmInetSockAddr;
574 #else
575 #ifdef HPOS
576 typedef struct iovec CmInetIovec;
577 typedef struct sockaddr CmInetSockAddr;
578 #else
579 #ifdef SS_VW
580 typedef struct iovec CmInetIovec;
581 typedef struct sockaddr CmInetSockAddr;
582 #else
583 #ifdef WIN32
584 typedef struct sockaddr CmInetSockAddr;
585 #else
586 #ifdef SS_PS
587 typedef struct iovec CmInetIovec;
588 typedef struct sockaddr_in CmInetSockAddr;
589 #endif /* SS_PS */
590 #endif /* WIN32 */
591 #endif /* SS_VW */
592 #endif /* HPOS */
593 #endif /* SUNOS */
594
595 #ifdef SUNOS
596 typedef struct sockaddr_in6 CmInet6SockAddr;
597 typedef struct sockaddr_in CmInet4SockAddr;
598 #endif /* SUNOS */
599
600 /* addrInfo structure */ 
601 #if (!defined(SS_VW) && !defined(SS_PS) && !defined(WIN32))
602 typedef struct addrinfo  CmInetAddrInfo;
603 #endif /* SS_VW | SS_PS | WIN32*/
604
605 /* socket function prototypes */
606
607 #ifdef CM_INET2  
608 #ifdef IPV6_SUPPORTED
609 S16 cmInetSocket ARGS((uint8_t type, CmInetFd *sockFd, uint8_t protocol,
610                               uint8_t family));
611 #else
612 S16 cmInetSocket ARGS((uint8_t type, CmInetFd *sockFd, uint8_t protocol));
613 #endif /* IPV6_SUPPORTED */
614 #else   /* CM_INET2 */ 
615 S16 cmInetSocket ARGS((uint8_t type, CmInetFd *sockFd));
616 #endif  /* CM_INET2 */ 
617
618 /* cm_inet_x_001.main_22 1. Added new interface - cmInetFlushRecvBuf()
619                                to flush the data from socket receive buffer. */
620 #ifdef CM_INET_FLUSH_RECV_BUF
621 S16 cmInetFlushRecvBuf ARGS((CmInetFd *sockFd,
622                                MsgLen *len,
623                                S32 flags));
624 #endif /* CM_INET_FLUSH_RECV_BUF*/
625
626 S16 cmInetBind ARGS((CmInetFd *sockFd, CmInetAddr *myAddr));
627 S16 cmInetConnect ARGS((CmInetFd *sockFd, CmInetAddr *servAddr));
628 S16 cmInetListen ARGS((CmInetFd *sockFd, S16 backLog));
629 S16 cmInetAccept ARGS((CmInetFd *sockFd, CmInetAddr *fromAddr, 
630                               CmInetFd *newSockFd));
631 #ifdef IPV6_OPTS_SUPPORTED
632 #ifdef LOCAL_INTF
633 S16 cmInetRecvMsg ARGS((CmInetFd *sockFd, CmInetAddr *dstAddr, 
634                                CmInetMemInfo *info, Buffer **mPtr, 
635                                MsgLen *len, CmInetIpHdrParm *ipHdrParams,
636                                CmInetLocalInf  *localIf, S32 flags));
637 #else
638 S16 cmInetRecvMsg ARGS((CmInetFd *sockFd, CmInetAddr *dstAddr, 
639                                CmInetMemInfo *info, Buffer **mPtr, 
640                                MsgLen *len, CmInetIpHdrParm *ipHdrParams,
641                                S32 flags));
642 #endif /* LOCAL_INTF */
643 #else
644 #ifdef LOCAL_INTF
645 S16 cmInetRecvMsg ARGS((CmInetFd *sockFd, CmInetAddr *dstAddr, 
646                                CmInetMemInfo *info, Buffer **mPtr, 
647                                MsgLen *len, CmInetLocalInf  *localIf,
648                                S32 flags));
649 #else
650 S16 cmInetRecvMsg ARGS((CmInetFd *sockFd, CmInetAddr *dstAddr, 
651                                CmInetMemInfo *info, Buffer **mPtr, 
652                                MsgLen *len, S32 flags));
653 #endif /* LOCAL_INTF */
654 #endif /* IPV6_OPTS_SUPPORTED */
655 S16 cmInetSendDscpMsg ARGS((CmInetFd *sockFd, CmInetAddr *dstAddr, 
656                                CmInetMemInfo *info, Buffer *mBuf, MsgLen *len,
657                                CmInetIpHdrParm *ipHdrParams, S16 flags));
658
659 #ifdef IPV6_OPTS_SUPPORTED
660 S16 cmInetSendMsg ARGS((CmInetFd *sockFd, CmInetAddr *dstAddr, 
661                                CmInetMemInfo *info, Buffer *mBuf, MsgLen *len,
662                                CmInetIpHdrParm *ipHdrParams, S16 flags));
663 #else
664 S16 cmInetSendMsg ARGS((CmInetFd *sockFd, CmInetAddr *dstAddr, 
665                                CmInetMemInfo *info, Buffer *mBuf, MsgLen *len,
666                                S16 flags));
667 #endif /* IPV6_OPTS_SUPPORTED */
668 S16 cmInetPeek ARGS((CmInetFd *sockFd, CmInetAddr *fromAddr, 
669                             CmInetMemInfo *info, MsgLen dataPos, 
670                             MsgLen dataLen, uint8_t *data));
671 /* cm_inet_x_001.main_26: Added new function declaration cmInetPeekNew() */ 
672 S16 cmInetPeekNew ARGS((CmInetFd *sockFd, CmInetAddr *fromAddr, 
673                             CmInetMemInfo *info, MsgLen dataPos, 
674                             MsgLen dataLen, uint8_t *data)); 
675 S16 cmInetClose ARGS((CmInetFd *sockFd));
676 S16 cmInetShutdown ARGS((CmInetFd *sockFd, S32 howTo));
677 S16 cmInetSelect ARGS((CmInetFdSet *readFdS, CmInetFdSet *writeFdS, 
678                               uint32_t *mSecTimeout, S16 *numFdS));
679 S16 cmInetSetOpt ARGS((CmInetFd *sockFd, uint32_t level, uint32_t type, 
680                              Ptr value));
681 S16 cmInetGetNumRead ARGS((CmInetFd *sockFd, uint32_t *dataLen));
682 #ifndef SS_PS
683 S16 cmInetGetHostByName ARGS((S8 *hostName, CmInetIpAddrTbl *addrTbl));
684 S16 cmInetGetIpNodeByName ARGS((S8 *hostName, CmInetIpAddrArr *addrArr));
685 S16 cmInetAddr ARGS((S8 *asciiAddr, CmInetIpAddr *address));
686 S16 cmInetNtoa ARGS((CmInetIpAddr address, S8 **asciiAddr));
687 S16 cmInetPton ARGS((CmInetIpAddr *address, S8 *asciiAddr));
688 #ifdef IPV6_SUPPORTED 
689 S16 cmInetPton6 ARGS((CmInetIpAddr6 *address6, S8 *asciiAddr));
690 #endif /* IPV6_SUPPORTED */
691 #endif /*  SS_PS */
692 /* Function prototypes to peek into file descriptor set. */
693 #if (defined(WIN32) || defined(SUNOS) || defined(SS_LINUX) || defined(SS_VW) \
694      || defined(HPOS))
695 S16 cmInetFdSetInfoInit ARGS((CmInetFdSetInfo *fdSetInfo));
696 S16 cmInetGetFd ARGS((CmInetFdSetInfo *fdSetInfo, CmInetFdSet *fdSet,
697                              CmInetFdType *sockFd));
698 #endif /* WIN32 | SUNOS | SS_LINUX | SS_VW | HPOS */
699
700 S16 cmInetGetMemSize      ARGS((S32 *size));
701 S16 cmInetInit            ARGS((Void));
702 S16 cmInetDeInit          ARGS((Void));
703 S16 cmInetGetSockName     ARGS((CmInetFd *sockFd, CmInetAddr *locAddr));
704
705 S16 cmInetConvertStrToIpAddr ARGS((uint16_t len, uint8_t *val,
706                                           CmInetNetAddr *address));
707 S16 cmInetAsciiToIpv4 ARGS((uint8_t numBytes, uint8_t *ipv4Addr,
708                                    uint16_t len, uint8_t *val));
709
710
711 /* cm_inet_x_001.main_29 Poll Implementation Changes */
712 S16 cmInetPoll ARGS((CmInetPollFd  *pollFdArr,uint32_t idx,S16  *numFdS,uint32_t  timeout));
713 S16 cmInetPollSetFd ARGS((CmInetFd  *sockFd,CmInetPollFd  *pollFdArr,S16  idx, uint16_t  eventMask));
714 S16 cmInetPollFdIsSet ARGS((CmInetPollFd  *pollFdArr, S16 idx, uint16_t  eventMask));
715 S16 cmInetPollClearFdREvent ARGS((CmInetPollFd  *pollFdArr, S16 idx, uint16_t eventMask));
716 S16 cmInetPollClearFdEvent ARGS((CmInetPollFd  *pollFdArr,S16 idx, uint16_t eventMask));
717 S16 cmInetPollDelFd ARGS((CmInetPollFd  *pollFdArr, S16 delIdx, S16  crntIdx));
718 S16 cmInetPollInitFdArr ARGS((CmInetPollFd  *pollFdArr));
719 S16 cmInetNtop ARGS((uint8_t type,Void *address,S8 *asciiAddr,uint32_t len));
720
721
722
723 /* cm_inet_x_001.main_21:Added wrapper function for getaddrinfo and freeaddrinfo */
724 #if (!defined(SS_VW) && !defined(SS_PS) && !defined(WIN32))
725 S32 cmInetGetAddrInfo ARGS((const S8* node, const S8* service, 
726                                    const CmInetAddrInfo *hints, CmInetAddrInfo **res));
727 Void cmInetFreeAddrInfo ARGS((CmInetAddrInfo *res));
728 #endif /* SS_VW | SS_PS | WIN32 */
729
730 /*cm_inet_x_001.main_23 Updated for TUCL 2.1 Release (Kernel SCTP Support) */
731 #ifdef CM_LKSCTP
732 S16 cmInetSctpBindx     ARGS((CmInetFd *sockFd, 
733                                      CmInetNetAddrLst *addrLst, 
734                                      uint16_t port));
735 S16 cmInetSctpConnectx  ARGS((CmInetFd *sockFd, CmInetNetAddr *primAddr, 
736                                      CmInetNetAddrLst *addrLst, 
737                                      uint16_t port));
738 S16 cmInetSctpPeelOff   ARGS((CmInetFd *sockFd, uint32_t assocId, 
739                                      CmInetFdType *assocFd));
740 S16 cmInetSctpSendMsg   ARGS((CmInetFd *sockFd, CmInetNetAddr *dstAddr, 
741                                      uint16_t port, CmInetMemInfo *info, 
742                                      Buffer *mBuf, MsgLen *len, uint16_t strmId,
743                                      Bool unorderFlg, uint16_t ttl, uint32_t ppId, 
744                                      uint32_t context));
745 S16 cmInetSctpRecvMsg  ARGS((CmInetFd *sockFd, CmInetNetAddr *srcAddr, 
746                                     uint16_t *port, CmInetMemInfo *info, 
747                                     Buffer **mBuf, MsgLen *len, 
748                                     CmInetSctpSndRcvInfo *sinfo, uint32_t *flag,
749                                     CmInetSctpNotification *ntfy));
750 S16 cmInetSctpGetPAddrs ARGS((CmInetFd *sockFd, uint32_t assocId, 
751                                      CmInetNetAddrLst *addrlst));
752 S16 cmInetGetOpt        ARGS((CmInetFd *sockFd, uint32_t level, uint32_t type,
753                                      Ptr value)); 
754
755 /*cm_inet_x_001.main_25: Added new funcion */
756 S16 cmInetShutDownSctp ARGS((CmInetFd *sockFd));
757 /*cm_inet_x_001.main_30: Added new function */
758 S16 cmInetAbortSctpAssoc ARGS((CmInetFd *sockFd, UConnId assocId));
759 #endif
760
761 #ifdef __cplusplus
762 }
763 #endif /* __cplusplus */
764 #endif /* __CMINETX__ */
765
766 /**********************************************************************
767          End of file
768 **********************************************************************/