--- sbbs/src/xpdev/sockwrap.h 2018/04/24 16:41:24 1.1.1.1 +++ sbbs/src/xpdev/sockwrap.h 2018/04/24 16:45:21 1.1.1.2 @@ -2,13 +2,13 @@ /* Berkley/WinSock socket API wrappers */ -/* $Id: sockwrap.h,v 1.1.1.1 2018/04/24 16:41:24 root Exp $ */ +/* $Id: sockwrap.h,v 1.1.1.2 2018/04/24 16:45:21 root Exp $ */ /**************************************************************************** * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public License * @@ -98,13 +98,27 @@ typedef struct { #undef EWOULDBLOCK #define EWOULDBLOCK (WSAEWOULDBLOCK-WSABASEERR) +#ifndef EPROTOTYPE #define EPROTOTYPE (WSAEPROTOTYPE-WSABASEERR) +#endif +#ifndef ENOPROTOOPT #define ENOPROTOOPT (WSAENOPROTOOPT-WSABASEERR) +#endif +#ifndef EPROTONOSUPPORT #define EPROTONOSUPPORT (WSAEPROTONOSUPPORT-WSABASEERR) +#endif +#ifndef ESOCKTNOSUPPORT #define ESOCKTNOSUPPORT (WSAESOCKTNOSUPPORT-WSABASEERR) +#endif +#ifndef EOPNOTSUPP #define EOPNOTSUPP (WSAEOPNOTSUPP-WSABASEERR) +#endif +#ifndef EPFNOSUPPORT #define EPFNOSUPPORT (WSAEPFNOSUPPORT-WSABASEERR) +#endif +#ifndef EAFNOSUPPORT #define EAFNOSUPPORT (WSAEAFNOSUPPORT-WSABASEERR) +#endif #undef EADDRINUSE #define EADDRINUSE (WSAEADDRINUSE-WSABASEERR) @@ -129,6 +143,11 @@ typedef struct { #undef EINPROGRESS #define EINPROGRESS (WSAEINPROGRESS-WSABASEERR) +/* for shutdown() */ +#define SHUT_RD SD_RECEIVE +#define SHUT_WR SD_SEND +#define SHUT_RDWR SD_BOTH + #define s_addr S_un.S_addr #define socklen_t int @@ -167,35 +186,39 @@ socket_option_t* getSocketOptionList(void); int getSocketOptionByName(const char* name, int* level); -int sendfilesocket(int sock, int file, long *offset, long count); -int recvfilesocket(int sock, int file, long *offset, long count); +int sendfilesocket(int sock, int file, off_t* offset, off_t count); +int recvfilesocket(int sock, int file, off_t* offset, off_t count); BOOL socket_check(SOCKET sock, BOOL* rd_p, BOOL* wr_p, DWORD timeout); int retry_bind(SOCKET s, const struct sockaddr *addr, socklen_t addrlen ,uint retries, uint wait_secs, const char* prot - ,int (*lprintf)(int level, char *fmt, ...)); + ,int (*lprintf)(int level, const char *fmt, ...)); +int nonblocking_connect(SOCKET, struct sockaddr*, size_t, unsigned timeout /* seconds */); #ifdef __cplusplus } #endif -#ifndef SHUT_RDWR -#define SHUT_RDWR 2 /* for shutdown() */ -#endif - #ifndef IPPORT_HTTP -#define IPPORT_HTTP 80 +#define IPPORT_HTTP 80 #endif #ifndef IPPORT_FTP -#define IPPORT_FTP 21 +#define IPPORT_FTP 21 #endif #ifndef IPPORT_TELNET -#define IPPORT_TELNET 23 +#define IPPORT_TELNET 23 #endif #ifndef IPPORT_SMTP -#define IPPORT_SMTP 25 +#define IPPORT_SMTP 25 #endif #ifndef IPPORT_POP3 -#define IPPORT_POP3 110 +#define IPPORT_POP3 110 #endif +#ifndef IPPORT_IDENT +#define IPPORT_IDENT 113 +#endif +#ifndef IPPORT_SUBMISSION +#define IPPORT_SUBMISSION 587 +#endif + #endif /* Don't add anything after this line */