"Fossies" - the Fresh Open Source Software Archive

Member "tor-0.4.1.6/src/lib/net/network_sys.c" (10 Jun 2019, 785 Bytes) of package /linux/misc/tor-0.4.1.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "network_sys.c" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 0.4.1.6_vs_0.4.2.4-rc.

    1 /* Copyright (c) 2018-2019, The Tor Project, Inc. */
    2 /* See LICENSE for licensing information */
    3 
    4 /**
    5  * \file network_sys.c
    6  * \brief Subsystem object for networking setup.
    7  **/
    8 
    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 };