modem.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. typedef struct {
  10. char *t;
  11. int fd;
  12. int cfd;
  13. char *id;
  14. char response[128];
  15. char error[128];
  16. int fax;
  17. char phase;
  18. char ftsi[128]; /* remote ID */
  19. long fdcs[8]; /* frame information */
  20. long fpts[8]; /* page reception response */
  21. long fet; /* post page message */
  22. long fhng; /* call termination status */
  23. int pageno; /* current page number */
  24. char pageid[128]; /* current page file */
  25. int pagefd; /* current page fd */
  26. int valid; /* valid page responses */
  27. long time; /* timestamp */
  28. int pid;
  29. char ibuf[1024]; /* modem input buffering */
  30. char *iptr;
  31. long icount;
  32. Biobuf *bp; /* file input buffering */
  33. /* FDCS parameters */
  34. long wd; /* width */
  35. long vr; /* resolution */
  36. long ln; /* page size (length) */
  37. long df; /* huffman encoding */
  38. } Modem;
  39. enum { /* ResultCodes */
  40. Rok = 0,
  41. Rconnect,
  42. Rring,
  43. Rfailure,
  44. Rrerror,
  45. Rcontinue,
  46. Rhangup,
  47. Rnoise,
  48. };
  49. enum { /* ErrorCodes */
  50. Eok = 0, /* no error */
  51. Eattn, /* can't get modem's attention */
  52. Enoresponse, /* no response from modem */
  53. Enoanswer, /* no answer from other side */
  54. Enofax, /* other side isn't a fax machine */
  55. Eincompatible, /* transmission incompatible with receiver */
  56. Esys, /* system call error */
  57. Eproto, /* fax protocol botch */
  58. };
  59. enum { /* things that are valid */
  60. Vfdcs = 0x0001, /* page responses */
  61. Vftsi = 0x0002,
  62. Vfpts = 0x0004,
  63. Vfet = 0x0008,
  64. Vfhng = 0x0010,
  65. Vwd = 0x4000,
  66. Vtype = 0x8000,
  67. };
  68. /* fax2modem.c */
  69. extern int initfaxmodem(Modem*);
  70. extern int fcon(Modem*);
  71. extern int ftsi(Modem*);
  72. extern int fdcs(Modem*);
  73. extern int fcfr(Modem*);
  74. extern int fpts(Modem*);
  75. extern int fet(Modem*);
  76. extern int fhng(Modem*);
  77. /* fax2receive.c */
  78. extern int faxreceive(Modem*, char*);
  79. /* fax2send.c */
  80. extern int faxsend(Modem*, int, char*[]);
  81. /* modem.c */
  82. extern int setflow(Modem*, int);
  83. extern int setspeed(Modem*, int);
  84. extern int rawmchar(Modem*, char*);
  85. extern int getmchar(Modem*, char*, long);
  86. extern int putmchar(Modem*, char*);
  87. extern int command(Modem*, char*);
  88. extern int response(Modem*, int);
  89. extern void initmodem(Modem*, int, int, char*, char*);
  90. extern void xonoff(Modem*, int);
  91. /* spool.c */
  92. extern void setpageid(char*, char*, long, int, int);
  93. extern int createfaxfile(Modem*, char*);
  94. extern int openfaxfile(Modem*, char*);
  95. /* subr.c */
  96. extern void verbose(char*, ...);
  97. extern void error(char*, ...);
  98. extern int seterror(Modem*, int);
  99. extern void faxrlog(Modem*, int);
  100. extern void faxxlog(Modem*, int);
  101. extern int vflag;