Uthashes of secret and public key structures. More...
Macros | |
#define | pcphash_iterate(ptx, key) |
Iterate over the list of secret keys. More... | |
#define | pcphash_iteratepub(ptx, key) |
Iterate over the list of public keys. More... | |
Functions | |
void | pcphash_del (PCPCTX *ptx, void *key, int type) |
Delete an entry from a hash. More... | |
void | pcphash_clean (PCPCTX *ptx) |
Free memory used by key global ptx-attached hashes. More... | |
void | pcphash_cleanpub (pcp_pubkey_t *pub) |
Free memory by local pubkey hash. More... | |
pcp_key_t * | pcphash_keyexists (PCPCTX *ptx, char *id) |
Check if a secret key with a given key-id exists in the hash. More... | |
pcp_pubkey_t * | pcphash_pubkeyexists (PCPCTX *ptx, char *id) |
Check if a publickey with a given key-id exists in the hash. More... | |
void | pcphash_add (PCPCTX *ptx, void *key, int type) |
Add a key structure to the hash list. More... | |
int | pcphash_count (PCPCTX *ptx) |
Returns the number of secret keys in the hash. More... | |
int | pcphash_countpub (PCPCTX *ptx) |
Returns the number of public keys in the hash. More... | |
Uthashes of secret and public key structures.
Libpcp uses the uthash system to maintain lists of keys. There's one hash per key type. The hash has the same type as the key structure itself, and is stored in the PCP Context object.
#define pcphash_iterate | ( | ptx, | |
key | |||
) |
Iterate over the list of secret keys.
Sample use:
Also, don't free() the keyhash or the temporary key pointer yourself. Use pcphash_clean() instead when done.
#define pcphash_iteratepub | ( | ptx, | |
key | |||
) |
Iterate over the list of public keys.
Sample use:
Also, don't free() the keyhash or the temporary key pointer yourself. Use pcphash_clean() instead when done.
void pcphash_add | ( | PCPCTX * | ptx, |
void * | key, | ||
int | type | ||
) |
Add a key structure to the hash list.
[in] | ptx | Pcp Context object. |
[in] | key | A pointer to the key structure to delete. |
[in] | type | An integer specifying the key type to delete. |
void pcphash_clean | ( | PCPCTX * | ptx | ) |
Free memory used by key global ptx-attached hashes.
void pcphash_cleanpub | ( | pcp_pubkey_t * | pub | ) |
Free memory by local pubkey hash.
int pcphash_count | ( | PCPCTX * | ptx | ) |
Returns the number of secret keys in the hash.
[in] | ptx | Pcp Context object. |
int pcphash_countpub | ( | PCPCTX * | ptx | ) |
Returns the number of public keys in the hash.
[in] | ptx | Pcp Context object. |
void pcphash_del | ( | PCPCTX * | ptx, |
void * | key, | ||
int | type | ||
) |
Delete an entry from a hash.
[in] | ptx | Pcp Context object. |
[in] | key | A pointer to the key structure to delete. |
[in] | type | An integer specifying the key type to delete. |
Check if a secret key with a given key-id exists in the hash.
[in] | ptx | Pcp Context object. |
[in] | id | A string with the key-id (max 17 chars incl 0). |
pcp_pubkey_t* pcphash_pubkeyexists | ( | PCPCTX * | ptx, |
char * | id | ||
) |
Check if a publickey with a given key-id exists in the hash.
[in] | ptx | Pcp Context object. |
[in] | id | A string with the key-id (max 17 chars incl 0). |