ftp://ftp.metalab.unc.edu/pub/Linux/apps/serialcomm/fax/efax-0.9.tar.gz
[efax.git] / efaxio.h
1 #ifndef _EFAXIO_H
2 #define _EFAXIO_H
3
4 #include "efaxos.h"             /* TFILE definition */
5
6 #ifndef uchar
7 #define uchar unsigned char
8 #endif
9
10 #define CMDBUFSIZE 256          /* longest possible command or response */
11 #define DLE_ETX "\020\003"      /* DLE-ETX (end of data) string */
12 #define CAN_STR "\030"          /* CAN (cancel reception) string */
13 #define TO_RESET  50            /* t/o for modem reset commands (>>2.6s) */
14 #define T_CMD     1             /* pause before each modem command */
15 #define MAXDCEBUF  32           /* max bytes allowed in buffer when write */
16 #define MINWRITE   64           /* minimum bytes to write() to modem */
17
18 enum promptcodes {              /* codes for modem prompts */
19    BUSY = 'B', CONNECT = 'C', DATA='D', ERROR = 'E', 
20    MODULATION='M', NO = 'N', OK = 'O', RING = 'R', VCONNECT = 'V' } ;
21
22                       /* Modem features */
23
24 extern int c1, c20 ;            /* use class 1/class 2.0 */
25 extern int c2 ;                 /* force class 2 */
26 extern int cmdpause ;           /* delay before each init command */
27 extern int vfc ;                /* virtual flow control */
28 extern uchar startchar ;        /* character to start reception */
29 extern int lockpolldelay ;      /* milliseconds between checks of lock files */
30
31                                 /* response detector lookup tables */
32 extern uchar rd_allowed[], rd_nexts[] ; 
33 #define RD_BEGIN 0x01
34 #define RD_END   0x20
35
36                  /* Modem interface routines */
37
38 int cmd ( TFILE *f, char *s , int t ) ;
39 int ckcmd ( TFILE *f, int *err, char *s, int t, int r ) ;
40 int modemsync ( TFILE *f ) ;
41 char *sresponse ( char *s, int *ip ) ;
42 char *strinresp ( char *s ) ;
43 int getresp ( char *s, char *buf, int len ) ;
44
45 int setup ( TFILE *f, char **cmds, int ignerr ) ;
46
47 int sendbuf ( TFILE *f, uchar *p, int n, int dcecps ) ;
48
49 int begin_session ( TFILE *f, char *fname, int reverse, int hwfc, char **lkfile, 
50                    ttymodes mode, void (*onsig) (int) ) ;
51
52 int end_session ( TFILE *f, char **zcmd,  char **lkfile, int sync ) ;
53
54 #endif