Browse Source

examine callback

doc_update_sequoia
Volker Birk 7 years ago
parent
commit
4408dbb1dd
3 changed files with 50 additions and 0 deletions
  1. +20
    -0
      src/keymanagement.c
  2. +26
    -0
      src/keymanagement.h
  3. +4
    -0
      src/pEp_internal.h

+ 20
- 0
src/keymanagement.c View File

@ -122,6 +122,10 @@ DYNAMIC_API PEP_STATUS update_identity(
if (status == PEP_OUT_OF_MEMORY)
return PEP_OUT_OF_MEMORY;
if (keylist == NULL || keylist->value == NULL)
if (session->examine_identity)
session->examine_identity(identity, session->examine_management);
stringlist_t *_keylist;
for (_keylist = keylist; _keylist && _keylist->value; _keylist = _keylist->next) {
PEP_comm_type _comm_type_key;
@ -259,6 +263,22 @@ DYNAMIC_API PEP_STATUS myself(PEP_SESSION session, pEp_identity * identity)
return PEP_STATUS_OK;
}
PEP_STATUS register_examine_function(
PEP_SESSION session,
examine_identity_t examine_identity,
void *management
)
{
assert(session);
if (!session)
return PEP_ILLEGAL_VALUE;
session->examine_management = management;
session->examine_identity = examine_identity;
return PEP_STATUS_OK;
}
DYNAMIC_API PEP_STATUS do_keymanagement(
retrieve_next_identity_t retrieve_next_identity,
void *management


+ 26
- 0
src/keymanagement.h View File

@ -63,6 +63,32 @@ DYNAMIC_API PEP_STATUS myself(PEP_SESSION session, pEp_identity * identity);
typedef pEp_identity *(*retrieve_next_identity_t)(void *management);
// examine_identity() - callback for appending to queue
//
// parameters:
// ident (in) identity to examine
// management (in) data structure to deliver (implementation defined)
//
// return value:
// 0 if identity was added successfully to queue or nonzero otherwise
typedef int *(*examine_identity_t)(pEp_identity *ident, void *management);
// register_examine_function() - register examine_identity() callback
//
// parameters:
// session (in) session to use
// examine_identity (in) examine_identity() function to register
// management (in) data structure to deliver (implementation defined)
PEP_STATUS register_examine_function(
PEP_SESSION session,
examine_identity_t examine_identity,
void *management
);
// do_keymanagement() - function to be run on an extra thread
//
// parameters:


+ 4
- 0
src/pEp_internal.h View File

@ -57,6 +57,7 @@
#include "pgp_netpgp_internal.h"
#endif
#include "keymanagement.h"
#include "cryptotech.h"
#include "transport.h"
@ -85,6 +86,9 @@ typedef struct _pEpSession {
sqlite3_stmt *set_trust;
sqlite3_stmt *get_trust;
sqlite3_stmt *least_trust;
examine_identity_t examine_identity;
void *examine_management;
} pEpSession;
PEP_STATUS init_transport_system(PEP_SESSION session, bool in_first);


Loading…
Cancel
Save