GNUnet  0.21.0
Collaboration diagram for Reclaim service:

Data Structures

struct  GNUNET_RECLAIM_Ticket
 The authorization ticket. More...
 

Macros

#define GNUNET_RECLAIM_VERSION   0x00000001
 Version number of the re:claimID API. More...
 

Typedefs

typedef void(* GNUNET_RECLAIM_TicketCallback) (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
 Method called when a token has been issued. More...
 
typedef void(* GNUNET_RECLAIM_IssueTicketCallback) (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_RECLAIM_PresentationList *presentations)
 Method called when a token has been issued. More...
 
typedef void(* GNUNET_RECLAIM_ContinuationWithStatus) (void *cls, int32_t success, const char *emsg)
 Continuation called to notify client about result of the operation. More...
 
typedef void(* GNUNET_RECLAIM_AttributeResult) (void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr)
 Callback used to notify the client of attribute results. More...
 
typedef void(* GNUNET_RECLAIM_AttributeTicketResult) (void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_RECLAIM_Presentation *presentation)
 Callback used to notify the client of attribute results. More...
 
typedef void(* GNUNET_RECLAIM_CredentialResult) (void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, const struct GNUNET_RECLAIM_Credential *credential)
 Callback used to notify the client of credential results. More...
 

Functions

struct GNUNET_RECLAIM_HandleGNUNET_RECLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
 Connect to the re:claimID service. More...
 
struct GNUNET_RECLAIM_OperationGNUNET_RECLAIM_attribute_store (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_TIME_Relative *exp_interval, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
 Store an attribute. More...
 
struct GNUNET_RECLAIM_OperationGNUNET_RECLAIM_credential_store (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, const struct GNUNET_RECLAIM_Credential *credential, const struct GNUNET_TIME_Relative *exp_interval, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
 Store a credential. More...
 
struct GNUNET_RECLAIM_OperationGNUNET_RECLAIM_attribute_delete (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, const struct GNUNET_RECLAIM_Attribute *attr, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
 Delete an attribute. More...
 
struct GNUNET_RECLAIM_OperationGNUNET_RECLAIM_credential_delete (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, const struct GNUNET_RECLAIM_Credential *cred, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
 Delete a credential. More...
 
struct GNUNET_RECLAIM_AttributeIteratorGNUNET_RECLAIM_get_attributes_start (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
 List all attributes for a local identity. More...
 
void GNUNET_RECLAIM_get_attributes_next (struct GNUNET_RECLAIM_AttributeIterator *it)
 Calls the record processor specified in GNUNET_RECLAIM_get_attributes_start for the next record. More...
 
void GNUNET_RECLAIM_get_attributes_stop (struct GNUNET_RECLAIM_AttributeIterator *it)
 Stops iteration and releases the handle for further calls. More...
 
struct GNUNET_RECLAIM_CredentialIteratorGNUNET_RECLAIM_get_credentials_start (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_CredentialResult proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
 List all credentials for a local identity. More...
 
void GNUNET_RECLAIM_get_credentials_next (struct GNUNET_RECLAIM_CredentialIterator *ait)
 Calls the record processor specified in GNUNET_RECLAIM_get_credentials_start for the next record. More...
 
void GNUNET_RECLAIM_get_credentials_stop (struct GNUNET_RECLAIM_CredentialIterator *ait)
 Stops iteration and releases the handle for further calls. More...
 
struct GNUNET_RECLAIM_OperationGNUNET_RECLAIM_ticket_issue (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *iss, const struct GNUNET_CRYPTO_PublicKey *rp, const struct GNUNET_RECLAIM_AttributeList *attrs, GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls)
 Issues a ticket to a relying party. More...
 
struct GNUNET_RECLAIM_OperationGNUNET_RECLAIM_ticket_revoke (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls)
 Revoked an issued ticket. More...
 
struct GNUNET_RECLAIM_OperationGNUNET_RECLAIM_ticket_consume (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls)
 Consumes an issued ticket. More...
 
struct GNUNET_RECLAIM_TicketIteratorGNUNET_RECLAIM_ticket_iteration_start (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_TicketCallback proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
 Lists all tickets that have been issued to remote identites (relying parties) More...
 
void GNUNET_RECLAIM_ticket_iteration_next (struct GNUNET_RECLAIM_TicketIterator *it)
 Calls the ticket processor specified in GNUNET_RECLAIM_ticket_iteration_start for the next record. More...
 
void GNUNET_RECLAIM_ticket_iteration_stop (struct GNUNET_RECLAIM_TicketIterator *it)
 Stops iteration and releases the handle for further calls. More...
 
void GNUNET_RECLAIM_disconnect (struct GNUNET_RECLAIM_Handle *h)
 Disconnect from identity provider service. More...
 
void GNUNET_RECLAIM_cancel (struct GNUNET_RECLAIM_Operation *op)
 Cancel an identity provider operation. More...
 
size_t GNUNET_RECLAIM_ticket_serialize_get_size (const struct GNUNET_RECLAIM_Ticket *tkt)
 Get serialized ticket size. More...
 
enum GNUNET_GenericReturnValue GNUNET_RECLAIM_read_ticket_from_buffer (const void *buffer, size_t len, struct GNUNET_RECLAIM_Ticket *tkt, size_t *tb_read)
 Deserializes a ticket. More...
 
ssize_t GNUNET_RECLAIM_write_ticket_to_buffer (const struct GNUNET_RECLAIM_Ticket *tkt, void *buffer, size_t len)
 Serializes a ticket. More...
 

Detailed Description

Macro Definition Documentation

◆ GNUNET_RECLAIM_VERSION

#define GNUNET_RECLAIM_VERSION   0x00000001

Version number of the re:claimID API.

Definition at line 52 of file gnunet_reclaim_service.h.

Typedef Documentation

◆ GNUNET_RECLAIM_TicketCallback

typedef void(* GNUNET_RECLAIM_TicketCallback) (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)

Method called when a token has been issued.

On success returns a ticket that can be given to a relying party in order for it retrieve identity attributes

Parameters
clsclosure
ticketthe ticket

Definition at line 99 of file gnunet_reclaim_service.h.

◆ GNUNET_RECLAIM_IssueTicketCallback

typedef void(* GNUNET_RECLAIM_IssueTicketCallback) (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_RECLAIM_PresentationList *presentations)

Method called when a token has been issued.

On success returns a ticket that can be given to a relying party in order for it retrieve identity attributes

Parameters
clsclosure
ticketthe ticket

Definition at line 111 of file gnunet_reclaim_service.h.

◆ GNUNET_RECLAIM_ContinuationWithStatus

typedef void(* GNUNET_RECLAIM_ContinuationWithStatus) (void *cls, int32_t success, const char *emsg)

Continuation called to notify client about result of the operation.

Parameters
clsThe callback closure
successGNUNET_SYSERR on failure
emsgNULL on success, otherwise an error message

Definition at line 125 of file gnunet_reclaim_service.h.

◆ GNUNET_RECLAIM_AttributeResult

typedef void(* GNUNET_RECLAIM_AttributeResult) (void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr)

Callback used to notify the client of attribute results.

Parameters
clsThe callback closure
identityThe identity authoritative over the attributes
attrThe attribute

Definition at line 136 of file gnunet_reclaim_service.h.

◆ GNUNET_RECLAIM_AttributeTicketResult

typedef void(* GNUNET_RECLAIM_AttributeTicketResult) (void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_RECLAIM_Presentation *presentation)

Callback used to notify the client of attribute results.

Parameters
clsThe callback closure
identityThe identity authoritative over the attributes
attrThe attribute
presentationThe presentation for the credential (may be NULL)

Definition at line 148 of file gnunet_reclaim_service.h.

◆ GNUNET_RECLAIM_CredentialResult

typedef void(* GNUNET_RECLAIM_CredentialResult) (void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, const struct GNUNET_RECLAIM_Credential *credential)

Callback used to notify the client of credential results.

Parameters
clsThe callback closure
identityThe identity authoritative over the attributes
credentialThe credential
attributesthe parsed attributes

Definition at line 162 of file gnunet_reclaim_service.h.

Function Documentation

◆ GNUNET_RECLAIM_connect()

struct GNUNET_RECLAIM_Handle* GNUNET_RECLAIM_connect ( const struct GNUNET_CONFIGURATION_Handle cfg)

Connect to the re:claimID service.

Parameters
cfgConfiguration to contact the re:claimID service.
Returns
handle to communicate with the service

Connect to the re:claimID service.

Parameters
cfgthe configuration to use
Returns
handle to use

Definition at line 1111 of file reclaim_api.c.

1112 {
1113  struct GNUNET_RECLAIM_Handle *h;
1114 
1115  h = GNUNET_new (struct GNUNET_RECLAIM_Handle);
1116  h->cfg = cfg;
1117  reconnect (h);
1118  if (NULL == h->mq)
1119  {
1120  GNUNET_free (h);
1121  return NULL;
1122  }
1123  return h;
1124 }
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:109
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
static void reconnect(struct GNUNET_RECLAIM_Handle *h)
Try again to connect to the service.
Definition: reclaim_api.c:1062
struct GNUNET_MQ_Handle * mq
Our connection to the ARM service.
Definition: arm_api.c:107
const struct GNUNET_CONFIGURATION_Handle * cfg
The configuration that we are using.
Definition: arm_api.c:112
Handle to the service.
Definition: reclaim_api.c:317

References cfg, GNUNET_ARM_Handle::cfg, GNUNET_free, GNUNET_new, h, GNUNET_ARM_Handle::mq, and reconnect().

Referenced by REST_openid_init(), REST_reclaim_init(), and run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_attribute_store()

struct GNUNET_RECLAIM_Operation* GNUNET_RECLAIM_attribute_store ( struct GNUNET_RECLAIM_Handle h,
const struct GNUNET_CRYPTO_PrivateKey pkey,
const struct GNUNET_RECLAIM_Attribute attr,
const struct GNUNET_TIME_Relative exp_interval,
GNUNET_RECLAIM_ContinuationWithStatus  cont,
void *  cont_cls 
)

Store an attribute.

If the attribute is already present, it is replaced with the new attribute.

Parameters
hhandle to the reclaim service
pkeyPrivate key of the identity to add an attribute to
attrThe attribute
exp_intervalThe relative expiration interval for the attribute
contContinuation to call when done
cont_clsClosure for cont
Returns
handle Used to to abort the request

Definition at line 1162 of file reclaim_api.c.

1169 {
1170  struct GNUNET_RECLAIM_Operation *op;
1171  struct AttributeStoreMessage *sam;
1172  size_t attr_len;
1173  size_t key_len;
1174  ssize_t written;
1175  char *buf;
1176 
1178  op->h = h;
1179  op->as_cb = cont;
1180  op->cls = cont_cls;
1181  op->r_id = h->r_id_gen++;
1182  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1185  op->env = GNUNET_MQ_msg_extra (sam,
1186  attr_len + key_len,
1188  sam->key_len = htons (key_len);
1189  buf = (char *) &sam[1];
1191  GNUNET_assert (0 < written);
1192  buf += written;
1193  sam->id = htonl (op->r_id);
1195 
1197 
1198  sam->attr_len = htons (attr_len);
1199  if (NULL != h->mq)
1200  GNUNET_MQ_send_copy (h->mq, op->env);
1201  return op;
1202 }
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static char * pkey
Public key of the zone to look in, in ASCII.
static struct GNUNET_TIME_Relative exp_interval
Attribute expiration interval.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
ssize_t GNUNET_CRYPTO_private_key_get_length(const struct GNUNET_CRYPTO_PrivateKey *key)
Get the compacted length of a GNUNET_CRYPTO_PrivateKey.
Definition: crypto_pkey.c:47
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:37
ssize_t GNUNET_CRYPTO_write_private_key_to_buffer(const struct GNUNET_CRYPTO_PrivateKey *key, void *buffer, size_t len)
Writes a GNUNET_CRYPTO_PrivateKey to a compact buffer.
Definition: crypto_pkey.c:171
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void GNUNET_MQ_send_copy(struct GNUNET_MQ_Handle *mq, const struct GNUNET_MQ_Envelope *ev)
Send a copy of a message with the given message queue.
Definition: mq.c:370
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
Definition: gnunet_mq_lib.h:63
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE
size_t GNUNET_RECLAIM_attribute_serialize_get_size(const struct GNUNET_RECLAIM_Attribute *attr)
Get required size for serialization buffer.
size_t GNUNET_RECLAIM_attribute_serialize(const struct GNUNET_RECLAIM_Attribute *attr, char *result)
Serialize an attribute.
Use to store an identity attribute.
Definition: reclaim.h:41
uint64_t exp
The expiration interval of the attribute.
Definition: reclaim.h:50
uint16_t key_len
The length of the private key.
Definition: reclaim.h:65
uint16_t attr_len
The length of the attribute.
Definition: reclaim.h:60
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:55
struct GNUNET_ARM_Handle * h
ARM handle.
Definition: arm_api.c:55
Handle for an operation with the service.
Definition: reclaim_api.c:41
uint64_t rel_value_us
The actual value.

References AttributeStoreMessage::attr_len, AttributeStoreMessage::exp, exp_interval, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_htonll(), GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, GNUNET_MQ_msg_extra, GNUNET_MQ_send_copy(), GNUNET_new, GNUNET_RECLAIM_attribute_serialize(), GNUNET_RECLAIM_attribute_serialize_get_size(), h, GNUNET_ARM_Operation::h, AttributeStoreMessage::id, AttributeStoreMessage::key_len, GNUNET_ARM_Handle::mq, op, pkey, and GNUNET_TIME_Relative::rel_value_us.

Referenced by add_attribute_cont(), and iter_finished().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_credential_store()

struct GNUNET_RECLAIM_Operation* GNUNET_RECLAIM_credential_store ( struct GNUNET_RECLAIM_Handle h,
const struct GNUNET_CRYPTO_PrivateKey pkey,
const struct GNUNET_RECLAIM_Credential credential,
const struct GNUNET_TIME_Relative exp_interval,
GNUNET_RECLAIM_ContinuationWithStatus  cont,
void *  cont_cls 
)

Store a credential.

If the credential is already present, it is replaced with the new credential.

Parameters
hhandle to the re:claimID service
pkeyprivate key of the identity
credentialthe credential value
exp_intervalthe relative expiration interval for the credential
contcontinuation to call when done
cont_clsclosure for cont
Returns
handle to abort the request

Definition at line 1247 of file reclaim_api.c.

1254 {
1255  struct GNUNET_RECLAIM_Operation *op;
1256  struct AttributeStoreMessage *sam;
1257  size_t attr_len;
1258  size_t key_len;
1259  ssize_t written;
1260  char *buf;
1261 
1263  op->h = h;
1264  op->as_cb = cont;
1265  op->cls = cont_cls;
1266  op->r_id = h->r_id_gen++;
1268  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1270  op->env = GNUNET_MQ_msg_extra (sam,
1271  attr_len + key_len,
1273  sam->key_len = htons (key_len);
1274  buf = (char *) &sam[1];
1276  GNUNET_assert (0 <= written);
1277  buf += written;
1278  sam->id = htonl (op->r_id);
1280 
1282 
1283  sam->attr_len = htons (attr_len);
1284  if (NULL != h->mq)
1285  GNUNET_MQ_send_copy (h->mq, op->env);
1286  return op;
1287 }
static struct GNUNET_RECLAIM_Identifier credential
Credential ID.
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE
size_t GNUNET_RECLAIM_credential_serialize(const struct GNUNET_RECLAIM_Credential *credential, char *result)
Serialize an credential.
size_t GNUNET_RECLAIM_credential_serialize_get_size(const struct GNUNET_RECLAIM_Credential *credential)
Get required size for serialization buffer.

References AttributeStoreMessage::attr_len, credential, AttributeStoreMessage::exp, exp_interval, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_htonll(), GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE, GNUNET_MQ_msg_extra, GNUNET_MQ_send_copy(), GNUNET_new, GNUNET_RECLAIM_credential_serialize(), GNUNET_RECLAIM_credential_serialize_get_size(), h, GNUNET_ARM_Operation::h, AttributeStoreMessage::id, AttributeStoreMessage::key_len, GNUNET_ARM_Handle::mq, op, pkey, and GNUNET_TIME_Relative::rel_value_us.

Referenced by add_credential_cont(), and cred_iter_finished().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_attribute_delete()

struct GNUNET_RECLAIM_Operation* GNUNET_RECLAIM_attribute_delete ( struct GNUNET_RECLAIM_Handle h,
const struct GNUNET_CRYPTO_PrivateKey pkey,
const struct GNUNET_RECLAIM_Attribute attr,
GNUNET_RECLAIM_ContinuationWithStatus  cont,
void *  cont_cls 
)

Delete an attribute.

Tickets used to share this attribute are updated accordingly.

Parameters
hhandle to the re:claimID service
pkeyPrivate key of the identity to add an attribute to
attrThe attribute
contContinuation to call when done
cont_clsClosure for cont
Returns
handle Used to to abort the request

Definition at line 1206 of file reclaim_api.c.

1212 {
1213  struct GNUNET_RECLAIM_Operation *op;
1214  struct AttributeDeleteMessage *dam;
1215  size_t attr_len;
1216  size_t key_len;
1217  ssize_t written;
1218  char *buf;
1219 
1221  op->h = h;
1222  op->as_cb = cont;
1223  op->cls = cont_cls;
1224  op->r_id = h->r_id_gen++;
1225  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1228  op->env = GNUNET_MQ_msg_extra (dam,
1229  attr_len + key_len,
1231  dam->key_len = htons (key_len);
1232  buf = (char *) &dam[1];
1234  GNUNET_assert (0 < written);
1235  buf += written;
1236  dam->id = htonl (op->r_id);
1238 
1239  dam->attr_len = htons (attr_len);
1240  if (NULL != h->mq)
1241  GNUNET_MQ_send_copy (h->mq, op->env);
1242  return op;
1243 }
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE
Use to delete an identity attribute.
Definition: reclaim.h:77
uint16_t key_len
The length of the private key.
Definition: reclaim.h:96
uint16_t attr_len
The length of the attribute.
Definition: reclaim.h:91
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:86

References AttributeDeleteMessage::attr_len, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, GNUNET_MQ_msg_extra, GNUNET_MQ_send_copy(), GNUNET_new, GNUNET_RECLAIM_attribute_serialize(), GNUNET_RECLAIM_attribute_serialize_get_size(), h, GNUNET_ARM_Operation::h, AttributeDeleteMessage::id, AttributeDeleteMessage::key_len, GNUNET_ARM_Handle::mq, op, and pkey.

Referenced by delete_attribute_cont(), and iter_finished().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_credential_delete()

struct GNUNET_RECLAIM_Operation* GNUNET_RECLAIM_credential_delete ( struct GNUNET_RECLAIM_Handle h,
const struct GNUNET_CRYPTO_PrivateKey pkey,
const struct GNUNET_RECLAIM_Credential cred,
GNUNET_RECLAIM_ContinuationWithStatus  cont,
void *  cont_cls 
)

Delete a credential.

Tickets used to share a presentation of this credential are updated accordingly.

Parameters
hhandle to the re:claimID service
pkeyPrivate key of the identity to add an attribute to
credThe credential
contContinuation to call when done
cont_clsClosure for cont
Returns
handle Used to to abort the request

Definition at line 1291 of file reclaim_api.c.

1297 {
1298  struct GNUNET_RECLAIM_Operation *op;
1299  struct AttributeDeleteMessage *dam;
1300  size_t attr_len;
1301  size_t key_len;
1302  ssize_t written;
1303  char *buf;
1304 
1306  op->h = h;
1307  op->as_cb = cont;
1308  op->cls = cont_cls;
1309  op->r_id = h->r_id_gen++;
1311  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1313  op->env = GNUNET_MQ_msg_extra (dam,
1314  attr_len + key_len,
1316  dam->key_len = htons (key_len);
1317  buf = (char *) &dam[1];
1319  GNUNET_assert (0 <= written);
1320  buf += written;
1321  dam->id = htonl (op->r_id);
1323 
1324  dam->attr_len = htons (attr_len);
1325  if (NULL != h->mq)
1326  GNUNET_MQ_send_copy (h->mq, op->env);
1327  return op;
1328 }
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE

References AttributeDeleteMessage::attr_len, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE, GNUNET_MQ_msg_extra, GNUNET_MQ_send_copy(), GNUNET_new, GNUNET_RECLAIM_credential_serialize(), GNUNET_RECLAIM_credential_serialize_get_size(), h, GNUNET_ARM_Operation::h, AttributeDeleteMessage::id, AttributeDeleteMessage::key_len, GNUNET_ARM_Handle::mq, op, and pkey.

Referenced by delete_credential_cont().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_get_attributes_start()

struct GNUNET_RECLAIM_AttributeIterator* GNUNET_RECLAIM_get_attributes_start ( struct GNUNET_RECLAIM_Handle h,
const struct GNUNET_CRYPTO_PrivateKey identity,
GNUNET_SCHEDULER_TaskCallback  error_cb,
void *  error_cb_cls,
GNUNET_RECLAIM_AttributeResult  proc,
void *  proc_cls,
GNUNET_SCHEDULER_TaskCallback  finish_cb,
void *  finish_cb_cls 
)

List all attributes for a local identity.

This MUST lock the struct GNUNET_RECLAIM_Handle for any other calls than GNUNET_RECLAIM_get_attributes_next() and GNUNET_RECLAIM_get_attributes_stop. proc will be called once immediately, and then again after GNUNET_RECLAIM_get_attributes_next() is invoked.

On error (disconnect), error_cb will be invoked. On normal completion, finish_cb proc will be invoked.

Parameters
hHandle to the re:claimID service
identityIdentity to iterate over
error_cbFunction to call on error (i.e. disconnect), the handle is afterwards invalid
error_cb_clsClosure for error_cb
procFunction to call on each attribute
proc_clsClosure for proc
finish_cbFunction to call on completion the handle is afterwards invalid
finish_cb_clsClosure for finish_cb
Returns
an iterator Handle to use for iteration

Definition at line 1332 of file reclaim_api.c.

1341 {
1343  struct GNUNET_MQ_Envelope *env;
1345  uint32_t rid;
1346  size_t key_len;
1347 
1348  rid = h->r_id_gen++;
1350  it->h = h;
1351  it->error_cb = error_cb;
1352  it->error_cb_cls = error_cb_cls;
1353  it->finish_cb = finish_cb;
1354  it->finish_cb_cls = finish_cb_cls;
1355  it->proc = proc;
1356  it->proc_cls = proc_cls;
1357  it->r_id = rid;
1358  it->identity = *identity;
1360  GNUNET_CONTAINER_DLL_insert_tail (h->it_head, h->it_tail, it);
1361  env =
1363  key_len,
1365  msg->id = htonl (rid);
1366  msg->key_len = htons (key_len);
1368  if (NULL == h->mq)
1369  it->env = env;
1370  else
1371  GNUNET_MQ_send (h->mq, env);
1372  return it;
1373 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
static void error_cb(void *cls)
Function called if lookup fails.
Definition: gnunet-abd.c:479
static struct GNUNET_IDENTITY_Handle * identity
Which namespace do we publish to? NULL if we do not publish to a namespace.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:304
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START
Start a attribute iteration for the given identity.
Definition: reclaim.h:202
uint16_t key_len
The length of the private key.
Definition: reclaim.h:221
Handle for a attribute iterator operation.
Definition: reclaim_api.c:182
struct GNUNET_RECLAIM_Handle * h
Main handle to access the service.
Definition: reclaim_api.c:196
void * error_cb_cls
Closure for error_cb.
Definition: reclaim_api.c:226
GNUNET_RECLAIM_AttributeResult proc
The continuation to call with the results.
Definition: reclaim_api.c:211
struct GNUNET_MQ_Envelope * env
Envelope of the message to send to the service, if not yet sent.
Definition: reclaim_api.c:232
struct GNUNET_CRYPTO_PrivateKey identity
Private key of the zone.
Definition: reclaim_api.c:237
void * proc_cls
Closure for proc.
Definition: reclaim_api.c:216
GNUNET_SCHEDULER_TaskCallback error_cb
Function to call on errors.
Definition: reclaim_api.c:221
GNUNET_SCHEDULER_TaskCallback finish_cb
Function to call on completion.
Definition: reclaim_api.c:201
uint32_t r_id
The operation id this zone iteration operation has.
Definition: reclaim_api.c:242
void * finish_cb_cls
Closure for finish_cb.
Definition: reclaim_api.c:206

References env, GNUNET_RECLAIM_AttributeIterator::env, error_cb(), GNUNET_RECLAIM_AttributeIterator::error_cb, GNUNET_RECLAIM_AttributeIterator::error_cb_cls, GNUNET_RECLAIM_AttributeIterator::finish_cb, GNUNET_RECLAIM_AttributeIterator::finish_cb_cls, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_RECLAIM_AttributeIterator::h, identity, GNUNET_RECLAIM_AttributeIterator::identity, AttributeIterationStartMessage::key_len, GNUNET_ARM_Handle::mq, msg, GNUNET_RECLAIM_AttributeIterator::proc, GNUNET_RECLAIM_AttributeIterator::proc_cls, and GNUNET_RECLAIM_AttributeIterator::r_id.

Referenced by code_redirect(), cred_iter_finished(), and list_attribute_cont().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_get_attributes_next()

void GNUNET_RECLAIM_get_attributes_next ( struct GNUNET_RECLAIM_AttributeIterator it)

Calls the record processor specified in GNUNET_RECLAIM_get_attributes_start for the next record.

Parameters
itThe iterator

Definition at line 1377 of file reclaim_api.c.

1378 {
1379  struct GNUNET_RECLAIM_Handle *h = it->h;
1381  struct GNUNET_MQ_Envelope *env;
1382 
1383  env =
1385  msg->id = htonl (it->r_id);
1386  GNUNET_MQ_send (h->mq, env);
1387 }
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:78
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT
Ask for next result of attribute iteration for the given operation.
Definition: reclaim.h:233

References env, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, GNUNET_MQ_msg, GNUNET_MQ_send(), h, GNUNET_RECLAIM_AttributeIterator::h, GNUNET_ARM_Handle::mq, msg, and GNUNET_RECLAIM_AttributeIterator::r_id.

Referenced by attr_collect(), iter_cb(), and oidc_attr_collect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_get_attributes_stop()

void GNUNET_RECLAIM_get_attributes_stop ( struct GNUNET_RECLAIM_AttributeIterator it)

Stops iteration and releases the handle for further calls.

Must be called on any iteration that has not yet completed prior to calling GNUNET_RECLAIM_disconnect.

Parameters
itthe iterator

Definition at line 1391 of file reclaim_api.c.

1392 {
1393  struct GNUNET_RECLAIM_Handle *h = it->h;
1394  struct GNUNET_MQ_Envelope *env;
1396 
1397  if (NULL != h->mq)
1398  {
1399  env =
1401  msg->id = htonl (it->r_id);
1402  GNUNET_MQ_send (h->mq, env);
1403  }
1404  free_it (it);
1405 }
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP
static void free_it(struct GNUNET_RECLAIM_AttributeIterator *it)
Free it.
Definition: reclaim_api.c:454
Stop attribute iteration for the given operation.
Definition: reclaim.h:315

References env, free_it(), GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, GNUNET_MQ_msg, GNUNET_MQ_send(), h, GNUNET_RECLAIM_AttributeIterator::h, GNUNET_ARM_Handle::mq, msg, and GNUNET_RECLAIM_AttributeIterator::r_id.

Referenced by cleanup_handle(), and do_cleanup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_get_credentials_start()

struct GNUNET_RECLAIM_CredentialIterator* GNUNET_RECLAIM_get_credentials_start ( struct GNUNET_RECLAIM_Handle h,
const struct GNUNET_CRYPTO_PrivateKey identity,
GNUNET_SCHEDULER_TaskCallback  error_cb,
void *  error_cb_cls,
GNUNET_RECLAIM_CredentialResult  proc,
void *  proc_cls,
GNUNET_SCHEDULER_TaskCallback  finish_cb,
void *  finish_cb_cls 
)

List all credentials for a local identity.

This MUST lock the struct GNUNET_RECLAIM_Handle for any other calls than GNUNET_RECLAIM_get_credentials_next() and GNUNET_RECLAIM_get_credentials_stop. proc will be called once immediately, and then again after GNUNET_RECLAIM_get_credentials_next() is invoked.

On error (disconnect), error_cb will be invoked. On normal completion, finish_cb proc will be invoked.

Parameters
hHandle to the re:claimID service
identityIdentity to iterate over
error_cbFunction to call on error (i.e. disconnect), the handle is afterwards invalid
error_cb_clsClosure for error_cb
procFunction to call on each credential
proc_clsClosure for proc
finish_cbFunction to call on completion the handle is afterwards invalid
finish_cb_clsClosure for finish_cb
Returns
an iterator Handle to use for iteration

Definition at line 1409 of file reclaim_api.c.

1418 {
1420  struct GNUNET_MQ_Envelope *env;
1422  uint32_t rid;
1423  size_t key_len;
1424 
1425  rid = h->r_id_gen++;
1427  ait->h = h;
1428  ait->error_cb = error_cb;
1429  ait->error_cb_cls = error_cb_cls;
1430  ait->finish_cb = finish_cb;
1431  ait->finish_cb_cls = finish_cb_cls;
1432  ait->proc = proc;
1433  ait->proc_cls = proc_cls;
1434  ait->r_id = rid;
1435  ait->identity = *identity;
1437  GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait);
1438  env =
1440  key_len,
1442  msg->id = htonl (rid);
1443  msg->key_len = htons (key_len);
1445  if (NULL == h->mq)
1446  ait->env = env;
1447  else
1448  GNUNET_MQ_send (h->mq, env);
1449  return ait;
1450 }
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START
Start a credential iteration for the given identity.
Definition: reclaim.h:250
uint16_t key_len
The length of the private key.
Definition: reclaim.h:269
Handle for a credential iterator operation.
Definition: reclaim_api.c:249
GNUNET_SCHEDULER_TaskCallback error_cb
Function to call on errors.
Definition: reclaim_api.c:288
GNUNET_SCHEDULER_TaskCallback finish_cb
Function to call on completion.
Definition: reclaim_api.c:268
void * proc_cls
Closure for proc.
Definition: reclaim_api.c:283
GNUNET_RECLAIM_CredentialResult proc
The continuation to call with the results.
Definition: reclaim_api.c:278
void * finish_cb_cls
Closure for finish_cb.
Definition: reclaim_api.c:273
uint32_t r_id
The operation id this zone iteration operation has.
Definition: reclaim_api.c:309
struct GNUNET_MQ_Envelope * env
Envelope of the message to send to the service, if not yet sent.
Definition: reclaim_api.c:299
struct GNUNET_CRYPTO_PrivateKey identity
Private key of the zone.
Definition: reclaim_api.c:304
struct GNUNET_RECLAIM_Handle * h
Main handle to access the service.
Definition: reclaim_api.c:263
void * error_cb_cls
Closure for error_cb.
Definition: reclaim_api.c:293

References env, GNUNET_RECLAIM_CredentialIterator::env, error_cb(), GNUNET_RECLAIM_CredentialIterator::error_cb, GNUNET_RECLAIM_CredentialIterator::error_cb_cls, GNUNET_RECLAIM_CredentialIterator::finish_cb, GNUNET_RECLAIM_CredentialIterator::finish_cb_cls, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_RECLAIM_CredentialIterator::h, identity, GNUNET_RECLAIM_CredentialIterator::identity, CredentialIterationStartMessage::key_len, GNUNET_ARM_Handle::mq, msg, GNUNET_RECLAIM_CredentialIterator::proc, GNUNET_RECLAIM_CredentialIterator::proc_cls, and GNUNET_RECLAIM_CredentialIterator::r_id.

Referenced by list_credential_cont(), oidc_attr_collect_finished_cb(), and start_process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_get_credentials_next()

void GNUNET_RECLAIM_get_credentials_next ( struct GNUNET_RECLAIM_CredentialIterator ait)

Calls the record processor specified in GNUNET_RECLAIM_get_credentials_start for the next record.

Parameters
aitthe iterator

Definition at line 1454 of file reclaim_api.c.

1456 {
1457  struct GNUNET_RECLAIM_Handle *h = ait->h;
1459  struct GNUNET_MQ_Envelope *env;
1460 
1461  env =
1463  msg->id = htonl (ait->r_id);
1464  GNUNET_MQ_send (h->mq, env);
1465 }
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT
Ask for next result of credential iteration for the given operation.
Definition: reclaim.h:281

References env, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT, GNUNET_MQ_msg, GNUNET_MQ_send(), h, GNUNET_RECLAIM_CredentialIterator::h, GNUNET_ARM_Handle::mq, msg, and GNUNET_RECLAIM_CredentialIterator::r_id.

Referenced by cred_collect(), cred_iter_cb(), and oidc_cred_collect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_get_credentials_stop()

void GNUNET_RECLAIM_get_credentials_stop ( struct GNUNET_RECLAIM_CredentialIterator ait)

Stops iteration and releases the handle for further calls.

Must be called on any iteration that has not yet completed prior to calling GNUNET_RECLAIM_disconnect.

Parameters
aitthe iterator

Definition at line 1469 of file reclaim_api.c.

1471 {
1472  struct GNUNET_RECLAIM_Handle *h = ait->h;
1473  struct GNUNET_MQ_Envelope *env;
1475 
1476  if (NULL != h->mq)
1477  {
1478  env =
1479  GNUNET_MQ_msg (msg,
1481  msg->id = htonl (ait->r_id);
1482  GNUNET_MQ_send (h->mq, env);
1483  }
1484  free_ait (ait);
1485 }
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP
static void free_ait(struct GNUNET_RECLAIM_CredentialIterator *ait)
Free it.
Definition: reclaim_api.c:471
Stop credential iteration for the given operation.
Definition: reclaim.h:298

References env, free_ait(), GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP, GNUNET_MQ_msg, GNUNET_MQ_send(), h, GNUNET_RECLAIM_CredentialIterator::h, GNUNET_ARM_Handle::mq, msg, and GNUNET_RECLAIM_CredentialIterator::r_id.

Referenced by cleanup_handle(), and do_cleanup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ticket_issue()

struct GNUNET_RECLAIM_Operation* GNUNET_RECLAIM_ticket_issue ( struct GNUNET_RECLAIM_Handle h,
const struct GNUNET_CRYPTO_PrivateKey iss,
const struct GNUNET_CRYPTO_PublicKey rp,
const struct GNUNET_RECLAIM_AttributeList attrs,
GNUNET_RECLAIM_IssueTicketCallback  cb,
void *  cb_cls 
)

Issues a ticket to a relying party.

The identity may use GNUNET_RECLAIM_ticket_consume to consume the ticket and retrieve the attributes specified in the attribute list.

Parameters
hthe identity provider to use
issthe issuing identity (= the user)
rpthe subject of the ticket (= the relying party)
attrsthe attributes that the relying party is given access to
cbthe callback
cb_clsthe callback closure
Returns
handle to abort the operation

Definition at line 1489 of file reclaim_api.c.

1496 {
1497  struct GNUNET_RECLAIM_Operation *op;
1498  struct IssueTicketMessage *tim;
1499  size_t attr_len;
1500  size_t key_len;
1501  size_t rpk_len;
1502  ssize_t written;
1503  char *buf;
1504 
1506  op->h = h;
1507  op->ti_cb = cb;
1508  op->cls = cb_cls;
1509  op->r_id = h->r_id_gen++;
1512  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1514  op->env = GNUNET_MQ_msg_extra (tim,
1515  attr_len + key_len + rpk_len,
1517  tim->key_len = htons (key_len);
1518  tim->pkey_len = htons (rpk_len);
1519  buf = (char *) &tim[1];
1520  written = GNUNET_CRYPTO_write_private_key_to_buffer (iss, buf, key_len);
1521  GNUNET_assert (0 <= written);
1522  buf += written;
1523  written = GNUNET_CRYPTO_write_public_key_to_buffer (rp, buf, rpk_len);
1524  GNUNET_assert (0 <= written);
1525  buf += written;
1526  tim->id = htonl (op->r_id);
1527 
1529  tim->attr_len = htons (attr_len);
1530  if (NULL != h->mq)
1531  GNUNET_MQ_send_copy (h->mq, op->env);
1532  return op;
1533 }
static char * rp
Relying party.
ssize_t GNUNET_CRYPTO_public_key_get_length(const struct GNUNET_CRYPTO_PublicKey *key)
Get the compacted length of a GNUNET_CRYPTO_PublicKey.
Definition: crypto_pkey.c:68
ssize_t GNUNET_CRYPTO_write_public_key_to_buffer(const struct GNUNET_CRYPTO_PublicKey *key, void *buffer, size_t len)
Writes a GNUNET_CRYPTO_PublicKey to a compact buffer.
Definition: crypto_pkey.c:128
#define GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET
size_t GNUNET_RECLAIM_attribute_list_serialize(const struct GNUNET_RECLAIM_AttributeList *attrs, char *result)
Serialize an attribute list.
size_t GNUNET_RECLAIM_attribute_list_serialize_get_size(const struct GNUNET_RECLAIM_AttributeList *attrs)
Get required size for serialization buffer.
Ticket issue message.
Definition: reclaim.h:396
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:405
uint16_t pkey_len
The length of the relying party public key.
Definition: reclaim.h:425
uint16_t key_len
The length of the identity private key.
Definition: reclaim.h:420
uint16_t attr_len
length of serialized attribute list
Definition: reclaim.h:415

References IssueTicketMessage::attr_len, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_public_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_CRYPTO_write_public_key_to_buffer(), GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET, GNUNET_MQ_msg_extra, GNUNET_MQ_send_copy(), GNUNET_new, GNUNET_RECLAIM_attribute_list_serialize(), GNUNET_RECLAIM_attribute_list_serialize_get_size(), h, GNUNET_ARM_Operation::h, IssueTicketMessage::id, IssueTicketMessage::key_len, GNUNET_ARM_Handle::mq, op, IssueTicketMessage::pkey_len, and rp.

Referenced by iter_finished(), and oidc_cred_collect_finished_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ticket_revoke()

struct GNUNET_RECLAIM_Operation* GNUNET_RECLAIM_ticket_revoke ( struct GNUNET_RECLAIM_Handle h,
const struct GNUNET_CRYPTO_PrivateKey identity,
const struct GNUNET_RECLAIM_Ticket ticket,
GNUNET_RECLAIM_ContinuationWithStatus  cb,
void *  cb_cls 
)

Revoked an issued ticket.

The relying party will be unable to retrieve attributes. Other issued tickets remain unaffected. This includes tickets issued to other relying parties as well as to other tickets issued to the audience specified in this ticket.

Parameters
hthe identity provider to use
identitythe issuing identity
ticketthe ticket to revoke
cbthe callback
cb_clsthe callback closure
Returns
handle to abort the operation

Definition at line 1692 of file reclaim_api.c.

1698 {
1699  struct GNUNET_RECLAIM_Operation *op;
1700  struct RevokeTicketMessage *msg;
1701  uint32_t rid;
1702  size_t key_len;
1703  size_t tkt_len;
1704  ssize_t written;
1705  char *buf;
1706 
1707  rid = h->r_id_gen++;
1709  op->h = h;
1710  op->rvk_cb = cb;
1711  op->cls = cb_cls;
1712  op->r_id = rid;
1713  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1716  op->env = GNUNET_MQ_msg_extra (msg,
1717  key_len + tkt_len,
1719  msg->id = htonl (rid);
1720  msg->key_len = htons (key_len);
1721  msg->tkt_len = htons (tkt_len);
1722  buf = (char*) &msg[1];
1724  buf,
1725  key_len);
1726  GNUNET_assert (0 <= written);
1727  buf += written;
1729  buf,
1730  tkt_len);
1731  if (NULL != h->mq)
1732  {
1733  GNUNET_MQ_send (h->mq, op->env);
1734  op->env = NULL;
1735  }
1736  return op;
1737 }
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
#define GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET
ssize_t GNUNET_RECLAIM_write_ticket_to_buffer(const struct GNUNET_RECLAIM_Ticket *tkt, void *buffer, size_t len)
Serializes a ticket.
Definition: reclaim_api.c:1783
size_t GNUNET_RECLAIM_ticket_serialize_get_size(const struct GNUNET_RECLAIM_Ticket *tkt)
Get serialized ticket size.
Definition: reclaim_api.c:1740
Ticket revoke message.
Definition: reclaim.h:438
uint16_t key_len
The length of the private key.
Definition: reclaim.h:452
uint16_t tkt_len
The length of the ticket.
Definition: reclaim.h:457

References GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_RECLAIM_ticket_serialize_get_size(), GNUNET_RECLAIM_write_ticket_to_buffer(), h, GNUNET_ARM_Operation::h, identity, RevokeTicketMessage::key_len, GNUNET_ARM_Handle::mq, msg, op, ticket, and RevokeTicketMessage::tkt_len.

Referenced by iter_finished(), and revoke_ticket_cont().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ticket_consume()

struct GNUNET_RECLAIM_Operation* GNUNET_RECLAIM_ticket_consume ( struct GNUNET_RECLAIM_Handle h,
const struct GNUNET_CRYPTO_PrivateKey identity,
const struct GNUNET_RECLAIM_Ticket ticket,
GNUNET_RECLAIM_AttributeTicketResult  cb,
void *  cb_cls 
)

Consumes an issued ticket.

The ticket is used to retrieve identity information from the issuer

Parameters
hthe identity provider to use
identitythe identity that is the subject of the issued ticket (the relying party)
ticketthe issued ticket to consume
cbthe callback to call
cb_clsthe callback closure
Returns
handle to abort the operation

The ticket is persisted and used to retrieve identity information from the issuer

Parameters
hthe reclaim to use
identitythe identity that is the subject of the issued ticket (the relying party)
ticketthe issued ticket to consume
cbthe callback to call
cb_clsthe callback closure
Returns
handle to abort the operation

Definition at line 1549 of file reclaim_api.c.

1555 {
1556  struct GNUNET_RECLAIM_Operation *op;
1557  struct ConsumeTicketMessage *ctm;
1558  size_t key_len;
1559  size_t tkt_len;
1560  char *buf;
1561 
1563  op->h = h;
1564  op->atr_cb = cb;
1565  op->cls = cb_cls;
1566  op->r_id = h->r_id_gen++;
1569  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1570  op->env = GNUNET_MQ_msg_extra (ctm,
1571  key_len + tkt_len,
1573  ctm->key_len = htons (key_len);
1574  buf = (char*) &ctm[1];
1576  buf += key_len;
1577  ctm->tkt_len = htons (tkt_len);
1579  ctm->id = htonl (op->r_id);
1580  if (NULL != h->mq)
1581  GNUNET_MQ_send_copy (h->mq, op->env);
1582  else
1583  reconnect (h);
1584  return op;
1585 }
#define GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET
Ticket consume message.
Definition: reclaim.h:523
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:532
uint16_t key_len
The length of the private key.
Definition: reclaim.h:537
uint16_t tkt_len
The length of the ticket.
Definition: reclaim.h:542

References GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, GNUNET_MQ_msg_extra, GNUNET_MQ_send_copy(), GNUNET_new, GNUNET_RECLAIM_ticket_serialize_get_size(), GNUNET_RECLAIM_write_ticket_to_buffer(), h, GNUNET_ARM_Operation::h, ConsumeTicketMessage::id, identity, ConsumeTicketMessage::key_len, GNUNET_ARM_Handle::mq, op, reconnect(), ticket, and ConsumeTicketMessage::tkt_len.

Referenced by consume_ticket_cont(), iter_finished(), and userinfo_endpoint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ticket_iteration_start()

struct GNUNET_RECLAIM_TicketIterator* GNUNET_RECLAIM_ticket_iteration_start ( struct GNUNET_RECLAIM_Handle h,
const struct GNUNET_CRYPTO_PrivateKey identity,
GNUNET_SCHEDULER_TaskCallback  error_cb,
void *  error_cb_cls,
GNUNET_RECLAIM_TicketCallback  proc,
void *  proc_cls,
GNUNET_SCHEDULER_TaskCallback  finish_cb,
void *  finish_cb_cls 
)

Lists all tickets that have been issued to remote identites (relying parties)

Parameters
hthe identity provider to use
identitythe issuing identity
error_cbfunction to call on error (i.e. disconnect), the handle is afterwards invalid
error_cb_clsclosure for error_cb
procfunction to call on each ticket; it will be called repeatedly with a value (if available)
proc_clsclosure for proc
finish_cbfunction to call on completion the handle is afterwards invalid
finish_cb_clsclosure for finish_cb
Returns
an iterator handle to use for iteration

Definition at line 1589 of file reclaim_api.c.

1598 {
1599  struct GNUNET_RECLAIM_TicketIterator *it;
1600  struct GNUNET_MQ_Envelope *env;
1602  uint32_t rid;
1603  size_t key_len;
1604 
1605  rid = h->r_id_gen++;
1607  it->h = h;
1608  it->error_cb = error_cb;
1609  it->error_cb_cls = error_cb_cls;
1610  it->finish_cb = finish_cb;
1611  it->finish_cb_cls = finish_cb_cls;
1612  it->tr_cb = proc;
1613  it->cls = proc_cls;
1614  it->r_id = rid;
1615 
1617  GNUNET_CONTAINER_DLL_insert_tail (h->ticket_it_head, h->ticket_it_tail, it);
1619  key_len,
1621  msg->id = htonl (rid);
1622  msg->key_len = htons (key_len);
1624  &msg[1],
1625  key_len);
1626  if (NULL == h->mq)
1627  it->env = env;
1628  else
1629  GNUNET_MQ_send (h->mq, env);
1630  return it;
1631 }
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START
Handle for a ticket iterator operation.
Definition: reclaim_api.c:119
GNUNET_RECLAIM_TicketCallback tr_cb
The continuation to call with the results.
Definition: reclaim_api.c:148
uint32_t r_id
The operation id this zone iteration operation has.
Definition: reclaim_api.c:174
void * error_cb_cls
Closure for error_cb.
Definition: reclaim_api.c:163
struct GNUNET_RECLAIM_Handle * h
Main handle to access the idp.
Definition: reclaim_api.c:133
GNUNET_SCHEDULER_TaskCallback finish_cb
Function to call on completion.
Definition: reclaim_api.c:138
void * finish_cb_cls
Closure for finish_cb.
Definition: reclaim_api.c:143
struct GNUNET_MQ_Envelope * env
Envelope of the message to send to the service, if not yet sent.
Definition: reclaim_api.c:169
void * cls
Closure for tr_cb.
Definition: reclaim_api.c:153
GNUNET_SCHEDULER_TaskCallback error_cb
Function to call on errors.
Definition: reclaim_api.c:158
Start a ticket iteration for the given identity.
Definition: reclaim.h:331
uint16_t key_len
The length of the private key.
Definition: reclaim.h:350

References GNUNET_RECLAIM_TicketIterator::cls, env, GNUNET_RECLAIM_TicketIterator::env, error_cb(), GNUNET_RECLAIM_TicketIterator::error_cb, GNUNET_RECLAIM_TicketIterator::error_cb_cls, GNUNET_RECLAIM_TicketIterator::finish_cb, GNUNET_RECLAIM_TicketIterator::finish_cb_cls, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_RECLAIM_TicketIterator::h, identity, TicketIterationStartMessage::key_len, GNUNET_ARM_Handle::mq, msg, GNUNET_RECLAIM_TicketIterator::r_id, and GNUNET_RECLAIM_TicketIterator::tr_cb.

Referenced by list_tickets_cont(), and start_process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ticket_iteration_next()

void GNUNET_RECLAIM_ticket_iteration_next ( struct GNUNET_RECLAIM_TicketIterator it)

Calls the ticket processor specified in GNUNET_RECLAIM_ticket_iteration_start for the next record.

Parameters
itthe iterator

Definition at line 1641 of file reclaim_api.c.

1642 {
1643  struct GNUNET_RECLAIM_Handle *h = it->h;
1645  struct GNUNET_MQ_Envelope *env;
1646 
1648  msg->id = htonl (it->r_id);
1649  GNUNET_MQ_send (h->mq, env);
1650 }
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT
Ask for next result of ticket iteration for the given operation.
Definition: reclaim.h:362

References env, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT, GNUNET_MQ_msg, GNUNET_MQ_send(), h, GNUNET_RECLAIM_TicketIterator::h, GNUNET_ARM_Handle::mq, msg, and GNUNET_RECLAIM_TicketIterator::r_id.

Referenced by ticket_collect(), and ticket_iter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ticket_iteration_stop()

void GNUNET_RECLAIM_ticket_iteration_stop ( struct GNUNET_RECLAIM_TicketIterator it)

Stops iteration and releases the handle for further calls.

Must be called on any iteration that has not yet completed prior to calling GNUNET_RECLAIM_disconnect.

Parameters
itthe iterator

Definition at line 1661 of file reclaim_api.c.

1662 {
1663  struct GNUNET_RECLAIM_Handle *h = it->h;
1664  struct GNUNET_MQ_Envelope *env;
1666 
1667  if (NULL != h->mq)
1668  {
1669  env =
1671  msg->id = htonl (it->r_id);
1672  GNUNET_MQ_send (h->mq, env);
1673  }
1674  GNUNET_free (it);
1675 }
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP
Stop ticket iteration for the given operation.
Definition: reclaim.h:379

References env, GNUNET_free, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP, GNUNET_MQ_msg, GNUNET_MQ_send(), h, GNUNET_RECLAIM_TicketIterator::h, GNUNET_ARM_Handle::mq, msg, and GNUNET_RECLAIM_TicketIterator::r_id.

Referenced by cleanup_handle(), and do_cleanup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_disconnect()

void GNUNET_RECLAIM_disconnect ( struct GNUNET_RECLAIM_Handle h)

Disconnect from identity provider service.

Parameters
hidentity provider service to disconnect

Disconnect from identity provider service.

Parameters
hhandle to destroy

Definition at line 1143 of file reclaim_api.c.

1144 {
1145  GNUNET_assert (NULL != h);
1146  if (NULL != h->mq)
1147  {
1148  GNUNET_MQ_destroy (h->mq);
1149  h->mq = NULL;
1150  }
1151  if (NULL != h->reconnect_task)
1152  {
1154  h->reconnect_task = NULL;
1155  }
1156  GNUNET_assert (NULL == h->op_head);
1157  GNUNET_free (h);
1158 }
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:683
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:975
struct GNUNET_SCHEDULER_Task * reconnect_task
ID of the reconnect task (if any).
Definition: arm_api.c:147

References GNUNET_assert, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), h, GNUNET_ARM_Handle::mq, and GNUNET_ARM_Handle::reconnect_task.

Referenced by do_cleanup(), REST_openid_done(), and REST_reclaim_done().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_cancel()

void GNUNET_RECLAIM_cancel ( struct GNUNET_RECLAIM_Operation op)

Cancel an identity provider operation.

Note that the operation MAY still be executed; this merely cancels the continuation; if the request was already transmitted, the service may still choose to complete the operation.

Parameters
opoperation to cancel

Definition at line 1128 of file reclaim_api.c.

1129 {
1130  struct GNUNET_RECLAIM_Handle *h = op->h;
1131 
1132  GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
1133  free_op (op);
1134 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
static void free_op(struct GNUNET_RECLAIM_Operation *op)
Free op.
Definition: reclaim_api.c:488

References free_op(), GNUNET_CONTAINER_DLL_remove, h, GNUNET_ARM_Operation::h, and op.

Referenced by cleanup_handle(), consume_fail(), and do_cleanup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ticket_serialize_get_size()

size_t GNUNET_RECLAIM_ticket_serialize_get_size ( const struct GNUNET_RECLAIM_Ticket tkt)

Get serialized ticket size.

Parameters
tktthe ticket
Returns
the buffer length requirement for a serialization

Definition at line 1740 of file reclaim_api.c.

1742 {
1743  size_t size = sizeof (tkt->rnd);
1746  return size;
1747 }
static unsigned int size
Size of the "table".
Definition: peer.c:68
struct GNUNET_CRYPTO_PublicKey audience
The ticket audience (= relying party)
struct GNUNET_RECLAIM_Identifier rnd
The ticket random identifier.
struct GNUNET_CRYPTO_PublicKey identity
The ticket issuer (= the user)

Referenced by check_ticket_iteration_start(), GNUNET_RECLAIM_ticket_consume(), GNUNET_RECLAIM_ticket_revoke(), issue_ticket(), and send_ticket_result().

Here is the caller graph for this function:

◆ GNUNET_RECLAIM_read_ticket_from_buffer()

enum GNUNET_GenericReturnValue GNUNET_RECLAIM_read_ticket_from_buffer ( const void *  buffer,
size_t  len,
struct GNUNET_RECLAIM_Ticket tkt,
size_t *  tb_read 
)

Deserializes a ticket.

Parameters
bufferthe buffer to read from
lenthe length of the buffer
tktthe ticket to write to (must be allocated)
kb_readhow many bytes were read from buffer
Returns
GNUNET_SYSERR on error

Definition at line 1740 of file reclaim_api.c.

1754 {
1755  const char *tmp = buffer;
1756  size_t read = 0;
1757  size_t left = len;
1758  if (GNUNET_SYSERR ==
1760  left,
1761  &tkt->identity,
1762  &read))
1763  return GNUNET_SYSERR;
1764  left -= read;
1765  tmp += read;
1766  if (GNUNET_SYSERR ==
1768  left,
1769  &tkt->audience,
1770  &read))
1771  return GNUNET_SYSERR;
1772  left -= read;
1773  tmp += read;
1774  if (left < sizeof (tkt->rnd))
1775  return GNUNET_SYSERR;
1776  memcpy (&tkt->rnd, tmp, sizeof (tkt->rnd));
1777  *tb_read = tmp - (char*) buffer + sizeof (tkt->rnd);
1778  return GNUNET_OK;
1779 }
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_read_public_key_from_buffer(const void *buffer, size_t len, struct GNUNET_CRYPTO_PublicKey *key, size_t *read)
Reads a GNUNET_CRYPTO_PublicKey from a compact buffer.
Definition: crypto_pkey.c:103
@ GNUNET_OK
@ GNUNET_SYSERR

References GNUNET_RECLAIM_Ticket::audience, GNUNET_CRYPTO_public_key_get_length(), GNUNET_RECLAIM_Ticket::identity, GNUNET_RECLAIM_Ticket::rnd, and size.

Referenced by collect_tickets_cb(), filter_tickets_cb(), handle_consume_ticket_message(), handle_revoke_ticket_message(), and handle_ticket_result().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_write_ticket_to_buffer()

ssize_t GNUNET_RECLAIM_write_ticket_to_buffer ( const struct GNUNET_RECLAIM_Ticket tkt,
void *  buffer,
size_t  len 
)

Serializes a ticket.

Parameters
tktthe ticket to serialize
bufferthe buffer to serialize to (must be allocated with sufficient size
lenthe length of the buffer
Returns
the number of written bytes or < 0 on error

Definition at line 1783 of file reclaim_api.c.

1787 {
1788  char *tmp = buffer;
1789  size_t left = len;
1790  ssize_t written = 0;
1792  buffer,
1793  left);
1794  if (0 > written)
1795  return written;
1796  left -= written;
1797  tmp += written;
1799  tmp,
1800  left);
1801  if (0 > written)
1802  return written;
1803  left -= written;
1804  tmp += written;
1805  if (left < sizeof (tkt->rnd))
1806  return -1;
1807  memcpy (tmp, &tkt->rnd, sizeof (tkt->rnd));
1808  return tmp - (char*) buffer + sizeof (tkt->rnd);
1809 }

References GNUNET_RECLAIM_Ticket::audience, GNUNET_CRYPTO_write_public_key_to_buffer(), GNUNET_RECLAIM_Ticket::identity, and GNUNET_RECLAIM_Ticket::rnd.

Referenced by check_ticket_iteration_start(), GNUNET_RECLAIM_ticket_consume(), GNUNET_RECLAIM_ticket_revoke(), issue_ticket(), and send_ticket_result().

Here is the call graph for this function:
Here is the caller graph for this function: