]> git.tdb.fi Git - libs/net.git/blob - source/net/socket_private.h
Add a dynamic receiver class for more flexible packet handling
[libs/net.git] / source / net / socket_private.h
1 #ifndef MSP_NET_SOCKET_PRIVATE_H_
2 #define MSP_NET_SOCKET_PRIVATE_H_
3
4 #ifndef MSP_NET_PLATFORM_API_H_
5 #error platform_api.h must be included to use private headers
6 #endif
7
8 #include <msp/io/handle.h>
9 #include "sockaddr.h"
10 #include "socket.h"
11 #include "socket_platform.h"
12
13 namespace Msp {
14 namespace Net {
15
16 struct Socket::Private
17 {
18         SocketHandle handle;
19
20         /* On POSIX platforms this is the same as the handle.  This might seem
21         strange but it allows the same syntax on both POSIX and Windows. */
22         IO::Handle event;
23
24         void set_block(bool);
25         void set_inherit(bool);
26         int set_option(int, int, const void *, socklen_t);
27         int get_option(int, int, void *, socklen_t *);
28 };
29
30 std::size_t check_sys_error(std::make_signed<std::size_t>::type, const char *);
31 bool check_sys_connect_error(int);
32
33 } // namespace Net
34 } // namespace Msp
35
36 #endif