Kaa client C SDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
sock.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2016 CyberVision, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef CC32XX_SOCK_H_
18 #define CC32XX_SOCK_H_
19 
20 /* Avoid redefined warning */
21 #undef __CONCAT
22 #undef FD_SETSIZE
23 #undef FD_SET
24 #undef FD_CLR
25 #undef FD_ISSET
26 #undef FD_ZERO
27 #undef fd_set
28 #undef EBADF
29 #undef EAGAIN
30 #undef EWOULDBLOCK
31 #undef ENOMEM
32 #undef EACCES
33 #undef EFAULT
34 #undef EINVAL
35 #undef EDESTADDRREQ
36 #undef EPROTOTYPE
37 #undef ENOPROTOOPT
38 #undef EPROTONOSUPPORT
39 #undef EOPNOTSUPP
40 #undef EAFNOSUPPORT
41 #undef EADDRINUSE
42 #undef EADDRNOTAVAIL
43 #undef ENETUNREACH
44 #undef ENOBUFS
45 #undef EISCONN
46 #undef ENOTCONN
47 #undef ETIMEDOUT
48 #undef ECONNREFUSED
49 
50 #include "simplelink.h"
51 #include "socket.h"
53 
54 struct addrinfo
55 {
56  int ai_flags; /* Input flags. */
57  int ai_family; /* Protocol family for socket. */
58  int ai_socktype; /* Socket type. */
59  int ai_protocol; /* Protocol for socket. */
60  socklen_t ai_addrlen; /* Length of socket address. */
61  struct sockaddr *ai_addr; /* Socket address for socket. */
62  char *ai_canonname; /* Canonical name for service location. */
63  struct addrinfo *ai_next; /* Pointer to next in list. */
64 };
65 
66 #define _SS_PADSIZE (128 - (2 * sizeof (unsigned long)))
68 {
69  unsigned short ss_family; /* Address family, etc. */
70  unsigned long __ss_align; /* Force desired alignment. */
72 };
73 
74 typedef int kaa_fd_t;
75 
76 typedef struct sockaddr kaa_sockaddr_t;
78 typedef socklen_t kaa_socklen_t;
79 
80 #define KAA_HTONS(hostshort) htons((hostshort))
81 #define KAA_HTONL(hostlong) htonl((hostlong))
82 #define KAA_HTONLL(hostlonglong) kaa_htonll((hostlonglong))
83 
84 #define KAA_NTOHS(netshort) ntohs((netshort))
85 #define KAA_NTOHL(netlong) ntohl((netlong))
86 #define KAA_NTOHLL(netlonglong) kaa_ntohll((netlonglong))
87 
88 #endif /* CC32XX_SOCK_H_ */
socklen_t ai_addrlen
Definition: sock.h:60
#define _SS_PADSIZE
Definition: sock.h:66
struct sockaddr kaa_sockaddr_t
Definition: sock.h:76
unsigned long __ss_align
Definition: sock.h:70
socklen_t kaa_socklen_t
Definition: sock.h:78
char * ai_canonname
Definition: sock.h:62
unsigned short ss_family
Definition: sock.h:69
int kaa_fd_t
Definition: sock.h:74
Definition: sock.h:67
char __ss_padding[_SS_PADSIZE]
Definition: sock.h:71
int ai_protocol
Definition: sock.h:59
int ai_socktype
Definition: sock.h:58
struct addrinfo * ai_next
Definition: sock.h:63
Definition: sock.h:54
int ai_flags
Definition: sock.h:56
struct sockaddr * ai_addr
Definition: sock.h:61
int ai_family
Definition: sock.h:57