Updated ChangeLog.
[ashd.git] / lib / utils.h
index 5aae92c..2de1df6 100644 (file)
@@ -2,6 +2,7 @@
 #define _UTILS_H
 
 #include <stdarg.h>
+#include <sys/types.h>
 
 #define max(a, b) (((b) > (a))?(b):(a))
 #define min(a, b) (((b) < (a))?(b):(a))
@@ -59,6 +60,12 @@ struct charvbuf {
     size_t s, d;
 };
 
+struct btree {
+    struct btree *l, *r;
+    int h;
+    void *d;
+};
+
 void _sizebuf(struct buffer *buf, size_t wanted, size_t el);
 char *decstr(char **p, size_t *len);
 char *vsprintf2(char *format, va_list al);
@@ -71,5 +78,11 @@ int calen(char **a);
 void bvprintf(struct charbuf *buf, char *format, va_list al);
 void bprintf(struct charbuf *buf, char *format, ...);
 void replstr(char **p, char *n);
+char *base64encode(char *data, size_t datalen);
+char *base64decode(char *data, size_t *datalen);
+int bbtreedel(struct btree **tree, void *item, int (*cmp)(void *, void *));
+void freebtree(struct btree **tree, void (*ffunc)(void *));
+int bbtreeput(struct btree **tree, void *item, int (*cmp)(void *, void *));
+void *btreeget(struct btree *tree, void *key, int (*cmp)(void *, void *));
 
 #endif