]> mj.ucw.cz Git - libucw.git/blobdiff - lib/lib.h
Added "name" parameter to obj_fload in order to get better error reporting
[libucw.git] / lib / lib.h
index 2f27ffe43d0c7085479144e783498889c4fe2f53..70b2e3661788be4d62360aa94fa480a68c14ca9a 100644 (file)
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -4,6 +4,9 @@
  *     (c) 1997 Martin Mares, <mj@atrey.karlin.mff.cuni.cz>
  */
 
+#ifndef _SHERLOCK_LIB_H
+#define _SHERLOCK_LIB_H
+
 #include <lib/config.h>
 
 /* Temporary Files */
@@ -24,6 +27,8 @@ ulg temprand(uns);
 #define TF_QUEUE_CONTROL "c"
 #define TF_QUEUE_DATA "d"
 #define TF_DECODE "x"
+#define TF_TRANSFORM "s"
+#define TF_OBJECT "o"
 
 /* Config Files */
 
@@ -41,6 +46,7 @@ struct cfitem {
 typedef byte *(*ci_func)(struct cfitem *, byte *);
 
 void cf_read(byte *, struct cfitem *);
+int cf_read_err(byte *, struct cfitem *); /* Read with possible error, 1 = succeeded */
 
 /* Logging */
 
@@ -53,10 +59,12 @@ void cf_read(byte *, struct cfitem *);
 void log(byte *, ...);
 void die(byte *, ...) NONRET;
 void initlog(byte *);
+void open_log_file(byte *);
 
 /* Allocation */
 
 void *xmalloc(uns);
+void *xrealloc(void *, uns);
 byte *stralloc(byte *);
 
 /* Content-Type pattern matching and filters */
@@ -71,16 +79,13 @@ int match_ct_filter(struct ct_filter *, byte *);
 
 /* Binary log */
 
-#ifdef HAVE_FFS
-#define log2(x) (ffs(x) - 1)
-#else
 int log2(ulg);
-#endif
 
 /* obj.c */
 
 struct odes {                          /* Object description */
   struct oattr *attrs;
+  struct mempool *pool;
 };
 
 struct oattr {                         /* Object attribute */
@@ -90,13 +95,15 @@ struct oattr {                              /* Object attribute */
 };
 
 void obj_dump(struct odes *);
-struct odes *obj_fload(FILE *);
+struct odes *obj_fload(FILE *, byte *);
 struct odes *obj_new(void);
 struct odes *obj_load(byte *);
-void obj_fwrite(FILE *, struct odes *);        /* Closes the file afterwards... */
+void obj_fwrite(FILE *, struct odes *);
+void obj_write(byte *, struct odes *);
 void obj_free(struct odes *);
 struct oattr *find_attr(struct odes *, uns);
 struct oattr *find_attr_last(struct odes *, uns);
+uns del_attr(struct odes *, struct oattr *);
 byte *find_aval(struct odes *, uns);
 struct oattr *set_attr(struct odes *, uns, byte *);
 struct oattr *set_attr_num(struct odes *, uns, uns);
@@ -105,13 +112,46 @@ struct oattr *prepend_attr(struct odes *, uns, byte *);
 
 /* oname.c */
 
+#define OID_MIN 0x10000                /* Values less than this have special meaning */
+
+ulg new_oid(uns);
 void mk_obj_name(byte *, ulg, byte *);
-FILE *create_obj_file(byte *, ulg);
+int dump_obj_to_file(byte *, ulg, struct odes *, int);
 
 /* wordsplit.c */
 
 int wordsplit(byte *, byte **, uns);
 
-/* patmatch.c */
+/* pat(i)match.c */
 
 int match_pattern(byte *, byte *);
+int match_pattern_nocase(byte *, byte *);
+
+/* md5hex.c */
+
+void md5_to_hex(byte *, byte *);
+void hex_to_md5(byte *, byte *);
+
+#define MD5_SIZE 16
+#define MD5_HEX_SIZE 33
+
+/* prime.c */
+
+int isprime(uns);
+uns nextprime(uns);
+
+/* timer.c */
+
+void init_timer(void);
+uns get_timer(void);
+
+/* regex.c */
+
+typedef struct regex regex;
+
+regex *rx_compile(byte *r);
+void rx_free(regex *r);
+int rx_match(regex *r, byte *s);
+int rx_subst(regex *r, byte *by, byte *src, byte *dest, uns destlen);
+
+#endif