31#define LOG(kind, ...) GNUNET_log_from (kind, "identity-api", __VA_ARGS__)
107 uint16_t name_len = ntohs (um->
name_len);
108 const char *str = (
const char *) &um[1];
112 ((0 != name_len) && (
'\0' != str[name_len - 1])))
131 uint16_t name_len = ntohs (um->
name_len);
138 tmp = (
const char*) &um[1];
139 str = (0 == name_len) ? NULL : tmp;
140 memset (&private_key, 0,
sizeof (private_key));
141 key_len = ntohs (um->
header.
size) - name_len -
sizeof (*um);
222 nlen = strlen (suffix) + 1;
225 memcpy (&req[1], suffix, nlen);
struct GNUNET_MQ_MessageHandlers handlers[]
struct GNUNET_MQ_Envelope * env
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static struct GNUNET_IDENTITY_EgoLookup * el
Handle to identity lookup.
Identity service; implements identity management for GNUnet.
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
struct GNUNET_IDENTITY_EgoSuffixLookup * GNUNET_IDENTITY_ego_lookup_by_suffix(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *suffix, GNUNET_IDENTITY_EgoSuffixCallback cb, void *cb_cls)
Lookup an ego by name.
void(* GNUNET_IDENTITY_EgoSuffixCallback)(void *cls, const struct GNUNET_CRYPTO_PrivateKey *priv, const char *ego_name)
Function called with the result.
void GNUNET_IDENTITY_ego_lookup_by_suffix_cancel(struct GNUNET_IDENTITY_EgoSuffixLookup *el)
Abort ego lookup attempt.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_read_private_key_from_buffer(const void *buffer, size_t len, struct GNUNET_CRYPTO_PrivateKey *key, size_t *read)
Reads a GNUNET_CRYPTO_PrivateKey from a compact buffer.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_MQ_Error
Error codes for the queue.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_check_zero_termination(m)
Insert code for a "check_" function that verifies that a given variable-length message received over ...
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
#define GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE
Generic response from identity service with success and/or error message.
#define GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP_BY_SUFFIX
First message send from identity client to service to lookup a single ego matching the given suffix (...
#define GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE
Update about identity status from service to clients.
Common type definitions for the identity service and API.
static void handle_identity_result_code(void *cls, const struct ResultCodeMessage *rcm)
We received a result code from the service.
static int check_identity_update(void *cls, const struct UpdateMessage *um)
Check validity of identity update message.
static void mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
Generic error handler, called with the appropriate error code and the same closure specified at the c...
static void handle_identity_update(void *cls, const struct UpdateMessage *um)
Handle identity update message.
static int check_identity_result_code(void *cls, const struct ResultCodeMessage *rcm)
We received a result code from the service.
static unsigned int size
Size of the "table".
A private key for an identity as per LSD0001.
struct GNUNET_MQ_Handle * mq
Connection to service.
void * cb_cls
Closure for cb.
GNUNET_IDENTITY_EgoCallback cb
Function to call with the result.
GNUNET_IDENTITY_EgoSuffixCallback cb
Function to call with the result.
struct GNUNET_MQ_Handle * mq
Connection to service.
void * cb_cls
Closure for cb.
char * suffix
Suffix we are looking up.
Handle to a message queue.
Message handler for a specific message type.
Answer from service to client about last operation; GET_DEFAULT maybe answered with this message on f...
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE.
Service informs client about status of a pseudonym.
uint16_t name_len
Number of bytes in ego name string including 0-termination, in NBO; 0 if the ego was deleted.
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE.