diff options
author | William Harrington <kb0iic@berzerkula.org> | 2025-01-14 16:06:02 -0600 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2025-01-14 16:06:02 -0600 |
commit | 0cc9b20c15460213e488bf5e70963b941482f628 (patch) | |
tree | bb0143245583ec846630f39bfa2258dba640ccd7 /sdk/net/msgport.h | |
parent | 0e084ade5069756d487b5c948c48b777e37c00c9 (diff) |
Add source.
Diffstat (limited to 'sdk/net/msgport.h')
-rw-r--r-- | sdk/net/msgport.h | 47 |
1 files changed, 47 insertions, 0 deletions
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 <net/socket.h> +#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 |