win32/compat/net.h
ccbb5182
 /*
c442ca9c
  *  Copyright (C) 2013-2019 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
  *  Copyright (C) 2009-2013 Sourcefire, Inc.
ccbb5182
  *
  *  Authors: aCaB <acab@clamav.net>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  *  MA 02110-1301, USA.
  */
 
 #ifndef __NET_H
 #define __NET_H
 
f7c0a571
 typedef int socklen_t;
 typedef int ssize_t;
 
4fa9557e
 #define F_GETFL 1
 #define F_SETFL 2
 #define O_NONBLOCK 1
 
f7c0a571
 int w32_socket(int domain, int type, int protocol);
 int w32_getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
 int w32_setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
 int w32_bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
 int w32_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
 ssize_t w32_send(int sockfd, const void *buf, size_t len, int flags);
 ssize_t w32_recv(int sockfd, void *buf, size_t len, int flags);
 int w32_closesocket(int sockfd);
 struct servent *w32_getservbyname(const char *name, const char *proto);
46bd6382
 #define endservent()
f7c0a571
 int w32_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
 void w32_freeaddrinfo(struct addrinfo *res);
 const char *w32_inet_ntop(int af, const void *src, char *dst, socklen_t size);
 int w32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
5eca45b5
 int poll_with_event(struct pollfd *fds, int nfds, int timeout, HANDLE event);
288b945f
 int w32_accept(SOCKET sockfd, const struct sockaddr *addr, socklen_t *addrlen);
3b074c78
 int w32_listen(int sockfd, int backlog);
 int w32_shutdown(int sockfd, int how);
b6187b63
 int w32_getpeername(int sd, struct sockaddr *name, int *namelen);
4eb14247
 char *w32_inet_ntoa(struct in_addr in);
4fa9557e
 int fcntl(int fd, int cmd, ...);
ccbb5182
 
 #endif