1 /* 2 * $Id: ftn.h,v 1.11 2005/08/16 15:17:22 mitry Exp $ 3 * 4 * $Log: ftn.h,v $ 5 * Revision 1.11 2005/08/16 15:17:22 mitry 6 * Removed unused ninfo_t.haswtime field 7 * 8 * Revision 1.10 2005/05/16 11:17:30 mitry 9 * Updated function prototypes. Changed code a bit. 10 * 11 * Revision 1.9 2005/05/11 16:34:01 mitry 12 * Removed commented out typedefs 13 * 14 * Revision 1.8 2005/05/11 13:22:40 mitry 15 * Snapshot 16 * 17 * Revision 1.7 2005/05/06 20:21:55 mitry 18 * Changed nodelist handling 19 * 20 * Revision 1.6 2005/03/31 19:40:38 mitry 21 * Update function prototypes and it's duplication 22 * 23 * Revision 1.5 2005/03/28 17:02:52 mitry 24 * Pre non-blocking i/o update. Mostly non working. 25 * 26 * Revision 1.4 2005/02/08 19:53:14 mitry 27 * Added outbound_addr_busy() 28 * 29 */ 30 31 #ifndef __FTN_H__ 32 #define __FTN_H__ 33 34 #define F_ERR 0 35 #define F_NORM 1 36 #define F_HOLD 2 37 #define F_DIR 3 38 #define F_CRSH 4 39 #define F_IMM 5 40 #define F_REQ 6 41 #define F_MAX F_REQ 42 43 #define T_UNKNOWN 0 44 #define T_ARCMAIL 1 45 #define T_NETMAIL 2 46 #define T_REQ 4 47 48 #define NT_NORMAL 0 49 #define NT_DOWN 1 50 #define NT_HOLD 2 51 #define NT_PVT 3 52 #define NT_HUB 4 53 54 #define IS_ERR 5 55 #define IS_FLO 4 56 #define IS_REQ 3 57 #define IS_FILE 2 58 #define IS_ARC 1 59 #define IS_PKT 0 60 61 #define LCK_x 0 62 #define LCK_c 1 63 #define LCK_t 2 64 #define LCK_s 3 65 66 #define BSO 1 67 #define ASO 2 68 69 typedef struct { 70 int z, n, f, p; 71 char *d; 72 } ftnaddr_t; 73 74 #define FTNADDR_T(a) ftnaddr_t (a)={0,0,0,0,NULL} 75 76 #include "slists.h" 77 78 typedef struct { 79 falist_t *addrs; 80 char *name,*place,*sysop,*phone,*wtime,*flags,*pwd,*mailer,*host,*tty; 81 int options,speed,realspeed,netmail,files,type,hidnum,holded,opt; 82 time_t time,starttime; 83 } ninfo_t; 84 85 typedef struct _qitem_t { 86 ftnaddr_t addr; 87 int try, flv, what, touched, canpoll; 88 off_t reqs, pkts; 89 off_t sizes[F_MAX+1]; 90 time_t times[F_MAX+1]; 91 time_t onhold; 92 struct _qitem_t *next; 93 } qitem_t; 94 95 typedef struct _dialine_t { 96 char *phone,*timegaps,*host; 97 int num,flags; 98 struct _dialine_t *next; 99 } dialine_t; 100 101 typedef struct _subst { 102 ftnaddr_t addr; 103 dialine_t *hiddens,*current; 104 int nhids; 105 struct _subst *next; 106 } subst_t; 107 108 typedef struct { 109 UINT16 phONode, 110 phDNode, 111 phYear, 112 phMonth, 113 phDay, 114 phHour, 115 phMinute, 116 phSecond, 117 phBaud, 118 phType, 119 phONet, 120 phDNet; 121 UINT8 phPCode, 122 phMajor, 123 phPass[8]; 124 UINT16 phQOZone, 125 phQDZone, 126 phAuxNet, 127 phCWValidate; 128 UINT8 phPCodeHi, 129 phPRevMinor; 130 UINT16 phCaps, 131 phOZone, 132 phDZone, 133 phOPoint, 134 phDPoint; 135 UINT16 phLongData[2]; 136 } pkthdr_t; 137 138 typedef struct { 139 UINT16 pmType; 140 UINT16 pmONode; 141 UINT16 pmDNode; 142 UINT16 pmONet; 143 UINT16 pmDNet; 144 UINT16 pmAttr; 145 UINT16 pmCost; 146 } pktmhdr_t; 147 148 typedef struct { 149 int flags; 150 char *name; 151 size_t size; 152 time_t time; 153 } bp_status_t; 154 155 typedef struct { 156 int try,flags; 157 time_t htime,utime; 158 bp_status_t bp; 159 } sts_t; 160 161 typedef void (*qeach_t)(const char *, const ftnaddr_t *, int, int, int); 162 163 void addr_cpy(ftnaddr_t *, const ftnaddr_t *); 164 int addr_cmp(const ftnaddr_t *, const ftnaddr_t *); 165 int parseftnaddr(const char *, ftnaddr_t *, const ftnaddr_t *, int); 166 ftnaddr_t *akamatch(const ftnaddr_t *, falist_t *); 167 char *ftnaddrtoa(const ftnaddr_t *); 168 char *ftnaddrtoda(const ftnaddr_t *); 169 char *ftnaddrtoia(const ftnaddr_t *); 170 char *strip8(char *); 171 int has_addr(const ftnaddr_t *, falist_t *); 172 int showpkt(const char *); 173 FILE *openpktmsg(const ftnaddr_t *, const ftnaddr_t *, char *, char *, char *, char *, char *, unsigned); 174 void closepkt(FILE *, const ftnaddr_t *, const char *, char *); 175 void closeqpkt(FILE *, const ftnaddr_t *); 176 int whattype(const char *); 177 int istic(const char *); 178 int havestatus(int, int); 179 int needhold(int, int); 180 int xfnmatch(char *, const char *, int); 181 char *findpwd(const ftnaddr_t *); 182 183 184 /* outbound.c */ 185 int outbound_init(const char *, const char *, const char *, int); 186 void outbound_done(void); 187 int outbound_rescan(qeach_t, int); 188 int outbound_addr_busy(const ftnaddr_t *); 189 int outbound_locknode(const ftnaddr_t *, int); 190 int outbound_unlocknode(const ftnaddr_t *, int); 191 int outbound_flavor(char fl); 192 int outbound_attach(const ftnaddr_t *, int, slist_t *); 193 int outbound_request(const ftnaddr_t *, slist_t *); 194 int outbound_poll(const ftnaddr_t *, int); 195 int outbound_setstatus(const ftnaddr_t *fa, sts_t *); 196 int outbound_getstatus(const ftnaddr_t *fa, sts_t *); 197 int asoflist(flist_t **fl, const ftnaddr_t *, int); 198 199 /* queue.c */ 200 int q_cmp(const void *, const void *); 201 qitem_t *q_find(const ftnaddr_t *); 202 qitem_t *q_add(const ftnaddr_t *); 203 int q_recountflo(const char *, off_t *, time_t *, int); 204 void q_recountbox(const char *, off_t *, time_t *, int); 205 void q_each(const char *, const ftnaddr_t *, int, int, int); 206 off_t q_sum(const qitem_t *); 207 void rescan_boxes(int); 208 int q_rescan(qitem_t **, int); 209 void qsendqueue(void); 210 211 #endif 212