1 /* 2 * binkleyforce -- unix FTN mailer project 3 * 4 * Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * $Id: daemon.h,v 1.1.1.1 2004/09/09 09:52:40 kstepanenkov Exp $ 12 */ 13 14 #ifndef _DAEMON_H_ 15 #define _DAEMON_H_ 16 17 #include "outbound.h" 18 19 /* 20 * Branch information 21 */ 22 typedef struct { 23 s_faddr addr; 24 bool tcpip; 25 char *portname; 26 bool wait; /* It is like a zombie! */ 27 pid_t pid; /* Branch PID, returned by fork() call */ 28 time_t start; 29 time_t stop; /* We should stop (kill) branch at this time */ 30 int rc; /* Process return code (one of BFERR values) */ 31 } s_daemon_branch; 32 33 /* 34 * Daemon queue sates 35 */ 36 typedef enum { 37 DQ_CallSystem, 38 DQ_GetNextSystem, 39 DQ_Idle 40 } DQ_State; 41 42 /* 43 * Daemon states 44 */ 45 typedef enum { 46 DM_Start, 47 DM_Restart, 48 DM_ProcessQueues, 49 DM_Usr1, 50 DM_Usr2, 51 DM_Shutdown 52 } DM_State; 53 54 /* 55 * Daemon queue 56 */ 57 typedef struct { 58 s_sysqueue *q; /* Pointer to the systems queue (shared) */ 59 int current; 60 int circle; 61 bool tcpip; /* Queue for TCP/IP systems? */ 62 DQ_State state; 63 } s_daemon_queue; 64 65 extern int max_tcpip; 66 extern int max_modem; 67 extern int tcpip_clients; 68 extern int modem_clients; 69 70 /* daemon.c */ 71 int daemon_run(const char *confname, const char *incname, bool quit); 72 73 /* daemon_branch.c */ 74 bool daemon_branch_exist(s_faddr addr); 75 void daemon_branch_check_stop_timers(void); 76 int daemon_branch_exit(pid_t pid, int rc); 77 int daemon_branch_get_first_waiting(void); 78 s_daemon_branch *daemon_branch_get_pointer(int pos); 79 void daemon_branch_add(s_faddr addr, pid_t pid, bool tcpip, const char *pname); 80 void daemon_branch_remove(int pos); 81 int daemon_branch_number(void); 82 void daemon_branch_deinit(void); 83 84 /* daemon_call.c */ 85 int daemon_call(s_sysentry *syst); 86 87 /* daemon_lines.c */ 88 int daemon_line_add(const char *name, int type); 89 void daemon_line_hold(const char *name, int holdtime); 90 bool daemon_line_isready(const char *name); 91 void daemon_lines_deinit(void); 92 93 #endif /* _DAEMON_H_ */ 94