31#define LOG(kind, ...) GNUNET_log_from (kind, "identity-api", __VA_ARGS__)
105 uint16_t name_len = ntohs (um->
name_len);
106 const char *str = (
const char *) &um[1];
109 ((0 != name_len) && (
'\0' != str[name_len - 1])))
128 uint16_t name_len = ntohs (um->
name_len);
137 memset (&ego, 0,
sizeof (ego));
140 tmp = (
const char*) &um[1];
141 str = (0 == name_len) ? NULL : tmp;
142 memset (&private_key, 0,
sizeof (private_key));
143 key_len = ntohs (um->
header.
size) -
sizeof (*um) - name_len;
151 ego.
pk = private_key;
152 ego.
name = (
char *) str;
222 nlen = strlen (
name) + 1;
224 memcpy (&req[1],
name, nlen);
struct GNUNET_MQ_MessageHandlers handlers[]
struct GNUNET_MQ_Envelope * env
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static char * name
Name (label) of the records to list.
static struct GNUNET_IDENTITY_EgoLookup * el
Handle to identity lookup.
static struct GNUNET_IDENTITY_Handle * id
Handle to IDENTITY.
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.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
struct GNUNET_IDENTITY_EgoLookup * GNUNET_IDENTITY_ego_lookup(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, GNUNET_IDENTITY_EgoCallback cb, void *cb_cls)
Lookup an ego by name.
void GNUNET_IDENTITY_ego_lookup_cancel(struct GNUNET_IDENTITY_EgoLookup *el)
Abort ego lookup attempt.
void(* GNUNET_IDENTITY_EgoCallback)(void *cls, struct GNUNET_IDENTITY_Ego *ego)
Function called with the result.
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_LOOKUP
First message send from identity client to service to lookup a single ego.
#define GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE
Generic response from identity service with success and/or error message.
#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.
char * name
Name of the ego we are looking up.
GNUNET_IDENTITY_EgoCallback cb
Function to call with the result.
char * name
Current name associated with this ego.
struct GNUNET_CRYPTO_PrivateKey pk
The identity key pair.
struct GNUNET_HashCode id
Hash of the private key of this ego.
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 end_of_list
Usually GNUNET_NO, GNUNET_YES to signal end of list.
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.