2 * Sherlock Library -- Miscellaneous Functions
4 * (c) 1997 Martin Mares, <mj@atrey.karlin.mff.cuni.cz>
7 #ifndef _SHERLOCK_LIB_H
8 #define _SHERLOCK_LIB_H
10 #include <lib/config.h>
22 void open_temp(struct tempfile *, byte *);
23 void delete_temp(struct tempfile *);
26 #define TF_GENERIC "t"
27 #define TF_QUEUE_CONTROL "c"
28 #define TF_QUEUE_DATA "d"
30 #define TF_TRANSFORM "s"
46 typedef byte *(*ci_func)(struct cfitem *, byte *);
48 void cf_read(byte *, struct cfitem *);
49 int cf_read_err(byte *, struct cfitem *); /* Read with possible error, 1 = succeeded */
59 void log(byte *, ...);
60 void die(byte *, ...) NONRET;
62 void open_log_file(byte *);
67 void *xrealloc(void *, uns);
68 byte *stralloc(byte *);
70 /* Content-Type pattern matching and filters */
74 int match_ct_patt(byte *, byte *);
76 struct ct_filter *new_ct_filter(void);
77 byte *add_ct_filter(struct ct_filter *, byte *);
78 int match_ct_filter(struct ct_filter *, byte *);
86 struct odes { /* Object description */
91 struct oattr { /* Object attribute */
92 struct oattr *next, *same;
97 void obj_dump(struct odes *);
98 struct odes *obj_fload(FILE *, byte *);
99 struct odes *obj_new(void);
100 struct odes *obj_load(byte *);
101 void obj_fwrite(FILE *, struct odes *);
102 void obj_write(byte *, struct odes *);
103 void obj_free(struct odes *);
104 struct oattr *find_attr(struct odes *, uns);
105 struct oattr *find_attr_last(struct odes *, uns);
106 uns del_attr(struct odes *, struct oattr *);
107 byte *find_aval(struct odes *, uns);
108 struct oattr *set_attr(struct odes *, uns, byte *);
109 struct oattr *set_attr_num(struct odes *, uns, uns);
110 struct oattr *add_attr(struct odes *, struct oattr *, uns, byte *);
111 struct oattr *prepend_attr(struct odes *, uns, byte *);
115 #define OID_MIN 0x10000 /* Values less than this have special meaning */
118 void mk_obj_name(byte *, ulg, byte *);
119 int dump_obj_to_file(byte *, ulg, struct odes *, int);
123 int wordsplit(byte *, byte **, uns);
127 int match_pattern(byte *, byte *);
128 int match_pattern_nocase(byte *, byte *);
132 void md5_to_hex(byte *, byte *);
133 void hex_to_md5(byte *, byte *);
136 #define MD5_HEX_SIZE 33
145 void init_timer(void);
150 typedef struct regex regex;
152 regex *rx_compile(byte *r);
153 void rx_free(regex *r);
154 int rx_match(regex *r, byte *s);
155 int rx_subst(regex *r, byte *by, byte *src, byte *dest, uns destlen);
159 void scan_obj_tree(byte *, void (*)(ulg, byte *));