Annotation of sbbs/src/comio/comio.h, revision 1.1

1.1     ! root        1: /* comio.h */
        !             2: 
        !             3: /* Synchronet Serial Communications (COM) I/O Library */
        !             4: 
        !             5: /* $Id: comio.h,v 1.7 2007/05/16 22:32:15 rswindell Exp $ */
        !             6: 
        !             7: /****************************************************************************
        !             8:  * @format.tab-size 4          (Plain Text/Source Code File Header)                    *
        !             9:  * @format.use-tabs true       (see http://www.synchro.net/ptsc_hdr.html)              *
        !            10:  *                                                                                                                                                     *
        !            11:  * Copyright 2007 Rob Swindell - http://www.synchro.net/copyright.html         *
        !            12:  *                                                                                                                                                     *
        !            13:  * This library is free software; you can redistribute it and/or                       *
        !            14:  * modify it under the terms of the GNU Lesser General Public License          *
        !            15:  * as published by the Free Software Foundation; either version 2                      *
        !            16:  * of the License, or (at your option) any later version.                                      *
        !            17:  * See the GNU Lesser General Public License for more details: lgpl.txt or     *
        !            18:  * http://www.fsf.org/copyleft/lesser.html                                                                     *
        !            19:  *                                                                                                                                                     *
        !            20:  * Anonymous FTP access to the most recent released source is available at     *
        !            21:  * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net     *
        !            22:  *                                                                                                                                                     *
        !            23:  * Anonymous CVS access to the development source and modification history     *
        !            24:  * is available at cvs.synchro.net:/cvsroot/sbbs, example:                                     *
        !            25:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs login                       *
        !            26:  *     (just hit return, no password is necessary)                                                     *
        !            27:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src                *
        !            28:  *                                                                                                                                                     *
        !            29:  * For Synchronet coding style and modification guidelines, see                                *
        !            30:  * http://www.synchro.net/source.html                                                                          *
        !            31:  *                                                                                                                                                     *
        !            32:  * You are encouraged to submit any modifications (preferably in Unix diff     *
        !            33:  * format) via e-mail to [email protected]                                                                      *
        !            34:  *                                                                                                                                                     *
        !            35:  * Note: If this box doesn't appear square, then you need to fix your tabs.    *
        !            36:  ****************************************************************************/
        !            37: 
        !            38: #ifndef _COMIO_H
        !            39: #define _COMIO_H
        !            40: 
        !            41: #include <gen_defs.h>  /* BOOL */
        !            42: 
        !            43: #define COM_ERROR                                              -1
        !            44: 
        !            45: #ifdef _WIN32
        !            46:        #include <windows.h>
        !            47: 
        !            48:     #define COM_HANDLE                                 HANDLE
        !            49:        #define COM_HANDLE_INVALID                      INVALID_HANDLE_VALUE
        !            50:        #define COM_ERROR_VALUE                         GetLastError()
        !            51: /* Modem Status bits */
        !            52:        #define COM_CTS                                         MS_CTS_ON
        !            53:        #define COM_DSR                                         MS_DSR_ON
        !            54:        #define COM_RING                                        MS_RING_ON
        !            55:        #define COM_DCD                                         MS_RLSD_ON
        !            56: #else
        !            57:        #include <termios.h>
        !            58: 
        !            59:     #define COM_HANDLE                                 int
        !            60:        #define COM_HANDLE_INVALID                      -1
        !            61:        #define COM_ERROR_VALUE                         errno
        !            62: 
        !            63: /* Stuff we apparently don't care about... 
        !            64:  *
        !            65:  *     TIOCM_LE   Line Enable.
        !            66:  *     TIOCM_DTR  Data Terminal Ready.
        !            67:  *     TIOCM_RTS  Request To Send.
        !            68:  *     TIOCM_ST   Secondary Transmit.
        !            69:  *     TIOCM_SR   Secondary Receive.
        !            70:  */
        !            71: 
        !            72:        #define COM_CTS                                         TIOCM_CTS  /* Clear To Send. */
        !            73: #ifdef TIOCM_CAR
        !            74:        #define COM_DCD                                         TIOCM_CAR  /* Carrier Detect. */
        !            75: #else
        !            76:        #define COM_DCD                                         TIOCM_CD   /* Carrier Detect (synonym). */
        !            77: #endif
        !            78: #ifdef TIOCM_RNG
        !            79:        #define COM_RING                                        TIOCM_RNG  /* Ring Indication. */
        !            80: #else
        !            81:        #define COM_RING                                        TIOCM_RI   /* Ring Indication (synonym). */
        !            82: #endif
        !            83:        #define COM_DSR                                         TIOCM_DSR  /* Data Set Ready. */
        !            84: 
        !            85: #endif
        !            86: 
        !            87: /**************/
        !            88: /* Prototypes */
        !            89: /**************/
        !            90: 
        !            91: #if defined(__cplusplus)
        !            92: extern "C" {
        !            93: #endif
        !            94: 
        !            95: char*          comVersion(char* str, size_t len);
        !            96: COM_HANDLE     comOpen(const char* device);
        !            97: BOOL           comClose(COM_HANDLE);
        !            98: long           comGetBaudRate(COM_HANDLE);
        !            99: BOOL           comSetBaudRate(COM_HANDLE, ulong rate);
        !           100: int                    comGetModemStatus(COM_HANDLE);
        !           101: int                    comRaiseDTR(COM_HANDLE);
        !           102: int                    comLowerDTR(COM_HANDLE);
        !           103: BOOL           comWriteByte(COM_HANDLE, BYTE);
        !           104: int                    comWriteBuf(COM_HANDLE, const BYTE*, size_t buflen);
        !           105: int                    comWriteString(COM_HANDLE, const char*);
        !           106: BOOL           comReadByte(COM_HANDLE, BYTE*);
        !           107: size_t         comReadBuf(COM_HANDLE, char* buf, size_t buflen
        !           108:                                            ,const char* terminators, int timeout /* in milliseconds */);
        !           109: size_t         comReadLine(COM_HANDLE, char* buf, size_t buflen
        !           110:                                                ,int timeout /* in milliseconds */);
        !           111: BOOL           comPurgeInput(COM_HANDLE);
        !           112: BOOL           comPurgeOutput(COM_HANDLE);
        !           113: 
        !           114: #if defined(__cplusplus)
        !           115: }
        !           116: #endif
        !           117: 
        !           118: 
        !           119: #endif /* Don't add anything after this #endif statement */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.