1 /* this defines some contants to be used in the different modules */
2 #ifndef __CONSTANTS_H
3 #define __CONSTANTS_H
4 
5 #define BUFLEN 4096
6 #define TBUFLEN 64
7 #define FNLEN 768
8 
9 /* TODO definitions:
10    TODO URG urgent		no execuses! this needs to be done NOW
11    TODO IMP important		put effort on getting this done.
12    TODO PRI primary objective	i want this to work!
13    TODO USS usual suspects	do it if you can afford getting it done or st. like that
14    TODO NRV nonrelevant		might be done some day, if you feel lucky
15  */
16 
17 /* verbosity options */
18 #define vLESS   1
19 #define vNORMAL 2
20 #define vMORE   3
21 #define vDEBUG	4
22 
23 #define ERR_NOERROR 0
24 #define ERR_OK 0
25 
26 #define SOCK_ERROR(x) (x == ERR_RECONNECT || x == ERR_TIMEOUT)
27 #define FTP_ERROR(x) (x == ERR_RETRY || x == ERR_PERMANENT)
28 
29 #define ERR_FAILED -1
30 #define ERR_SKIP -2
31 #define ERR_POSITIVE_PRELIMARY -2
32 #define ERR_RETRY -3
33 #define ERR_PERMANENT -4
34 #define ERR_RECONNECT -8
35 #define ERR_TIMEOUT -9
36 
37 #define TYPE_UNDEFINED -1
38 #define TYPE_A          0
39 #define TYPE_I          1
40 
41 /* definitions to find memory leaks and causes for segfaults. linked with memdbg.c */
42 //#define MEMDBG
43 #ifdef MEMDBG
44 
45 void dbg_free(void * ptr, char * file, int line);
46 void * dbg_realloc(void * ptr, size_t size, char * file, int line);
47 void * dbg_malloc(size_t size, char * file, int line);
48 int dbg_socket(int domain, int type, int protocol, char * file, int line);
49 int dbg_shutdown(int s, int how, char * file, int line);
50 int dbg_open(const char *path, int flags, char * file, int line);
51 int dbg_close(int fd, char * file, int line);
52 char * dbg_strcat(char * s, const char * p, char * file, int line);
53 char * dbg_cpy(char * s, char * file, int line);
54 
55 #define malloc(x)       dbg_malloc(x, __FILE__, __LINE__)
56 #define realloc(x,y)    dbg_realloc(x,y, __FILE__, __LINE__)
57 #define free(x)         dbg_free(x, __FILE__, __LINE__)
58 #define socket(x,y,z)   dbg_socket(x,y,z, __FILE__, __LINE__)
59 #define shutdown(x,y)   dbg_shutdown(x,y, __FILE__, __LINE__)
60 #define open(x,y)       dbg_open(x,y, __FILE__, __LINE__)
61 /*#define close(x)        dbg_close(x, __FILE__, __LINE__)*/
62 #undef closesocket
63 #define closesocket(x)  dbg_close(x, __FILE__, __LINE__)
64 #define strcat(x,y)     dbg_strcat(x,y, __FILE__, __LINE__)
65 #define cpy(x)          dbg_cpy(x, __FILE__, __LINE__)
66 void print_unfree(void);
67 #endif
68 
69 /* i18n */
70 #ifdef ENABLE_NLS
71 # define _(string) gettext (string)
72 # ifdef HAVE_LIBINTL_H
73 #  include <libintl.h>
74 # endif
75 #else  /* not HAVE_NLS */
76 # define _(string) string
77 #endif
78 
79 #endif
80