1 /* @(#) $Id: ./src/headers/hash_op.h, 2011/09/08 dcid Exp $
4 /* Copyright (C) 2009 Trend Micro Inc.
7 * This program is a free software; you can redistribute it
8 * and/or modify it under the terms of the GNU General Public
9 * License (version 2) as published by the FSF - Free Software
12 * License details at the LICENSE file included with OSSEC or
13 * online at: http://www.ossec.net/en/licensing.html
16 /* Common API for dealing with directory trees */
24 typedef struct _OSHashNode
26 struct _OSHashNode *next;
33 typedef struct _OSHash
36 unsigned int initial_seed;
37 unsigned int constant;
47 /** OSHash *OSHash_Create();
48 * Creates and initializes hash.
50 OSHash *OSHash_Create();
54 /** void *OSHash_Free(OSHash *self)
55 * Frees the memory used by the hash.
57 void *OSHash_Free(OSHash *self);
61 /** void OSHash_Add(OSHash *hash, char *key, void *data)
63 * Returns 1 on duplicated key (not added)
64 * Returns 2 on success
65 * Key must not be NULL.
67 int OSHash_Add(OSHash *hash, char *key, void *data);
68 int OSHash_Update(OSHash *hash, char *key, void *data);
71 /** void *OSHash_Get(OSHash *self, char *key)
72 * Returns NULL on error (key not found).
73 * Returns the key otherwise.
74 * Key must not be NULL.
76 void *OSHash_Get(OSHash *self, char *key);
78 int OSHash_setSize(OSHash *self, int new_size);