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/msgport.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 sdk/net/msgport.h (limited to 'sdk/net/msgport.h') diff --git a/sdk/net/msgport.h b/sdk/net/msgport.h new file mode 100644 index 0000000..f7817e4 --- /dev/null +++ b/sdk/net/msgport.h @@ -0,0 +1,47 @@ +/* + * Portable network messaging routines. + * $Id$ + * Copyright (c) 1997 by Tycho Softworks. + * For conditions of distribution and reuse see product license. + */ + +#ifndef __NET_MSGPORT_H__ +#define __NET_MSGPORT_H__ + +#ifndef __NET_SOCKET_H__ +#include +#endif + +typedef struct +{ + union + { + struct sockaddr_in addr; + long len; + } header; + ushort sequence; + uchar body[ EMPTY ]; +} SOCKMSG; + +/* msgport control options */ + +enum +{ + MSGPORT_TIMEOUT +}; + +#define attach_tcp(host, port) getsocket(host, port, SOCK_STREAM) +#define attach_udp(host, port) getsocket(host, port, SOCK_DGRAM) + +#ifdef __NAMESPACE +#define create_msgport __NAMESPACE(create_msgport) +#define send_msgport __NAMESPACE(send_msgport) +#define recv_msgport __NAMESPACE(recv_msgport) +#define reply_msgport __NAMESPACE(reply_msgport) +#endif + +SOCKET create_msgport(char *mask, int port, int backlog); +size_t send_msgport(SOCKET so, SOCKMSG *buf, size_t len, bool inc); +size_t recv_msgport(SOCKET so, SOCKMSG *buf, size_t maxlen, bool any); +size_t reply_msgport(SOCKET so, SOCKMSG *buf, SOCKMSG *org, size_t len); +#endif -- cgit v1.2.3-54-g00ecf