Back to index

nagios-plugins  1.4.16
Functions
sockets.c File Reference
#include <config.h>
#include "sockets.h"

Go to the source code of this file.

Functions

int gl_sockets_startup (int version _GL_UNUSED)
int gl_sockets_cleanup (void)

Function Documentation

int gl_sockets_cleanup ( void  )

Definition at line 103 of file sockets.c.

{
#if WINDOWS_SOCKETS
  int err;

  initialized_sockets_version = 0;

  unregister_close_hook (&close_sockets_hook);

  err = WSACleanup ();
  if (err != 0)
    return 1;
#endif

  return 0;
}
int gl_sockets_startup ( int version  _GL_UNUSED)

Definition at line 77 of file sockets.c.

{
#if WINDOWS_SOCKETS
  if (version > initialized_sockets_version)
    {
      WSADATA data;
      int err;

      err = WSAStartup (version, &data);
      if (err != 0)
        return 1;

      if (data.wVersion < version)
        return 2;

      if (initialized_sockets_version == 0)
        register_close_hook (close_fd_maybe_socket, &close_sockets_hook);

      initialized_sockets_version = version;
    }
#endif

  return 0;
}

Here is the call graph for this function: