moved all uthash related code into keyhash.c

This commit is contained in:
TLINDEN
2013-11-13 13:06:01 +01:00
parent bdaa7aae46
commit 5a8e3ee8b0
21 changed files with 209 additions and 93 deletions

View File

@@ -6,6 +6,7 @@ PCPEXPORT = pcp.h \
pcp/getpass.h \
pcp/jenhash.h \
pcp/key.h \
pcp/keyhash.h \
pcp/mac.h \
pcp/mem.h \
pcp/pad.h \

View File

@@ -225,6 +225,7 @@ PCPEXPORT = pcp.h \
pcp/getpass.h \
pcp/jenhash.h \
pcp/key.h \
pcp/keyhash.h \
pcp/mac.h \
pcp/mem.h \
pcp/pad.h \

View File

@@ -12,6 +12,7 @@ extern "C" {
#include "pcp/getpass.h"
#include "pcp/jenhash.h"
#include "pcp/key.h"
#include "pcp/keyhash.h"
#include "pcp/mac.h"
#include "pcp/mem.h"
#include "pcp/pad.h"

View File

@@ -110,9 +110,6 @@ struct _pcp_pubkey_t {
typedef struct _pcp_key_t pcp_key_t;
typedef struct _pcp_pubkey_t pcp_pubkey_t;
pcp_key_t *pcpkey_hash;
pcp_pubkey_t *pcppubkey_hash;
void pcp_cleanhashes();
pcp_key_t *pcpkey_new ();

63
include/pcp/keyhash.h Normal file
View File

@@ -0,0 +1,63 @@
/*
This file is part of Pretty Curved Privacy (pcp1).
Copyright (C) 2013 T.Linden.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact me by mail: <tlinden AT cpan DOT org>.
*/
#ifndef _HAVE_KEYHASH_H
#define _HAVE_KEYHASH_H
#ifdef __cplusplus
extern "C" {
#endif
#include "uthash.h"
#include "key.h"
pcp_key_t *pcpkey_hash;
pcp_pubkey_t *pcppubkey_hash;
pcp_key_t *__k;
pcp_pubkey_t *__p;
// wrapper for HASH_ITER
#define pcphash_iterate(key) \
__k = NULL; \
HASH_ITER(hh, pcpkey_hash, key, __k)
#define pcphash_iteratepub(key) \
__p = NULL; \
HASH_ITER(hh, pcppubkey_hash, key, __p)
void pcphash_init();
void pcphash_del(void *key, int type);
void pcphash_clean();
pcp_key_t *pcphash_keyexists(char *id);
pcp_pubkey_t *pcphash_pubkeyexists(char *id);
void pcphash_add(void *key, int type);
int pcphash_count();
int pcphash_countpub();
#ifdef __cplusplus
}
#endif
#endif // _HAVE_KEYHASH_H