fehQlibs 26
Qlibs
Loading...
Searching...
No Matches
socket_if.h
Go to the documentation of this file.
1#ifndef SOCKETIF_H
2#define SOCKETIF_H
3
4/* Revsision 20220608
5 * - removed obsolete socket_local4() and socket_remote4()
6 * Revision 20210828, Erwin Hoffmann
7 * - added socket_accept4()
8 * Revision 20210226, Erwin Hoffmann
9 * - removed dependency on ipv4socket (loose coupling)
10 * - only single socket_tcp() and
11 * - single socket_udp() function serving both IPv4 + IPv6
12 * Revision 20181125, Erwin Hoffmann
13 * - switched to 'uint_t.h'
14 * - changed 'socket_tcp' --> 'socket_tcp4', 'socket_udp' --> 'socket_udp4'
15 * - added 'socket_ip6optionskill'
16 * - reordered and included backword compatible IPv6 calls
17 * - commented multicast socket declarations
18 * - enlarged usage for ipv4socket -> dual bind IPv4/IPv6
19*/
20
21#define __APPLE_USE_RFC_3542 /* MacOS Anycast support */
22
23#include "uint_t.h"
24
25/* IPv4 only */
26extern int socket_accept4(int,char [4],uint16 *);
27extern int socket_bind4(int,const char [4],uint16);
28extern int socket_bind4_reuse(int,const char [4],uint16);
29extern int socket_connect4(int,const char [4],uint16);
30extern int socket_send4(int,const char *,unsigned int,const char [4],uint16);
31extern int socket_broadcast(int,const char *,unsigned int,uint16);
32
33/* Backward compatibility */
34#define socket_local4 socket_local
35#define socket_remote4 socket_remote
36
37/* IPv6 only */
38extern int socket_bind6(int,const char [16],uint16,uint32);
39extern int socket_bind6_reuse(int,const char [16],uint16,uint32);
40extern int socket_connect6(int,const char [16],uint16,uint32);
41extern int socket_send6(int,const char *,unsigned int,const char [16],uint16,uint32);
42extern const char* socket_getifname(uint32);
43extern uint32 socket_getifidx(const char *);
44extern int socket_ip6optionskill(int);
45extern int socket_ip6anycast(int);
46
47/* Common IPv4 & IPv6 */
48extern int socket_accept(int,char [16],uint16 *,uint32 *);
49extern int socket_bind(int,const char [16],uint16,uint32);
50extern int socket_bind_reuse(int,const char [16],uint16,uint32);
51extern int socket_connect(int,const char [16],uint16,uint32);
52extern int socket_connected(int);
53extern int socket_listen(int,int);
54extern int socket_local(int,char [16],uint16 *,uint32 *);
55extern int socket_recv(int,char *,unsigned int,char [16],uint16 *,uint32 *);
56extern int socket_remote(int,char [16],uint16 *,uint32 *);
57extern int socket_send(int,const char *,unsigned int,const char [16],uint16,uint32);
58extern void socket_tryreservein(int,int);
59extern int socket_ipoptionskill(int);
60extern int socket_dualstack(int);
61extern int socket_nodualstack(int);
62
63/* Backward compatibility */
64#define socket_accept6 socket_accept
65#define socket_local6 socket_local
66#define socket_recv6 socket_recv
67#define socket_remote6 socket_remote
68
69/* TCP */
70extern int socket_tcp4(void);
71extern int socket_tcp6(void);
72extern int socket_tcp(void);
73extern int socket_tcpnodelay(int);
74
75/* UDP */
76extern int socket_udp4(void);
77extern int socket_udp6(void);
78extern int socket_udp(void);
79
80/*********** For future use ***********************************/
81/* enable sending udp packets to the broadcast address */
82// extern int socket_broadcast(int);
83/* join a multicast group on the given interface */
84// extern int socket_mcjoin4(int,char *,char *);
85// extern int socket_mcjoin6(int,char *,int);
86/* leave a multicast group on the given interface */
87// extern int socket_mcleave4(int,char *);
88// extern int socket_mcleave6(int,char *);
89/* set multicast TTL/hop count for outgoing packets */
90// extern int socket_mcttl4(int,char);
91// extern int socket_mcttl6(int,char);
92/* enable multicast loopback */
93// extern int socket_mcloop4(int,char);
94// extern int socket_mcloop6(int,char);
95/**************************************************************/
96
97#endif
additional types and pack routines
uint16_t uint16
Definition: uint_t.h:29
uint32_t uint32
Definition: uint_t.h:40
int socket_listen(int, int)
Definition: socket_setup.c:55
int socket_broadcast(int, const char *, unsigned int, uint16)
uint32 socket_getifidx(const char *)
Definition: socket_if.c:22
int socket_nodualstack(int)
Definition: socket_setup.c:94
int socket_local(int, char[16], uint16 *, uint32 *)
Definition: socket_info.c:16
int socket_bind(int, const char[16], uint16, uint32)
Definition: socket_bind.c:65
int socket_connect6(int, const char[16], uint16, uint32)
int socket_ip6anycast(int)
Definition: socket_setup.c:70
int socket_tcpnodelay(int)
Definition: socket_tcp.c:59
int socket_bind4_reuse(int, const char[4], uint16)
Definition: socket_bind.c:28
int socket_recv(int, char *, unsigned int, char[16], uint16 *, uint32 *)
Definition: socket_recv.c:16
int socket_bind4(int, const char[4], uint16)
Definition: socket_bind.c:16
int socket_connected(int)
int socket_send(int, const char *, unsigned int, const char[16], uint16, uint32)
Definition: socket_send.c:43
int socket_dualstack(int)
Definition: socket_setup.c:87
int socket_udp4(void)
Definition: socket_udp.c:33
const char * socket_getifname(uint32)
Definition: socket_if.c:29
int socket_tcp(void)
Definition: socket_tcp.c:44
int socket_bind6(int, const char[16], uint16, uint32)
Definition: socket_bind.c:44
int socket_udp6(void)
Definition: socket_udp.c:22
int socket_tcp6(void)
Definition: socket_tcp.c:33
int socket_udp(void)
Definition: socket_udp.c:44
int socket_ip6optionskill(int)
int socket_ipoptionskill(int)
Definition: socket_setup.c:60
int socket_connect(int, const char[16], uint16, uint32)
int socket_bind_reuse(int, const char[16], uint16, uint32)
Definition: socket_bind.c:73
int socket_tcp4(void)
Definition: socket_tcp.c:22
int socket_remote(int, char[16], uint16 *, uint32 *)
Definition: socket_info.c:38
int socket_send6(int, const char *, unsigned int, const char[16], uint16, uint32)
Definition: socket_send.c:29
int socket_accept(int, char[16], uint16 *, uint32 *)
Definition: socket_setup.c:16
int socket_send4(int, const char *, unsigned int, const char[4], uint16)
Definition: socket_send.c:16
void socket_tryreservein(int, int)
Definition: socket_bind.c:36
int socket_accept4(int, char[4], uint16 *)
Definition: socket_setup.c:40
int socket_connect4(int, const char[4], uint16)
int socket_bind6_reuse(int, const char[16], uint16, uint32)
Definition: socket_bind.c:58