From 0cc9b20c15460213e488bf5e70963b941482f628 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Tue, 14 Jan 2025 16:06:02 -0600 Subject: Add source. --- sdk/net/socket.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sdk/net/socket.h (limited to 'sdk/net/socket.h') diff --git a/sdk/net/socket.h b/sdk/net/socket.h new file mode 100644 index 0000000..b9bd190 --- /dev/null +++ b/sdk/net/socket.h @@ -0,0 +1,61 @@ +/* + * Portable include for access of socket services. + * $Id$ + * Copyright (c) 1997 by Tycho Softworks. + * For conditions of distribution and reuse see product license. + */ + +#ifndef __NET_SOCKET_H__ +#define __NET_SOCKET_H__ + +#ifndef __STD_FILES_H__ +#include +#endif + +#ifndef __STD_TYPES_H__ +#include +#endif + +#include +#include +#include +#include + +typedef int SOCKET; +#define INVALID_SOCKET -1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __NAMESPACE +#define init_sockets __NAMESPACE(init_sockets) +#define gethost __NAMESPACE(gethost) +#define getservice __NAMESPACE(getservice) +#define peername __NAMESPACE(peername) +#define peeraddr __NAMESPACE(peeraddr) +#define homename __NAMESPACE(homename) +#define homeaddr __NAMESPACE(homeaddr) +#define endsocket __NAMESPACE(endsocket) +#define udpsocket __NAMESPACE(udpsocket) +#define tcpsocket __NAMESPACE(tcpsocket) +#define getsocket __NAMESPACE(getsocket) +#endif + +bool init_sockets(void); +struct hostent *gethost(const char *host); +struct in_addr *getnetaddr(const char *addr); +int getservice(const char *service); +char *peername(SOCKET so); +char *peeraddr(SOCKET so); +char *homename(SOCKET so); +char *homeaddr(SOCKET so); +void endsocket(SOCKET so); +SOCKET udpsocket(char *mask, int port); +SOCKET tcpsocket(char *mask, int port, int backlog); +SOCKET getsocket(const char *host, int port, int socktype); +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.2.3-54-g00ecf