Rizin
unix-like reverse engineering framework and cli tools
winsock.h File Reference
#include <winsock2.h>
#include <iptypes.h>
#include <mswsock.h>
#include <ws2tcpip.h>
#include <windows.h>
#include "winapi.h"

Go to the source code of this file.

Classes

struct  _AFD_RECV_DATAGRAM_INFO
 
struct  _AFD_RECV_INFO
 

Macros

#define SO_UPDATE_CONNECT_CONTEXT   0x7010
 
#define TCP_KEEPALIVE   3
 
#define IPV6_V6ONLY   27
 
#define IPV6_HOPLIMIT   21
 
#define SIO_BASE_HANDLE   0x48000022
 
#define MCAST_JOIN_SOURCE_GROUP   45
 
#define MCAST_LEAVE_SOURCE_GROUP   46
 
#define TDI_RECEIVE_BROADCAST   0x00000004
 
#define TDI_RECEIVE_MULTICAST   0x00000008
 
#define TDI_RECEIVE_PARTIAL   0x00000010
 
#define TDI_RECEIVE_NORMAL   0x00000020
 
#define TDI_RECEIVE_EXPEDITED   0x00000040
 
#define TDI_RECEIVE_PEEK   0x00000080
 
#define TDI_RECEIVE_NO_RESPONSE_EXP   0x00000100
 
#define TDI_RECEIVE_COPY_LOOKAHEAD   0x00000200
 
#define TDI_RECEIVE_ENTIRE_MESSAGE   0x00000400
 
#define TDI_RECEIVE_AT_DISPATCH_LEVEL   0x00000800
 
#define TDI_RECEIVE_CONTROL_INFO   0x00001000
 
#define TDI_RECEIVE_FORCE_INDICATION   0x00002000
 
#define TDI_RECEIVE_NO_PUSH   0x00004000
 
#define AFD_NO_FAST_IO   0x00000001
 
#define AFD_OVERLAPPED   0x00000002
 
#define AFD_IMMEDIATE   0x00000004
 
#define AFD_POLL_RECEIVE_BIT   0
 
#define AFD_POLL_RECEIVE   (1 << AFD_POLL_RECEIVE_BIT)
 
#define AFD_POLL_RECEIVE_EXPEDITED_BIT   1
 
#define AFD_POLL_RECEIVE_EXPEDITED   (1 << AFD_POLL_RECEIVE_EXPEDITED_BIT)
 
#define AFD_POLL_SEND_BIT   2
 
#define AFD_POLL_SEND   (1 << AFD_POLL_SEND_BIT)
 
#define AFD_POLL_DISCONNECT_BIT   3
 
#define AFD_POLL_DISCONNECT   (1 << AFD_POLL_DISCONNECT_BIT)
 
#define AFD_POLL_ABORT_BIT   4
 
#define AFD_POLL_ABORT   (1 << AFD_POLL_ABORT_BIT)
 
#define AFD_POLL_LOCAL_CLOSE_BIT   5
 
#define AFD_POLL_LOCAL_CLOSE   (1 << AFD_POLL_LOCAL_CLOSE_BIT)
 
#define AFD_POLL_CONNECT_BIT   6
 
#define AFD_POLL_CONNECT   (1 << AFD_POLL_CONNECT_BIT)
 
#define AFD_POLL_ACCEPT_BIT   7
 
#define AFD_POLL_ACCEPT   (1 << AFD_POLL_ACCEPT_BIT)
 
#define AFD_POLL_CONNECT_FAIL_BIT   8
 
#define AFD_POLL_CONNECT_FAIL   (1 << AFD_POLL_CONNECT_FAIL_BIT)
 
#define AFD_POLL_QOS_BIT   9
 
#define AFD_POLL_QOS   (1 << AFD_POLL_QOS_BIT)
 
#define AFD_POLL_GROUP_QOS_BIT   10
 
#define AFD_POLL_GROUP_QOS   (1 << AFD_POLL_GROUP_QOS_BIT)
 
#define AFD_NUM_POLL_EVENTS   11
 
#define AFD_POLL_ALL   ((1 << AFD_NUM_POLL_EVENTS) - 1)
 
#define _AFD_CONTROL_CODE(operation, method)    ((FSCTL_AFD_BASE) << 12 | (operation << 2) | method)
 
#define FSCTL_AFD_BASE   FILE_DEVICE_NETWORK
 
#define AFD_RECEIVE   5
 
#define AFD_RECEIVE_DATAGRAM   6
 
#define AFD_POLL   9
 
#define IOCTL_AFD_RECEIVE    _AFD_CONTROL_CODE(AFD_RECEIVE, METHOD_NEITHER)
 
#define IOCTL_AFD_RECEIVE_DATAGRAM    _AFD_CONTROL_CODE(AFD_RECEIVE_DATAGRAM, METHOD_NEITHER)
 
#define IOCTL_AFD_POLL    _AFD_CONTROL_CODE(AFD_POLL, METHOD_BUFFERED)
 

Typedefs

typedef struct _AFD_RECV_DATAGRAM_INFO AFD_RECV_DATAGRAM_INFO
 
typedef struct _AFD_RECV_DATAGRAM_INFOPAFD_RECV_DATAGRAM_INFO
 
typedef struct _AFD_RECV_INFO AFD_RECV_INFO
 
typedef struct _AFD_RECV_INFOPAFD_RECV_INFO
 

Functions

int uv__convert_to_localhost_if_unspecified (const struct sockaddr *addr, struct sockaddr_storage *storage)
 

Macro Definition Documentation

◆ _AFD_CONTROL_CODE

#define _AFD_CONTROL_CODE (   operation,
  method 
)     ((FSCTL_AFD_BASE) << 12 | (operation << 2) | method)

Definition at line 139 of file winsock.h.

◆ AFD_IMMEDIATE

#define AFD_IMMEDIATE   0x00000004

Definition at line 94 of file winsock.h.

◆ AFD_NO_FAST_IO

#define AFD_NO_FAST_IO   0x00000001

Definition at line 92 of file winsock.h.

◆ AFD_NUM_POLL_EVENTS

#define AFD_NUM_POLL_EVENTS   11

Definition at line 119 of file winsock.h.

◆ AFD_OVERLAPPED

#define AFD_OVERLAPPED   0x00000002

Definition at line 93 of file winsock.h.

◆ AFD_POLL

#define AFD_POLL   9

Definition at line 146 of file winsock.h.

◆ AFD_POLL_ABORT

#define AFD_POLL_ABORT   (1 << AFD_POLL_ABORT_BIT)

Definition at line 105 of file winsock.h.

◆ AFD_POLL_ABORT_BIT

#define AFD_POLL_ABORT_BIT   4

Definition at line 104 of file winsock.h.

◆ AFD_POLL_ACCEPT

#define AFD_POLL_ACCEPT   (1 << AFD_POLL_ACCEPT_BIT)

Definition at line 111 of file winsock.h.

◆ AFD_POLL_ACCEPT_BIT

#define AFD_POLL_ACCEPT_BIT   7

Definition at line 110 of file winsock.h.

◆ AFD_POLL_ALL

#define AFD_POLL_ALL   ((1 << AFD_NUM_POLL_EVENTS) - 1)

Definition at line 120 of file winsock.h.

◆ AFD_POLL_CONNECT

#define AFD_POLL_CONNECT   (1 << AFD_POLL_CONNECT_BIT)

Definition at line 109 of file winsock.h.

◆ AFD_POLL_CONNECT_BIT

#define AFD_POLL_CONNECT_BIT   6

Definition at line 108 of file winsock.h.

◆ AFD_POLL_CONNECT_FAIL

#define AFD_POLL_CONNECT_FAIL   (1 << AFD_POLL_CONNECT_FAIL_BIT)

Definition at line 113 of file winsock.h.

◆ AFD_POLL_CONNECT_FAIL_BIT

#define AFD_POLL_CONNECT_FAIL_BIT   8

Definition at line 112 of file winsock.h.

◆ AFD_POLL_DISCONNECT

#define AFD_POLL_DISCONNECT   (1 << AFD_POLL_DISCONNECT_BIT)

Definition at line 103 of file winsock.h.

◆ AFD_POLL_DISCONNECT_BIT

#define AFD_POLL_DISCONNECT_BIT   3

Definition at line 102 of file winsock.h.

◆ AFD_POLL_GROUP_QOS

#define AFD_POLL_GROUP_QOS   (1 << AFD_POLL_GROUP_QOS_BIT)

Definition at line 117 of file winsock.h.

◆ AFD_POLL_GROUP_QOS_BIT

#define AFD_POLL_GROUP_QOS_BIT   10

Definition at line 116 of file winsock.h.

◆ AFD_POLL_LOCAL_CLOSE

#define AFD_POLL_LOCAL_CLOSE   (1 << AFD_POLL_LOCAL_CLOSE_BIT)

Definition at line 107 of file winsock.h.

◆ AFD_POLL_LOCAL_CLOSE_BIT

#define AFD_POLL_LOCAL_CLOSE_BIT   5

Definition at line 106 of file winsock.h.

◆ AFD_POLL_QOS

#define AFD_POLL_QOS   (1 << AFD_POLL_QOS_BIT)

Definition at line 115 of file winsock.h.

◆ AFD_POLL_QOS_BIT

#define AFD_POLL_QOS_BIT   9

Definition at line 114 of file winsock.h.

◆ AFD_POLL_RECEIVE

#define AFD_POLL_RECEIVE   (1 << AFD_POLL_RECEIVE_BIT)

Definition at line 97 of file winsock.h.

◆ AFD_POLL_RECEIVE_BIT

#define AFD_POLL_RECEIVE_BIT   0

Definition at line 96 of file winsock.h.

◆ AFD_POLL_RECEIVE_EXPEDITED

#define AFD_POLL_RECEIVE_EXPEDITED   (1 << AFD_POLL_RECEIVE_EXPEDITED_BIT)

Definition at line 99 of file winsock.h.

◆ AFD_POLL_RECEIVE_EXPEDITED_BIT

#define AFD_POLL_RECEIVE_EXPEDITED_BIT   1

Definition at line 98 of file winsock.h.

◆ AFD_POLL_SEND

#define AFD_POLL_SEND   (1 << AFD_POLL_SEND_BIT)

Definition at line 101 of file winsock.h.

◆ AFD_POLL_SEND_BIT

#define AFD_POLL_SEND_BIT   2

Definition at line 100 of file winsock.h.

◆ AFD_RECEIVE

#define AFD_RECEIVE   5

Definition at line 144 of file winsock.h.

◆ AFD_RECEIVE_DATAGRAM

#define AFD_RECEIVE_DATAGRAM   6

Definition at line 145 of file winsock.h.

◆ FSCTL_AFD_BASE

#define FSCTL_AFD_BASE   FILE_DEVICE_NETWORK

Definition at line 142 of file winsock.h.

◆ IOCTL_AFD_POLL

#define IOCTL_AFD_POLL    _AFD_CONTROL_CODE(AFD_POLL, METHOD_BUFFERED)

Definition at line 154 of file winsock.h.

◆ IOCTL_AFD_RECEIVE

#define IOCTL_AFD_RECEIVE    _AFD_CONTROL_CODE(AFD_RECEIVE, METHOD_NEITHER)

Definition at line 148 of file winsock.h.

◆ IOCTL_AFD_RECEIVE_DATAGRAM

#define IOCTL_AFD_RECEIVE_DATAGRAM    _AFD_CONTROL_CODE(AFD_RECEIVE_DATAGRAM, METHOD_NEITHER)

Definition at line 151 of file winsock.h.

◆ IPV6_HOPLIMIT

#define IPV6_HOPLIMIT   21

Definition at line 50 of file winsock.h.

◆ IPV6_V6ONLY

#define IPV6_V6ONLY   27

Definition at line 46 of file winsock.h.

◆ MCAST_JOIN_SOURCE_GROUP

#define MCAST_JOIN_SOURCE_GROUP   45

Definition at line 58 of file winsock.h.

◆ MCAST_LEAVE_SOURCE_GROUP

#define MCAST_LEAVE_SOURCE_GROUP   46

Definition at line 62 of file winsock.h.

◆ SIO_BASE_HANDLE

#define SIO_BASE_HANDLE   0x48000022

Definition at line 54 of file winsock.h.

◆ SO_UPDATE_CONNECT_CONTEXT

#define SO_UPDATE_CONNECT_CONTEXT   0x7010

Definition at line 38 of file winsock.h.

◆ TCP_KEEPALIVE

#define TCP_KEEPALIVE   3

Definition at line 42 of file winsock.h.

◆ TDI_RECEIVE_AT_DISPATCH_LEVEL

#define TDI_RECEIVE_AT_DISPATCH_LEVEL   0x00000800

Definition at line 79 of file winsock.h.

◆ TDI_RECEIVE_BROADCAST

#define TDI_RECEIVE_BROADCAST   0x00000004

Definition at line 70 of file winsock.h.

◆ TDI_RECEIVE_CONTROL_INFO

#define TDI_RECEIVE_CONTROL_INFO   0x00001000

Definition at line 80 of file winsock.h.

◆ TDI_RECEIVE_COPY_LOOKAHEAD

#define TDI_RECEIVE_COPY_LOOKAHEAD   0x00000200

Definition at line 77 of file winsock.h.

◆ TDI_RECEIVE_ENTIRE_MESSAGE

#define TDI_RECEIVE_ENTIRE_MESSAGE   0x00000400

Definition at line 78 of file winsock.h.

◆ TDI_RECEIVE_EXPEDITED

#define TDI_RECEIVE_EXPEDITED   0x00000040

Definition at line 74 of file winsock.h.

◆ TDI_RECEIVE_FORCE_INDICATION

#define TDI_RECEIVE_FORCE_INDICATION   0x00002000

Definition at line 81 of file winsock.h.

◆ TDI_RECEIVE_MULTICAST

#define TDI_RECEIVE_MULTICAST   0x00000008

Definition at line 71 of file winsock.h.

◆ TDI_RECEIVE_NO_PUSH

#define TDI_RECEIVE_NO_PUSH   0x00004000

Definition at line 82 of file winsock.h.

◆ TDI_RECEIVE_NO_RESPONSE_EXP

#define TDI_RECEIVE_NO_RESPONSE_EXP   0x00000100

Definition at line 76 of file winsock.h.

◆ TDI_RECEIVE_NORMAL

#define TDI_RECEIVE_NORMAL   0x00000020

Definition at line 73 of file winsock.h.

◆ TDI_RECEIVE_PARTIAL

#define TDI_RECEIVE_PARTIAL   0x00000010

Definition at line 72 of file winsock.h.

◆ TDI_RECEIVE_PEEK

#define TDI_RECEIVE_PEEK   0x00000080

Definition at line 75 of file winsock.h.

Typedef Documentation

◆ AFD_RECV_DATAGRAM_INFO

◆ AFD_RECV_INFO

typedef struct _AFD_RECV_INFO AFD_RECV_INFO

◆ PAFD_RECV_DATAGRAM_INFO

◆ PAFD_RECV_INFO

typedef struct _AFD_RECV_INFO * PAFD_RECV_INFO

Function Documentation

◆ uv__convert_to_localhost_if_unspecified()

int uv__convert_to_localhost_if_unspecified ( const struct sockaddr addr,
struct sockaddr_storage *  storage 
)

Definition at line 547 of file winsock.c.

548  {
549  struct sockaddr_in* dest4;
550  struct sockaddr_in6* dest6;
551 
552  if (addr == NULL)
553  return UV_EINVAL;
554 
555  switch (addr->sa_family) {
556  case AF_INET:
557  dest4 = (struct sockaddr_in*) storage;
558  memcpy(dest4, addr, sizeof(*dest4));
559  if (dest4->sin_addr.s_addr == 0)
560  dest4->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
561  return 0;
562  case AF_INET6:
563  dest6 = (struct sockaddr_in6*) storage;
564  memcpy(dest6, addr, sizeof(*dest6));
565  if (memcmp(&dest6->sin6_addr,
567  sizeof(uv_addr_ip6_any_.sin6_addr)) == 0) {
568  struct in6_addr init_sin6_addr = IN6ADDR_LOOPBACK_INIT;
569  dest6->sin6_addr = init_sin6_addr;
570  }
571  return 0;
572  default:
573  return UV_EINVAL;
574  }
575 }
#define NULL
Definition: cris-opc.c:27
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
#define AF_INET
Definition: sftypes.h:287
#define AF_INET6
Definition: sftypes.h:295
in_addr_t s_addr
Definition: sftypes.h:337
struct in6_addr sin6_addr
Definition: sftypes.h:375
struct in_addr sin_addr
Definition: sftypes.h:344
struct sockaddr_in6 uv_addr_ip6_any_
Definition: winsock.c:35
static int addr
Definition: z80asm.c:58

References addr, AF_INET, AF_INET6, memcpy(), NULL, in_addr::s_addr, sockaddr_in6::sin6_addr, sockaddr_in::sin_addr, and uv_addr_ip6_any_.

Referenced by uv__udp_try_send(), and uv_tcp_try_connect().