File:  [Coherent Logic Development] / freem / src / io_socket.h
Revision 1.4: download - view: text, annotated - select for diffs
Mon Mar 24 02:54:11 2025 UTC (8 days, 21 hours ago) by snw
Branches: MAIN
CVS tags: v0-62-3, HEAD
Socket I/O compat fixes for OS/2

/*
 *   $Id: io_socket.h,v 1.4 2025/03/24 02:54:11 snw Exp $
 *    socket i/o support
 *
 *  
 *   Author: Serena Willis <snw@coherent-logic.com>
 *    Copyright (C) 1998 MUG Deutschland
 *    Copyright (C) 2020, 2025 Coherent Logic Development LLC
 *
 *
 *   This file is part of FreeM.
 *
 *   FreeM is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Affero Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   FreeM is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Affero Public License for more details.
 *
 *   You should have received a copy of the GNU Affero Public License
 *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
 *
 *   $Log: io_socket.h,v $
 *   Revision 1.4  2025/03/24 02:54:11  snw
 *   Socket I/O compat fixes for OS/2
 *
 *   Revision 1.3  2025/03/09 19:14:25  snw
 *   First phase of REUSE compliance and header reformat
 *
 *
 * SPDX-FileCopyrightText:  (C) 2025 Coherent Logic Development LLC
 * SPDX-License-Identifier: AGPL-3.0-or-later
 **/

#if !defined(_IO_SOCKET_H)
# define _IO_SOCKET_H

#if !defined(MSDOS)
# include <sys/socket.h>
# include <arpa/inet.h>
#endif

#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(_SCO_DS)
# include <netinet/in.h>
#endif

typedef struct io_socket {

    int sck;					/* socket descriptor */
    int typ;					/* type of socket (SOCK_STREAM or SOCK_DGRAM) */

#if !defined(MSDOS) && !defined(__OS2__)
    struct sockaddr_in srv;		/* remote connection address */    
#endif
    
    short connected;			/* TRUE if connected (only applies if typ == SOCK_STREAM) */

    /* FreeM I/O channel */
    int io_channel;

} io_socket;

extern io_socket *io_sockets[MAXSCK];

extern short msck_open (int channel, char *addr_string);
extern short msck_connect (int channel);
extern short msck_write (int channel, char *buf, short length);
extern short msck_read (int channel, char *buf, long sck_timeout, short sck_timeoutms, short length);
extern short msck_get_terminator (int channel, char *buf);
extern short msck_close (int channel);
#endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>