File: hashmap.h

package info (click to toggle)
opencryptoki 3.23.0%2Bdfsg-0.3
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,604 kB
  • sloc: ansic: 214,248; sh: 2,759; makefile: 289; yacc: 242; pascal: 152; exp: 126; lex: 93; cpp: 9
file content (31 lines) | stat: -rw-r--r-- 954 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * COPYRIGHT (c) International Business Machines Corp. 2021
 *
 * This program is provided under the terms of the Common Public License,
 * version 1.0 (CPL-1.0). Any use, reproduction or distribution for this
 * software constitutes recipient's acceptance of CPL-1.0 terms which can be
 * found in the file LICENSE file or at
 * https://opensource.org/licenses/cpl1.0.php
 */
#ifndef OCK_HASHMAP_H
#define OCK_HASHMAP_H

#include <pkcs11types.h>

struct hashmap;

union hashmap_value {
    CK_ULONG ulVal;
    void    *pVal;
};

typedef void (*freefunc_t)(union hashmap_value);

struct hashmap *hashmap_new(void);
void hashmap_free(struct hashmap *h, freefunc_t f);
int hashmap_find(struct hashmap *h, CK_ULONG key, union hashmap_value *val);
int hashmap_add(struct hashmap *h, CK_ULONG key, union hashmap_value val,
                union hashmap_value *oldval);
int hashmap_delete(struct hashmap *h, CK_ULONG key, union hashmap_value *val);

#endif