1: /*
2: * $Id: io_socket.h,v 1.4 2025/03/24 02:54:11 snw Exp $
3: * socket i/o support
4: *
5: *
6: * Author: Serena Willis <snw@coherent-logic.com>
7: * Copyright (C) 1998 MUG Deutschland
8: * Copyright (C) 2020, 2025 Coherent Logic Development LLC
9: *
10: *
11: * This file is part of FreeM.
12: *
13: * FreeM is free software: you can redistribute it and/or modify
14: * it under the terms of the GNU Affero Public License as published by
15: * the Free Software Foundation, either version 3 of the License, or
16: * (at your option) any later version.
17: *
18: * FreeM is distributed in the hope that it will be useful,
19: * but WITHOUT ANY WARRANTY; without even the implied warranty of
20: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21: * GNU Affero Public License for more details.
22: *
23: * You should have received a copy of the GNU Affero Public License
24: * along with FreeM. If not, see <https://www.gnu.org/licenses/>.
25: *
26: * $Log: io_socket.h,v $
27: * Revision 1.4 2025/03/24 02:54:11 snw
28: * Socket I/O compat fixes for OS/2
29: *
30: * Revision 1.3 2025/03/09 19:14:25 snw
31: * First phase of REUSE compliance and header reformat
32: *
33: *
34: * SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
35: * SPDX-License-Identifier: AGPL-3.0-or-later
36: **/
37:
38: #if !defined(_IO_SOCKET_H)
39: # define _IO_SOCKET_H
40:
41: #if !defined(MSDOS)
42: # include <sys/socket.h>
43: # include <arpa/inet.h>
44: #endif
45:
46: #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(_SCO_DS)
47: # include <netinet/in.h>
48: #endif
49:
50: typedef struct io_socket {
51:
52: int sck; /* socket descriptor */
53: int typ; /* type of socket (SOCK_STREAM or SOCK_DGRAM) */
54:
55: #if !defined(MSDOS) && !defined(__OS2__)
56: struct sockaddr_in srv; /* remote connection address */
57: #endif
58:
59: short connected; /* TRUE if connected (only applies if typ == SOCK_STREAM) */
60:
61: /* FreeM I/O channel */
62: int io_channel;
63:
64: } io_socket;
65:
66: extern io_socket *io_sockets[MAXSCK];
67:
68: extern short msck_open (int channel, char *addr_string);
69: extern short msck_connect (int channel);
70: extern short msck_write (int channel, char *buf, short length);
71: extern short msck_read (int channel, char *buf, long sck_timeout, short sck_timeoutms, short length);
72: extern short msck_get_terminator (int channel, char *buf);
73: extern short msck_close (int channel);
74: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>