00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _EGG_MOD_TRANSFER_TRANSFER_H
00026 #define _EGG_MOD_TRANSFER_TRANSFER_H
00027
00028 enum dccsend_types {
00029 DCCSEND_OK = 0,
00030 DCCSEND_FULL,
00031 DCCSEND_NOSOCK,
00032 DCCSEND_BADFN,
00033 DCCSEND_FEMPTY
00034 };
00035
00036
00037 #define FILEMATCH (match+sofar)
00038 #define FILEQUOTE '\\'
00039 #define FILEWILDS '*'
00040 #define FILEWILDQ '?'
00041
00042
00043 #define TRANSFER_COPY_FAILED get_language(0xf00)
00044 #define TRANSFER_FILESYS_BROKEN get_language(0xf01)
00045 #define TRANSFER_FILE_ARRIVE get_language(0xf02)
00046 #define TRANSFER_LOG_CONFULL get_language(0xf03)
00047 #define TRANSFER_NOTICE_CONFULL get_language(0xf04)
00048 #define TRANSFER_LOG_SOCKERR get_language(0xf05)
00049 #define TRANSFER_NOTICE_SOCKERR get_language(0xf06)
00050 #define TRANSFER_LOG_FILEEMPTY get_language(0xf07)
00051 #define TRANSFER_NOTICE_FILEEMPTY get_language(0xf08)
00052 #define TRANSFER_SEND_TO get_language(0xf09)
00053 #define TRANSFER_LINES get_language(0xf0a)
00054 #define TRANSFER_WAITING get_language(0xf0b)
00055 #define TRANSFER_DONE get_language(0xf0c)
00056 #define TRANSFER_QUEUED_UP get_language(0xf0d)
00057 #define TRANSFER_TOTAL get_language(0xf0e)
00058 #define TRANSFER_CANCELLED get_language(0xf0f)
00059 #define TRANSFER_ABORT_DCCSEND get_language(0xf10)
00060 #define TRANSFER_NOTICE_ABORT get_language(0xf11)
00061 #define TRANSFER_DCC_CANCEL get_language(0xf12)
00062 #define TRANSFER_NO_MATCHES get_language(0xf13)
00063 #define TRANSFER_CANCELLED_FILE get_language(0xf14)
00064 #define TRANSFER_COMPLETED_DCC get_language(0xf15)
00065 #define TRANSFER_FILENAME_TOOLONG get_language(0xf16)
00066 #define TRANSFER_NOTICE_FNTOOLONG get_language(0xf17)
00067 #define TRANSFER_TOO_BAD get_language(0xf18)
00068 #define TRANSFER_NOTICE_TOOBAD get_language(0xf19)
00069 #define TRANSFER_FAILED_MOVE get_language(0xf1a)
00070 #define TRANSFER_THANKS get_language(0xf1b)
00071 #define TRANSFER_NOTICE_THANKS get_language(0xf1c)
00072 #define TRANSFER_USERFILE_LOST get_language(0xf1d)
00073
00074 #define TRANSFER_USERFILE_DISCON get_language(0xf1f)
00075 #define TRANSFER_LOST_DCCSEND get_language(0xf20)
00076 #define TRANSFER_REGET_PACKET get_language(0xf21)
00077 #define TRANSFER_BEHIND_FILEEND get_language(0xf22)
00078 #define TRANSFER_TRY_SKIP_AHEAD get_language(0xf23)
00079 #define TRANSFER_RESUME_FILE get_language(0xf24)
00080 #define TRANSFER_COMPLETED_USERFILE get_language(0xf25)
00081 #define TRANSFER_FINISHED_DCCSEND get_language(0xf26)
00082 #define TRANSFER_ABORT_USERFILE get_language(0xf27)
00083 #define TRANSFER_LOST_DCCGET get_language(0xf28)
00084 #define TRANSFER_BOGUS_FILE_LENGTH get_language(0xf29)
00085 #define TRANSFER_FILE_TOO_LONG get_language(0xf2a)
00086 #define TRANSFER_USERFILE_TIMEOUT get_language(0xf2b)
00087 #define TRANSFER_DICONNECT_TIMEOUT get_language(0xf2c)
00088 #define TRANSFER_NOTICE_TIMEOUT get_language(0xf2d)
00089 #define TRANSFER_LOG_TIMEOUT get_language(0xf2e)
00090 #define TRANSFER_DCC_GET_TIMEOUT get_language(0xf2f)
00091 #define TRANSFER_DCC_SEND_TIMEOUT get_language(0xf30)
00092 #define TRANSFER_SEND get_language(0xf31)
00093 #define TRANSFER_SEND_WAITED get_language(0xf32)
00094 #define TRANSFER_CONN_SEND get_language(0xf33)
00095 #define TRANSFER_DCC_CONN get_language(0xf34)
00096 #define TRANSFER_NOTICE_BAD_CONN get_language(0xf35)
00097 #define TRANSFER_LOG_BAD_CONN get_language(0xf36)
00098 #define TRANSFER_BEGIN_DCC get_language(0xf37)
00099 #define TRANSFER_RE get_language(0xf38)
00100 #define TRANSFER_DCC_IGNORED get_language(0xf39)
00101 #define TRANSFER_UNLOADING get_language(0xf40)
00102 #define TRANSFER_STAT_1 get_language(0xf41)
00103 #define TRANSFER_STAT_2 get_language(0xf42)
00104
00105 #ifndef MAKING_TRANSFER
00106
00107 #define DCC_FORK_SEND (*(struct dcc_table *)(transfer_funcs[4]))
00108 #define at_limit(a) (((int (*) (char *))transfer_funcs[5])(a))
00109
00110 #define fileq_cancel(a,b) (((void (*) (int,char *))transfer_funcs[7])(a,b))
00111
00112 #define queue_file(a,b,c,d) (((void (*)(char *,char *,char *,char *))transfer_funcs[8])(a,b,c,d))
00113 #define raw_dcc_send(a,b,c,d) (((int (*) (char *,char *,char *,char *))transfer_funcs[9])(a,b,c,d))
00114 #define show_queued_files(a) (((void (*) (int))transfer_funcs[10])(a))
00115 #define wild_match_file(a,b) (((int (*)(register char *, register char *))transfer_funcs[11])(a,b))
00116
00117 #define wipe_tmp_filename(a,b) (((void (*) (char *,int))transfer_funcs[12])(a,b))
00118 #define DCC_GET (*(struct dcc_table *)(transfer_funcs[13]))
00119 #define H_rcvd (*(p_tcl_bind_list*)(transfer_funcs[14]))
00120 #define H_sent (*(p_tcl_bind_list*)(transfer_funcs[15]))
00121
00122 #define USERENTRY_FSTAT (*(struct user_entry_type *)(transfer_funcs[16]))
00123
00124 #define raw_dcc_resend(a,b,c,d) (((int (*) (char *,char *,char *,char *))transfer_funcs[18])(a,b,c,d))
00125 #define H_lost (*(p_tcl_bind_list*)(transfer_funcs[19]))
00126
00127 #define H_tout (*(p_tcl_bind_list*)(transfer_funcs[20]))
00128 #define DCC_SEND (*(struct dcc_table *)(transfer_funcs[21]))
00129 #define DCC_GET_PENDING (*(struct dcc_table *)(transfer_funcs[22]))
00130
00131 #else
00132
00133 static void dcc_fork_send(int, char *, int);
00134 static void stats_add_dnload(struct userrec *, unsigned long);
00135 static void stats_add_upload(struct userrec *, unsigned long);
00136 static void wipe_tmp_filename(char *, int);
00137 static void dcc_get_pending(int, char *, int);
00138 static void queue_file(char *, char *, char *, char *);
00139 static int raw_dcc_resend(char *, char *, char *, char *);
00140 static int raw_dcc_send(char *, char *, char *, char *);
00141 static int at_limit(char *);
00142 static int fstat_gotshare(struct userrec *u, struct user_entry *e, char *par,
00143 int idx);
00144 static int fstat_dupuser(struct userrec *u, struct userrec *o,
00145 struct user_entry *e);
00146 static int fstat_tcl_set(Tcl_Interp *irp, struct userrec *u,
00147 struct user_entry *e, int argc, char **argv);
00148 static void stats_add_dnload(struct userrec *u, unsigned long bytes);
00149 static void stats_add_upload(struct userrec *u, unsigned long bytes);
00150 static int wild_match_file(register char *, register char *);
00151 static int server_transfer_setup(char *);
00152
00153 #define TRANSFER_REGET_PACKETID 0xfeab
00154
00155 typedef struct {
00156 u_16bit_t packet_id;
00157
00158 u_8bit_t byte_order;
00159 u_32bit_t byte_offset;
00160
00161 } transfer_reget;
00162
00163 typedef struct zarrf {
00164 char *dir;
00165
00166 char *file;
00167 char nick[NICKLEN];
00168 char to[NICKLEN];
00169 struct zarrf *next;
00170 } fileq_t;
00171
00172 #endif
00173 #endif