home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / fax-3.2.1 / cmd / faxspooler / spooler.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-31  |  3.7 KB  |  94 lines

  1. /*
  2.   This file is part of the NetFax system.
  3.  
  4.   (c) Copyright 1989 by David M. Siegel. 
  5.       All rights reserved.
  6.  
  7.     This program is free software; you can redistribute it and/or modify
  8.     it under the terms of the GNU General Public License as published by
  9.     the Free Software Foundation.
  10.  
  11.     This program is distributed in the hope that it will be useful, 
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of 
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program; if not, write to the Free Software
  18.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. #ifndef in_spooler_h
  22. #define in_spooler_h 1
  23.  
  24. #include <sys/types.h>
  25. #include <sys/time.h>
  26.  
  27. #include "../../lib/libutil/list.h"
  28.  
  29. #define MAX_USER_LEN       16
  30. #define MAX_FILENAME_LEN  128
  31. #define MAX_PHONE_LEN      128
  32.  
  33. #define RECIP_F_SENT      00000001    /* fax was sent            */
  34. #define RECIP_F_DIALER       00000002    /* dialer failure, code valid    */
  35. #define RECIP_F_FAILED      00000004    /* other send failure occured    */
  36.  
  37. typedef enum {
  38.     SEND_STATUS_PENDING,        /* fax hasn't been sent yet    */
  39.     SEND_STATUS_SENDING,        /* fax is being sent        */
  40.     SEND_STATUS_SENT,            /* fax was sent            */
  41.     SEND_STATUS_DIALER,            /* dialer failure, code valid    */
  42.     SEND_STATUS_FAILED,            /* other send failure occured    */
  43.     SEND_STATUS_GIVEUP,            /* given up on trying to send    */
  44. } send_status;
  45.  
  46. typedef struct _recip {
  47.     send_status status;            /* status status        */
  48.     int         dialer_code;        /* dialer failure code        */
  49.     char     phone[MAX_PHONE_LEN];    /* phone number of recipient    */
  50.     int         attempts;            /* number of delivery attempts  */
  51.     time_t   time_first;        /* time of first delivery try    */
  52.     time_t   time_last;            /* time of last delivery try    */
  53.     time_t   total_time;        /* total connect time for job    */
  54. } Recip;
  55.  
  56. #define QUEUE_F_USER      00000001    /* got user field        */
  57. #define QUEUE_F_EMAIL      00000002    /* email delivery notification    */
  58. #define QUEUE_F_RECIP      00000004    /* got at least one receipient    */
  59. #define QUEUE_F_RETRY      00000010    /* retry interval        */
  60. #define QUEUE_F_TIME      00000020    /* last time any delivery tried    */
  61. #define QUEUE_F_PAGES      00000040    /* got pages field        */
  62. #define QUEUE_F_FILE      00000100    /* got file field        */
  63. #define QUEUE_F_DELETED      00000200    /* entry has been deleted    */
  64. #define QUEUE_F_RUNNING      00000400    /* a recip is being run        */
  65.  
  66. typedef struct _queue_entry {
  67.     int         flags;            /* status flags            */
  68.     char     file[MAX_FILENAME_LEN];    /* queue base filename        */
  69.     char     user[MAX_USER_LEN];    /* computer username of sender    */
  70.     int         retry;            /* retry interval, in seconds    */
  71.     int         pages;            /* total pages to send        */
  72.     time_t   time;            /* time of last delivery    */
  73.     LIST *   recip_list;        /* list of recipients        */
  74. } QueueEntry;
  75.  
  76. typedef struct _spooler_data {
  77.     int numb_fm;        /* number of faxmodems in system    */
  78.     FaxModem *fmp;        /* pointer to data for the modems    */
  79.     int *fm_busy;        /* list of modem busy flags        */
  80.     LIST *q;            /* spooler job queue            */
  81.     char *out_qdir;        /* outgoing queue directory        */
  82.     char *in_qdir;        /* incoming qeuue directory        */
  83.     char *in_email;        /* email addr for recv notification    */
  84.     NODE *q_node;        /* current queue node being processed    */
  85.     NODE *r_node;        /* current recip nodebeing processed    */
  86.     QueueEntry *qe;        /* current queue entry            */
  87.     Recip *r;            /* current recipient            */
  88.     int recips_left;        /* number of recips in cur entry left    */
  89.     int max_delivery_time;    /* how long to try delivery faxes    */
  90.     int min_retry_wait;        /* how long to wait between tries    */
  91. } spooler_data;
  92.  
  93. #endif
  94.