1 /* @(#) $Id: hash_op.h,v 1.4 2009/06/24 17:06:26 dcid Exp $ */
3 /* Copyright (C) 2009 Trend Micro Inc.
6 * This program is a free software; you can redistribute it
7 * and/or modify it under the terms of the GNU General Public
8 * License (version 3) as published by the FSF - Free Software
11 * License details at the LICENSE file included with OSSEC or
12 * online at: http://www.ossec.net/en/licensing.html
15 /* Common API for dealing with directory trees */
23 typedef struct _OSHashNode
25 struct _OSHashNode *next;
32 typedef struct _OSHash
35 unsigned int initial_seed;
36 unsigned int constant;
46 /** OSHash *OSHash_Create();
47 * Creates and initializes hash.
49 OSHash *OSHash_Create();
53 /** void *OSHash_Free(OSHash *self)
54 * Frees the memory used by the hash.
56 void *OSHash_Free(OSHash *self);
60 /** void OSHash_Add(OSHash *hash, char *key, void *data)
62 * Returns 1 on duplicated key (not added)
63 * Returns 2 on success
64 * Key must not be NULL.
66 int OSHash_Add(OSHash *hash, char *key, void *data);
69 /** void *OSHash_Get(OSHash *self, char *key)
70 * Returns NULL on error (key not found).
71 * Returns the key otherwise.
72 * Key must not be NULL.
74 void *OSHash_Get(OSHash *self, char *key);