Annotation of coherent/g/usr/lib/uucp/tay104/prot.h, revision 1.1.1.1

1.1       root        1: /* prot.h
                      2:    Protocol header file.
                      3: 
                      4:    Copyright (C) 1991, 1992 Ian Lance Taylor
                      5: 
                      6:    This file is part of the Taylor UUCP package.
                      7: 
                      8:    This program is free software; you can redistribute it and/or
                      9:    modify it under the terms of the GNU General Public License as
                     10:    published by the Free Software Foundation; either version 2 of the
                     11:    License, or (at your option) any later version.
                     12: 
                     13:    This program is distributed in the hope that it will be useful, but
                     14:    WITHOUT ANY WARRANTY; without even the implied warranty of
                     15:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
                     16:    General Public License for more details.
                     17: 
                     18:    You should have received a copy of the GNU General Public License
                     19:    along with this program; if not, write to the Free Software
                     20:    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
                     21: 
                     22:    The author of the program may be contacted at [email protected] or
                     23:    c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
                     24:    */
                     25: 
                     26: /* We need the definition of uuconf_cmdtab to declare the protocol
                     27:    parameter arrays.  */
                     28: #ifndef UUCONF_H
                     29: #include "uuconf.h"
                     30: #endif
                     31: 
                     32: #if ANSI_C
                     33: /* These structures are used in prototypes but are not defined in this
                     34:    header file.  */
                     35: struct sdaemon;
                     36: struct sconnection;
                     37: struct stransfer;
                     38: #endif
                     39: 
                     40: /* The sprotocol structure holds information and functions for a specific
                     41:    protocol (e.g. the 'g' protocol).  */
                     42: 
                     43: struct sprotocol
                     44: {
                     45:   /* The name of the protocol (e.g. 'g').  */
                     46:   char bname;
                     47:   /* Reliability requirements, an or of UUCONF_RELIABLE_xxx defines
                     48:      from uuconf.h.  */
                     49:   int ireliable;
                     50:   /* The maximum number of channels this protocol can support.  */
                     51:   int cchans;
                     52:   /* Protocol parameter commands.  */
                     53:   struct uuconf_cmdtab *qcmds;
                     54:   /* A routine to start the protocol.  If *pzlog is set to be
                     55:      non-NULL, it is an informative message to be logged; it should
                     56:      then be passed to ubuffree.  */
                     57:   boolean (*pfstart) P((struct sdaemon *qdaemon, char **pzlog));
                     58:   /* Shutdown the protocol.  */
                     59:   boolean (*pfshutdown) P((struct sdaemon *qdaemon));
                     60:   /* Send a command to the other side.  */
                     61:   boolean (*pfsendcmd) P((struct sdaemon *qdaemon, const char *z,
                     62:                          int ilocal, int iremote));
                     63:   /* Get buffer to space to fill with data.  This should set *pcdata
                     64:      to the amount of data desired.  */
                     65:   char *(*pzgetspace) P((struct sdaemon *qdaemon, size_t *pcdata));
                     66:   /* Send data to the other side.  The argument z must be a return
                     67:      value of pzgetspace.  The ipos argument is the file position, and
                     68:      is ignored by most protocols.  */
                     69:   boolean (*pfsenddata) P((struct sdaemon *qdaemon, char *z, size_t c,
                     70:                           int ilocal, int iremote, long ipos));
                     71:   /* Wait for data to come in and call fgot_data with it until
                     72:      fgot_data sets *pfexit.  */
                     73:   boolean (*pfwait) P((struct sdaemon *qdaemon));
                     74:   /* Handle any file level actions that need to be taken.  If a file
                     75:      transfer is starting rather than ending, fstart is TRUE.  If the
                     76:      file is being sent rather than received, fsend is TRUE.  If
                     77:      fstart and fsend are both TRUE, cbytes holds the size of the
                     78:      file.  If *pfhandled is set to TRUE, then the protocol routine
                     79:      has taken care of queueing up qtrans for the next action.  */
                     80:   boolean (*pffile) P((struct sdaemon *qdaemon, struct stransfer *qtrans,
                     81:                       boolean fstart, boolean fsend, long cbytes,
                     82:                       boolean *pfhandled));
                     83: };
                     84: 
                     85: /* Send data to the other system.  If the fread argument is TRUE, this
                     86:    will also receive data into the receive buffer abPrecbuf; fread is
                     87:    passed as TRUE if the protocol expects data to be coming back, to
                     88:    make sure the input buffer does not fill up.  Returns FALSE on
                     89:    error.  */
                     90: extern boolean fsend_data P((struct sconnection *qconn,
                     91:                             const char *zsend, size_t csend,
                     92:                             boolean fdoread));
                     93: 
                     94: /* Receive data from the other system when there is no data to send.
                     95:    The cneed argument is the amount of data desired and the ctimeout
                     96:    argument is the timeout in seconds.  This will set *pcrec to the
                     97:    amount of data received.  It will return FALSE on error.  If a
                     98:    timeout occurs, it will return TRUE with *pcrec set to zero.  */
                     99: extern boolean freceive_data P((struct sconnection *qconn, size_t cneed,
                    100:                                size_t *pcrec, int ctimeout,
                    101:                                boolean freport));
                    102: 
                    103: /* Get one character from the remote system, going through the
                    104:    procotol buffering.  The ctimeout argument is the timeout in
                    105:    seconds, and the freport argument is TRUE if errors should be
                    106:    reported (when closing a connection it is pointless to report
                    107:    errors).  This returns a character or -1 on a timeout or -2 on an
                    108:    error.  */
                    109: extern int breceive_char P((struct sconnection *qconn,
                    110:                            int ctimeout, boolean freport));
                    111: 
                    112: /* Compute a 32 bit CRC of a data buffer, given an initial CRC.  */
                    113: extern unsigned long icrc P((const char *z, size_t c, unsigned long ick));
                    114: 
                    115: /* The initial CRC value to use for a new buffer.  */
                    116: #if ANSI_C
                    117: #define ICRCINIT (0xffffffffUL)
                    118: #else
                    119: #define ICRCINIT ((unsigned long) 0xffffffffL)
                    120: #endif
                    121: 
                    122: /* The size of the receive buffer.  */
                    123: #define CRECBUFLEN (16384)
                    124: 
                    125: /* Buffer to hold received data.  */
                    126: extern char abPrecbuf[CRECBUFLEN];
                    127: 
                    128: /* Index of start of data in abPrecbuf.  */
                    129: extern int iPrecstart;
                    130: 
                    131: /* Index of end of data (first byte not included in data) in abPrecbuf.  */
                    132: extern int iPrecend;
                    133: 
                    134: /* There are a couple of variables and functions that are shared by
                    135:    the 'i' and 'j' protocols (the 'j' protocol is just a wrapper
                    136:    around the 'i' protocol).  These belong in a separate header file,
                    137:    protij.h, but I don't want to create one for just a couple of
                    138:    things.  */
                    139: 
                    140: /* An escape sequence of characters for the 'j' protocol to avoid
                    141:    (protocol parameter ``avoid'').  */
                    142: extern const char *zJavoid_parameter;
                    143: 
                    144: /* Timeout to use when sending the 'i' protocol SYNC packet (protocol
                    145:    parameter ``sync-timeout'').  */
                    146: extern int cIsync_timeout;
                    147: 
                    148: /* Shared startup routine for the 'i' and 'j' protocols.  */
                    149: extern boolean fijstart P((struct sdaemon *qdaemon, char **pzlog,
                    150:                           int imaxpacksize,
                    151:                           boolean (*pfsend) P((struct sconnection *qconn,
                    152:                                                const char *zsend,
                    153:                                                size_t csend,
                    154:                                                boolean fdoread)),
                    155:                           boolean (*pfreceive) P((struct sconnection *qconn,
                    156:                                                   size_t cneed,
                    157:                                                   size_t *pcrec,
                    158:                                                   int ctimeout,
                    159:                                                   boolean freport))));
                    160: 
                    161: /* Prototypes for 'g' protocol functions.  */
                    162: 
                    163: extern struct uuconf_cmdtab asGproto_params[];
                    164: extern boolean fgstart P((struct sdaemon *qdaemon, char **pzlog));
                    165: extern boolean fbiggstart P((struct sdaemon *qdaemon, char **pzlog));
                    166: extern boolean fgshutdown P((struct sdaemon *qdaemon));
                    167: extern boolean fgsendcmd P((struct sdaemon *qdaemon, const char *z,
                    168:                            int ilocal, int iremote));
                    169: extern char *zggetspace P((struct sdaemon *qdaemon, size_t *pcdata));
                    170: extern boolean fgsenddata P((struct sdaemon *qdaemon, char *z, size_t c,
                    171:                             int ilocal, int iremote, long ipos));
                    172: extern boolean fgwait P((struct sdaemon *qdaemon));
                    173: 
                    174: /* Prototypes for 'f' protocol functions.  */
                    175: 
                    176: extern struct uuconf_cmdtab asFproto_params[];
                    177: extern boolean ffstart P((struct sdaemon *qdaemon, char **pzlog));
                    178: extern boolean ffshutdown P((struct sdaemon *qdaemon));
                    179: extern boolean ffsendcmd P((struct sdaemon *qdaemon, const char *z,
                    180:                            int ilocal, int iremote));
                    181: extern char *zfgetspace P((struct sdaemon *qdaemon, size_t *pcdata));
                    182: extern boolean ffsenddata P((struct sdaemon *qdaemon, char *z, size_t c,
                    183:                             int ilocal, int iremote, long ipos));
                    184: extern boolean ffwait P((struct sdaemon *qdaemon));
                    185: extern boolean fffile P((struct sdaemon *qdaemon, struct stransfer *qtrans,
                    186:                         boolean fstart, boolean fsend, long cbytes,
                    187:                         boolean *pfhandled));
                    188: 
                    189: /* Prototypes for 't' protocol functions.  */
                    190: 
                    191: extern struct uuconf_cmdtab asTproto_params[];
                    192: extern boolean ftstart P((struct sdaemon *qdaemon, char **pzlog));
                    193: extern boolean ftshutdown P((struct sdaemon *qdaemon));
                    194: extern boolean ftsendcmd P((struct sdaemon *qdaemon, const char *z,
                    195:                            int ilocal, int iremote));
                    196: extern char *ztgetspace P((struct sdaemon *qdaemon, size_t *pcdata));
                    197: extern boolean ftsenddata P((struct sdaemon *qdaemon, char *z, size_t c,
                    198:                             int ilocal, int iremote, long ipos));
                    199: extern boolean ftwait P((struct sdaemon *qdaemon));
                    200: extern boolean ftfile P((struct sdaemon *qdaemon, struct stransfer *qtrans,
                    201:                         boolean fstart, boolean fsend, long cbytes,
                    202:                         boolean *pfhandled));
                    203: 
                    204: /* Prototypes for 'e' protocol functions.  */
                    205: 
                    206: extern struct uuconf_cmdtab asEproto_params[];
                    207: extern boolean festart P((struct sdaemon *qdaemon, char **pzlog));
                    208: extern boolean feshutdown P((struct sdaemon *qdaemon));
                    209: extern boolean fesendcmd P((struct sdaemon *qdaemon, const char *z,
                    210:                            int ilocal, int iremote));
                    211: extern char *zegetspace P((struct sdaemon *qdaemon, size_t *pcdata));
                    212: extern boolean fesenddata P((struct sdaemon *qdaemon, char *z, size_t c,
                    213:                             int ilocal, int iremote, long ipos));
                    214: extern boolean fewait P((struct sdaemon *qdaemon));
                    215: extern boolean fefile P((struct sdaemon *qdaemon, struct stransfer *qtrans,
                    216:                         boolean fstart, boolean fsend, long cbytes,
                    217:                         boolean *pfhandled));
                    218: 
                    219: /* Prototypes for 'i' protocol functions.  */
                    220: 
                    221: extern struct uuconf_cmdtab asIproto_params[];
                    222: extern boolean fistart P((struct sdaemon *qdaemon, char **pzlog));
                    223: extern boolean fishutdown P((struct sdaemon *qdaemon));
                    224: extern boolean fisendcmd P((struct sdaemon *qdaemon, const char *z,
                    225:                            int ilocal, int iremote));
                    226: extern char *zigetspace P((struct sdaemon *qdaemon, size_t *pcdata));
                    227: extern boolean fisenddata P((struct sdaemon *qdaemon, char *z, size_t c,
                    228:                             int ilocal, int iremote, long ipos));
                    229: extern boolean fiwait P((struct sdaemon *qdaemon));
                    230: 
                    231: /* Prototypes for 'j' protocol functions.  The 'j' protocol mostly
                    232:    uses the 'i' protocol functions, but it has a couple of functions
                    233:    of its own.  */
                    234: extern boolean fjstart P((struct sdaemon *qdaemon, char **pzlog));
                    235: extern boolean fjshutdown P((struct sdaemon *qdaemon));
                    236: 
                    237: /* Prototypes for 'a' protocol functions (these use 'z' as the second
                    238:    character because 'a' is a modified Zmodem protocol).  */
                    239: extern struct uuconf_cmdtab asZproto_params[];
                    240: extern boolean fzstart P((struct sdaemon *qdaemon, char **pzlog));
                    241: extern boolean fzshutdown P((struct sdaemon *qdaemon));
                    242: extern boolean fzsendcmd P((struct sdaemon *qdaemon, const char *z,
                    243:                            int ilocal, int iremote));
                    244: extern char *zzgetspace P((struct sdaemon *qdaemon, size_t *pcdata));
                    245: extern boolean fzsenddata P((struct sdaemon *qdaemon, char *z, size_t c,
                    246:                             int ilocal, int iremote, long ipos));
                    247: extern boolean fzwait P((struct sdaemon *qdaemon));
                    248: extern boolean fzfile P((struct sdaemon *qdaemon, struct stransfer *qtrans,
                    249:                         boolean fstart, boolean fsend, long cbytes,
                    250:                         boolean *pfhandled));

unix.superglobalmegacorp.com

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