tor  0.4.0.1-alpha
network_sys.c
Go to the documentation of this file.
1 /* Copyright (c) 2018-2019, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
9 #include "orconfig.h"
10 #include "lib/subsys/subsys.h"
11 #include "lib/net/network_sys.h"
12 #include "lib/net/resolve.h"
13 #include "lib/net/socket.h"
14 
15 #ifdef _WIN32
16 #include <winsock2.h>
17 #include <windows.h>
18 #endif
19 
20 static int
21 subsys_network_initialize(void)
22 {
23  if (network_init() < 0)
24  return -1;
25 
26  return 0;
27 }
28 
29 static void
30 subsys_network_shutdown(void)
31 {
32 #ifdef _WIN32
33  WSACleanup();
34 #endif
35  tor_free_getaddrinfo_cache();
36 }
37 
38 const subsys_fns_t sys_network = {
39  .name = "network",
40  .level = -90,
41  .supported = true,
42  .initialize = subsys_network_initialize,
43  .shutdown = subsys_network_shutdown,
44 };
int network_init(void)
Definition: socket.c:42
Header for resolve.c.
const char * name
Definition: subsys.h:28
Header for socket.c.