Nix
2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Toggle main menu visibility
Loading...
Searching...
No Matches
socket.hh
Go to the documentation of this file.
1
#pragma once
3
4
#include "
nix/util/file-descriptor.hh
"
5
6
#ifdef _WIN32
7
# include <winsock2.h>
8
#endif
9
10
namespace
nix {
11
17
using
Socket
=
18
#ifdef _WIN32
19
SOCKET
20
#else
21
int
22
#endif
23
;
24
25
#ifdef _WIN32
29
# define SHUT_WR SD_SEND
30
# define SHUT_RDWR SD_BOTH
31
#endif
32
38
static
inline
Socket
toSocket(
Descriptor
fd)
39
{
40
#ifdef _WIN32
41
return
reinterpret_cast<
Socket
>
(fd);
42
#else
43
return
fd;
44
#endif
45
}
46
52
static
inline
Descriptor fromSocket(Socket fd)
53
{
54
#ifdef _WIN32
55
return
reinterpret_cast<
Descriptor
>
(fd);
56
#else
57
return
fd;
58
#endif
59
}
60
61
}
// namespace nix
file-descriptor.hh
File descriptor operations for almost arbitrary file descriptors.
nix::Descriptor
int Descriptor
Definition
file-descriptor.hh:36
nix::Socket
int Socket
Definition
socket.hh:17
libutil
include
nix
util
socket.hh
Generated by
1.18.0