mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-17 03:50:57 +01:00
added dump function
This commit is contained in:
@@ -91,5 +91,6 @@ void fatals_reset(PCPCTX *ptx);
|
|||||||
/* same as fatal() but dies immediately */
|
/* same as fatal() but dies immediately */
|
||||||
void final(const char * fmt, ...);
|
void final(const char * fmt, ...);
|
||||||
|
|
||||||
|
void ptx_dump(PCPCTX *ptx);
|
||||||
|
|
||||||
#endif // _HAVE_PCP_CONTEXT_H
|
#endif // _HAVE_PCP_CONTEXT_H
|
||||||
|
|||||||
@@ -44,14 +44,34 @@ PCPCTX *ptx_new() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ptx_clean(PCPCTX *ptx) {
|
void ptx_clean(PCPCTX *ptx) {
|
||||||
if(ptx->pcp_errset)
|
if(ptx->pcp_errset) {
|
||||||
|
if(ptx->pcp_err != NULL)
|
||||||
free(ptx->pcp_err);
|
free(ptx->pcp_err);
|
||||||
|
|
||||||
|
}
|
||||||
pcphash_clean(ptx);
|
pcphash_clean(ptx);
|
||||||
|
|
||||||
free(ptx);
|
free(ptx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ptx_dump(PCPCTX *ptx) {
|
||||||
|
fprintf(stderr, "ERRSET: %d\n", ptx->pcp_errset);
|
||||||
|
if(ptx->pcp_errset)
|
||||||
|
fprintf(stderr, " ERR: %s\n", ptx->pcp_err);
|
||||||
|
|
||||||
|
fprintf(stderr, " sk:\n");
|
||||||
|
pcp_key_t *k = NULL;
|
||||||
|
pcphash_iterate(ptx, k) {
|
||||||
|
fprintf(stderr, " id: 0x%s\n", k->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, " pk:\n");
|
||||||
|
pcp_pubkey_t *p = NULL;
|
||||||
|
pcphash_iteratepub(ptx, p) {
|
||||||
|
fprintf(stderr, " id: 0x%s\n", p->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void fatal(PCPCTX *ptx, const char * fmt, ...) {
|
void fatal(PCPCTX *ptx, const char * fmt, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|||||||
Reference in New Issue
Block a user