summaryrefslogtreecommitdiffstats
path: root/lib/libsi18n/reshash.h
diff options
context:
space:
mode:
authorcvsadm <cvsadm>2005-01-21 00:44:34 +0000
committercvsadm <cvsadm>2005-01-21 00:44:34 +0000
commitb2093e3016027d6b5cf06b3f91f30769bfc099e2 (patch)
treecf58939393a9032182c4fbc4441164a9456e82f8 /lib/libsi18n/reshash.h
downloadds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.tar.gz
ds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.tar.xz
ds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.zip
Moving NSCP Directory Server from DirectoryBranch to TRUNK, initial drop. (foxworth)ldapserver7x
Diffstat (limited to 'lib/libsi18n/reshash.h')
-rw-r--r--lib/libsi18n/reshash.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/lib/libsi18n/reshash.h b/lib/libsi18n/reshash.h
new file mode 100644
index 00000000..b2b7d797
--- /dev/null
+++ b/lib/libsi18n/reshash.h
@@ -0,0 +1,54 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+#ifndef RESHASH_H
+#define RESHASH_H
+/**********************************************************************
+ Hash --> Tree --> ValueList
+
+ ValueList: language per item, each list associated with one key
+ Tree: contains multiple keys
+ Hash: Based on hash to decide withc tree to use for lookup
+
+***********************************************************************/
+
+/*
+ Valuelist, each item contains
+ language: ISO two or four letters
+ value: UTF-8 encoding strings
+ */
+typedef struct ValueNode {
+ char *language;
+ char *value;
+ struct ValueNode *next;
+} ValueNode;
+
+
+/*
+ Current: BINARY TREE
+ Future: balanced tree for high search performance
+ */
+typedef struct TreeNodeStruct {
+ ValueNode *vlist;
+ char *key;
+ char *value;
+ struct TreeNodeStruct *left;
+ struct TreeNodeStruct *right;
+} TreeNode;
+
+
+typedef struct ResHash {
+ char *name; /* name of hash table */
+ TreeNode *treelist;
+} ResHash;
+
+
+ResHash * ResHashCreate(char * name);
+int ResHashAdd(ResHash *res, char *key, char *value, char *language);
+const char *ResHashSearch(ResHash *res, char *key, char *language);
+void ResHashDestroy(ResHash *res);
+
+#endif
+