summaryrefslogtreecommitdiff
path: root/web/src/pubcookie/id_table.h
diff options
context:
space:
mode:
authorEduardo Chappa <echappa@gmx.com>2013-02-03 00:59:38 -0700
committerEduardo Chappa <echappa@gmx.com>2013-02-03 00:59:38 -0700
commit094ca96844842928810f14844413109fc6cdd890 (patch)
treee60efbb980f38ba9308ccb4fb2b77b87bbc115f3 /web/src/pubcookie/id_table.h
downloadalpine-094ca96844842928810f14844413109fc6cdd890.tar.xz
Initial Alpine Version
Diffstat (limited to 'web/src/pubcookie/id_table.h')
-rw-r--r--web/src/pubcookie/id_table.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/web/src/pubcookie/id_table.h b/web/src/pubcookie/id_table.h
new file mode 100644
index 00000000..2ba3f2b4
--- /dev/null
+++ b/web/src/pubcookie/id_table.h
@@ -0,0 +1,58 @@
+/* ========================================================================
+ * Copyright 2006 University of Washington
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * ========================================================================
+ */
+
+#ifndef _ID_TABLE_H_
+#define _ID_TABLE_H_
+
+struct id_table_entry;
+typedef struct id_table_entry id_table_entry;
+
+struct key_hash_entry;
+typedef struct key_hash_entry key_hash_entry;
+
+typedef struct id_table_range {
+ unsigned long start;
+ unsigned long end;
+ struct id_table_range *next;
+} id_table_range;
+
+typedef struct id_table {
+ id_table_entry **array;
+ unsigned long array_start;
+ unsigned long array_size;
+ unsigned long array_ptr;
+
+ id_table_entry **hash;
+ unsigned long hash_size;
+
+ key_hash_entry **key_hash;
+ unsigned long key_hash_size;
+
+ unsigned long max_fill;
+ unsigned long fill;
+} id_table;
+
+id_table_range *id_table_range_new(char *str);
+void id_table_range_delete(id_table_range *range);
+
+int id_table_init(id_table *t,id_table_range *range);
+void id_table_destroy(id_table *t);
+
+int id_table_create_id(id_table *t,char *name,unsigned int *key);
+char *id_table_get_name(id_table *t,int id);
+int id_table_remove_stale(id_table *t);
+
+id_table_entry *key_hash_get_entry(id_table *, unsigned *key);
+key_hash_entry *key_hash_create_entry(id_table *, id_table_entry *pe, unsigned *key);
+void key_hash_delete_keys(id_table *t, id_table_entry *e);
+
+#endif