1 /***************************************************************************** 2 * AreaFix library for Husky (FTN Software Package) 3 ***************************************************************************** 4 * Copyright (C) 1998-2003 5 * 6 * val khokhlov (Fido: 2:550/180), Kiev, Ukraine 7 * 8 * Based on original HPT code by: 9 * 10 * Max Levenkov 11 * 12 * Fido: 2:5000/117 13 * Internet: sackett@mail.ru 14 * Novosibirsk, West Siberia, Russia 15 * 16 * Big thanks to: 17 * 18 * Fedor Lizunkov 19 * 20 * Fido: 2:5020/960 21 * Moscow, Russia 22 * 23 * This file is part of Husky project. 24 * 25 * libareafix is free software; you can redistribute it and/or modify it 26 * under the terms of the GNU General Public License as published by the 27 * Free Software Foundation; either version 2, or (at your option) any 28 * later version. 29 * 30 * This library is distributed in the hope that it will be useful, but 31 * WITHOUT ANY WARRANTY; without even the implied warranty of 32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 33 * General Public License for more details. 34 * 35 * You should have received a copy of the GNU General Public License 36 * along with libareafix; see the file COPYING. If not, write to the Free 37 * Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 38 *****************************************************************************/ 39 /* $Id$ */ 40 41 #ifndef _AREAFIX_H 42 #define _AREAFIX_H 43 44 #ifdef __cplusplus 45 extern "C" { 46 #endif 47 48 #include <huskylib/compiler.h> 49 #include <huskylib/huskylib.h> 50 51 #define NOTHING 0 52 #define LIST 1 53 #define HELP 2 54 #define ADD 3 55 #define DEL 4 56 #define AVAIL 5 57 #define QUERY 6 58 #define UNLINKED 7 59 #define PAUSE 8 60 #define RESUME 9 61 #define INFO 10 62 #define RESCAN 11 63 #define REMOVE 12 64 #define ADD_RSC 13 65 #define PACKER 14 66 #define RSB 15 67 #define RULES 16 68 #define PKTSIZE 17 69 #define ARCMAILSIZE 18 70 #define AREAFIXPWD 19 71 #define FILEFIXPWD 20 72 #define PKTPWD 21 73 #define TICPWD 22 74 #define FROM 23 75 #define DONE 100 76 #define STAT 101 77 #define RESEND 102 78 #define AFERROR 255 79 80 typedef struct linkdata { 81 char *robot; 82 char *pwd; 83 char *flags; 84 long attrs; 85 int numDfMask; 86 char **dfMask; 87 int numFrMask; 88 char **frMask; 89 char *denyFwdFile; 90 int fwd; 91 char *fwdFile; 92 int advAfix; 93 } s_linkdata; 94 95 typedef enum { lt_all, lt_linked, lt_unlinked } s_listype; 96 typedef enum { PERL_CONF_MAIN = 1, PERL_CONF_LINKS = 2, PERL_CONF_AREAS = 4 } e_perlconftype; 97 typedef enum { ACT_PAUSE, ACT_UNPAUSE } e_pauseAct; 98 typedef enum { OK_FORWARDED = 0, OK_NOTHING = 1, ERR_NOT_FORWARDED = 2 } e_forwardRequest_result; 99 typedef enum relinkType { modeNone, modeRelink, modeResubsribeWithPattern, modeResubsribeWithFile } e_relinkType; 100 typedef enum subscribeMode { smodeNone, smodeSubscribe, smodeUnsubscribe } e_subscribeMode; 101 102 HUSKYEXT int init_areafix(char *robotName); 103 104 HUSKYEXT unsigned char RetFix; 105 HUSKYEXT char *list(s_listype type, s_link *link, char *cmdline); 106 HUSKYEXT char *help(s_link *link); 107 HUSKYEXT char *available(s_link *link, char *cmdline); 108 HUSKYEXT int changeconfig(char *fileName, s_area *area, s_link *link, int action); 109 HUSKYEXT char *subscribe(s_link *link, char *cmd); 110 HUSKYEXT char *errorRQ(char *line); 111 HUSKYEXT char *unsubscribe(s_link *link, char *cmd); 112 HUSKYEXT char *pause_link(s_link *link); 113 HUSKYEXT char *resume_link(s_link *link); 114 HUSKYEXT void preprocText(char *split, s_message *msg, char *reply, s_link *link); 115 HUSKYEXT char *textHead(void); 116 HUSKYEXT char *areaStatus(char *report, char *preport); 117 HUSKYEXT void RetMsg(s_message *msg, s_link *link, char *report, char *subj); 118 HUSKYEXT void sendAreafixMessages(); 119 120 HUSKYEXT char *print_ch(int len, char ch); 121 HUSKYEXT int processAreaFix(s_message *msg, s_pktHeader *pktHeader, unsigned force_pwd); 122 HUSKYEXT void afix(hs_addr addr, char *cmd); 123 HUSKYEXT int pauseArea(e_pauseAct pauseAct, s_link *searchLink, s_area *searchArea); 124 HUSKYEXT char *rescan(s_link *link, char *cmd); 125 HUSKYEXT char *errorRQ(char *line); 126 HUSKYEXT int isPatternLine(char *s); 127 128 /* forwardRequest() 129 Forward request to areatag. Request initiated by dwlink. 130 lastRlink is pointer to last requested link in uplinks array, uses for 131 repeat calls of forwardRequest() (uplinks array is sorted by 132 forward-priority of link). lastRlink may be NULL 133 Return values: 134 OK_FORWARDED (0) - request is forwarded 135 OK_NOTHING (1) - echo already requested (link is queued to echo-subcribing) or action isn't required 136 ERR_NOT_FORWARDED (2) - request is not forwarded (deny area-link, not found, ...) 137 */ 138 HUSKYEXT e_forwardRequest_result forwardRequest(char *areatag, s_link *dwlink, s_link **lastRlink); 139 140 HUSKYEXT int forwardRequestToLink (char *areatag, s_link *uplink, s_link *dwlink, int act); 141 HUSKYEXT void sendAreafixMessages(); 142 HUSKYEXT char *do_delete(s_link *link, s_area *area); 143 HUSKYEXT int relink(e_relinkType mode, char *pattern, hs_addr fromAddr, hs_addr toAddr, 144 char **fromCmd, char **toCmd, unsigned *count); 145 HUSKYEXT int sendRelinkMsg(e_relinkType mode, hs_addr addr, char *cmd, e_subscribeMode smode); 146 HUSKYEXT int changeconfig(char *fileName, s_area *area, s_link *link, int action); 147 148 #ifdef __cplusplus 149 } 150 #endif 151 152 #endif 153