Amazon Kinesis Webrtc C SDK
 
Loading...
Searching...
No Matches
Network.h
Go to the documentation of this file.
1/*******************************************
2HostInfo internal include file
3*******************************************/
4#ifndef __KINESIS_VIDEO_WEBRTC_CLIENT_NETWORK__
5#define __KINESIS_VIDEO_WEBRTC_CLIENT_NETWORK__
6
7#pragma once
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13#define MAX_LOCAL_NETWORK_INTERFACE_COUNT 128
14
15// string buffer size for ipv4 and ipv6. Null terminator included.
16// for ipv6: 0000:0000:0000:0000:0000:0000:0000:0000 = 39
17// for ipv4 mapped ipv6: 0000:0000:0000:0000:0000:ffff:192.168.100.228 = 45
18#define KVS_IP_ADDRESS_STRING_BUFFER_LEN 46
19
20// 000.000.000.000
21#define KVS_MAX_IPV4_ADDRESS_STRING_LEN 15
22
23#define KVS_GET_IP_ADDRESS_PORT(a) ((UINT16) getInt16((a)->port))
24
25#define IPV4_TEMPLATE "%d.%d.%d.%d"
26#define IPV6_TEMPLATE "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
27
28#if defined(__MACH__)
29#define NO_SIGNAL_SOCK_OPT SO_NOSIGPIPE
30#define NO_SIGNAL_SEND 0
31#else
32#define NO_SIGNAL_SEND MSG_NOSIGNAL
33#endif
34
35// Some systems, such as Windows, do not have this value
36#ifndef EAI_SYSTEM
37#define EAI_SYSTEM -11
38#endif
39
40// Windows uses EWOULDBLOCK (WSAEWOULDBLOCK) to indicate connection attempt
41// cannot be completed immediately, whereas POSIX uses EINPROGRESS.
42#ifdef _WIN32
43#define KVS_SOCKET_IN_PROGRESS EWOULDBLOCK
44#else
45#define KVS_SOCKET_IN_PROGRESS EINPROGRESS
46#endif
47
53
65
66#if defined(HAVE_SOCKETPAIR)
72STATUS createSocketPair(INT32 (*)[2]);
73#endif
74
84
90STATUS closeSocket(INT32);
91
98STATUS socketBind(PKvsIpAddress, INT32);
99
106STATUS socketConnect(PKvsIpAddress, INT32);
107
115STATUS socketWrite(INT32, const void*, SIZE_T);
116
124STATUS getIpWithHostName(PCHAR, PKvsIpAddress);
125
135BOOL isIpAddr(PCHAR, UINT16);
136
137STATUS getIpAddrStr(PKvsIpAddress, PCHAR, UINT32);
138
140
144INT32 getErrorCode(VOID);
145
151PCHAR getErrorString(INT32);
152
153#ifdef _WIN32
154#define POLL WSAPoll
155#else
156#define POLL poll
157#endif
158
159#ifdef __cplusplus
160}
161#endif
162#endif /* __KINESIS_VIDEO_WEBRTC_CLIENT_NETWORK__ */
KVS_IP_FAMILY_TYPE
Definition Include_i.h:99
STATUS getLocalhostIpAddresses(PKvsIpAddress, PUINT32, IceSetInterfaceFilterFunc, UINT64)
Definition Network.c:7
STATUS getIpWithHostName(PCHAR, PKvsIpAddress)
Definition Network.c:395
STATUS socketBind(PKvsIpAddress, INT32)
Definition Network.c:237
INT32 getErrorCode(VOID)
Definition Network.c:534
STATUS closeSocket(INT32)
Definition Network.c:222
KVS_SOCKET_PROTOCOL
Definition Network.h:48
@ KVS_SOCKET_PROTOCOL_TCP
Definition Network.h:50
@ KVS_SOCKET_PROTOCOL_NONE
Definition Network.h:49
@ KVS_SOCKET_PROTOCOL_UDP
Definition Network.h:51
STATUS getIpAddrStr(PKvsIpAddress, PCHAR, UINT32)
Definition Network.c:466
STATUS createSocket(KVS_IP_FAMILY_TYPE, KVS_SOCKET_PROTOCOL, UINT32, PINT32)
Definition Network.c:167
STATUS socketConnect(PKvsIpAddress, INT32)
Definition Network.c:288
STATUS socketWrite(INT32, const void *, SIZE_T)
Definition Network.c:323
PCHAR getErrorString(INT32)
Definition Network.c:569
BOOL isIpAddr(PCHAR, UINT16)
Definition Network.c:337
BOOL isSameIpAddress(PKvsIpAddress, PKvsIpAddress, BOOL)
Definition Network.c:493
BOOL(* IceSetInterfaceFilterFunc)(UINT64, PCHAR)
IceSetInterfaceFilterFunc is fired when a callback function to filter network interfaces is assigned....
Definition Include.h:1085
Definition Include_i.h:104