GNUnet 0.21.1
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 1113 of file reclaim_api.c.

1114{
1115 struct GNUNET_RECLAIM_Handle *h;
1116
1118 h->cfg = cfg;
1119 reconnect (h);
1120 if (NULL == h->mq)
1121 {
1122 GNUNET_free (h);
1123 return NULL;
1124 }
1125 return h;
1126}
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:1064
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:316

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 1164 of file reclaim_api.c.

1171{
1173 struct AttributeStoreMessage *sam;
1174 size_t attr_len;
1175 size_t key_len;
1176 ssize_t written;
1177 char *buf;
1178
1180 op->h = h;
1181 op->as_cb = cont;
1182 op->cls = cont_cls;
1183 op->r_id = h->r_id_gen++;
1184 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1187 op->env = GNUNET_MQ_msg_extra (sam,
1188 attr_len + key_len,
1190 sam->key_len = htons (key_len);
1191 buf = (char *) &sam[1];
1193 GNUNET_assert (0 < written);
1194 buf += written;
1195 sam->id = htonl (op->r_id);
1197
1199
1200 sam->attr_len = htons (attr_len);
1201 if (NULL != h->mq)
1202 GNUNET_MQ_send_copy (h->mq, op->env);
1203 return op;
1204}
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:40
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 1249 of file reclaim_api.c.

1256{
1258 struct AttributeStoreMessage *sam;
1259 size_t attr_len;
1260 size_t key_len;
1261 ssize_t written;
1262 char *buf;
1263
1265 op->h = h;
1266 op->as_cb = cont;
1267 op->cls = cont_cls;
1268 op->r_id = h->r_id_gen++;
1270 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1272 op->env = GNUNET_MQ_msg_extra (sam,
1273 attr_len + key_len,
1275 sam->key_len = htons (key_len);
1276 buf = (char *) &sam[1];
1278 GNUNET_assert (0 <= written);
1279 buf += written;
1280 sam->id = htonl (op->r_id);
1282
1284
1285 sam->attr_len = htons (attr_len);
1286 if (NULL != h->mq)
1287 GNUNET_MQ_send_copy (h->mq, op->env);
1288 return op;
1289}
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 1208 of file reclaim_api.c.

1214{
1216 struct AttributeDeleteMessage *dam;
1217 size_t attr_len;
1218 size_t key_len;
1219 ssize_t written;
1220 char *buf;
1221
1223 op->h = h;
1224 op->as_cb = cont;
1225 op->cls = cont_cls;
1226 op->r_id = h->r_id_gen++;
1227 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1230 op->env = GNUNET_MQ_msg_extra (dam,
1231 attr_len + key_len,
1233 dam->key_len = htons (key_len);
1234 buf = (char *) &dam[1];
1236 GNUNET_assert (0 < written);
1237 buf += written;
1238 dam->id = htonl (op->r_id);
1240
1241 dam->attr_len = htons (attr_len);
1242 if (NULL != h->mq)
1243 GNUNET_MQ_send_copy (h->mq, op->env);
1244 return op;
1245}
#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 1293 of file reclaim_api.c.

1299{
1301 struct AttributeDeleteMessage *dam;
1302 size_t attr_len;
1303 size_t key_len;
1304 ssize_t written;
1305 char *buf;
1306
1308 op->h = h;
1309 op->as_cb = cont;
1310 op->cls = cont_cls;
1311 op->r_id = h->r_id_gen++;
1313 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1315 op->env = GNUNET_MQ_msg_extra (dam,
1316 attr_len + key_len,
1318 dam->key_len = htons (key_len);
1319 buf = (char *) &dam[1];
1321 GNUNET_assert (0 <= written);
1322 buf += written;
1323 dam->id = htonl (op->r_id);
1325
1326 dam->attr_len = htons (attr_len);
1327 if (NULL != h->mq)
1328 GNUNET_MQ_send_copy (h->mq, op->env);
1329 return op;
1330}
#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 1334 of file reclaim_api.c.

1343{
1345 struct GNUNET_MQ_Envelope *env;
1347 uint32_t rid;
1348 size_t key_len;
1349
1350 rid = h->r_id_gen++;
1352 it->h = h;
1353 it->error_cb = error_cb;
1354 it->error_cb_cls = error_cb_cls;
1355 it->finish_cb = finish_cb;
1356 it->finish_cb_cls = finish_cb_cls;
1357 it->proc = proc;
1358 it->proc_cls = proc_cls;
1359 it->r_id = rid;
1360 it->identity = *identity;
1362 GNUNET_CONTAINER_DLL_insert_tail (h->it_head, h->it_tail, it);
1363 env =
1365 key_len,
1367 msg->id = htonl (rid);
1368 msg->key_len = htons (key_len);
1370 if (NULL == h->mq)
1371 it->env = env;
1372 else
1373 GNUNET_MQ_send (h->mq, env);
1374 return it;
1375}
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:181
struct GNUNET_RECLAIM_Handle * h
Main handle to access the service.
Definition: reclaim_api.c:195
void * error_cb_cls
Closure for error_cb.
Definition: reclaim_api.c:225
GNUNET_RECLAIM_AttributeResult proc
The continuation to call with the results.
Definition: reclaim_api.c:210
struct GNUNET_MQ_Envelope * env
Envelope of the message to send to the service, if not yet sent.
Definition: reclaim_api.c:231
struct GNUNET_CRYPTO_PrivateKey identity
Private key of the zone.
Definition: reclaim_api.c:236
void * proc_cls
Closure for proc.
Definition: reclaim_api.c:215
GNUNET_SCHEDULER_TaskCallback error_cb
Function to call on errors.
Definition: reclaim_api.c:220
GNUNET_SCHEDULER_TaskCallback finish_cb
Function to call on completion.
Definition: reclaim_api.c:200
uint32_t r_id
The operation id this zone iteration operation has.
Definition: reclaim_api.c:241
void * finish_cb_cls
Closure for finish_cb.
Definition: reclaim_api.c:205

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 1379 of file reclaim_api.c.

1380{
1381 struct GNUNET_RECLAIM_Handle *h = it->h;
1383 struct GNUNET_MQ_Envelope *env;
1384
1385 env =
1387 msg->id = htonl (it->r_id);
1388 GNUNET_MQ_send (h->mq, env);
1389}
#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 1393 of file reclaim_api.c.

1394{
1395 struct GNUNET_RECLAIM_Handle *h = it->h;
1396 struct GNUNET_MQ_Envelope *env;
1398
1399 if (NULL != h->mq)
1400 {
1401 env =
1403 msg->id = htonl (it->r_id);
1404 GNUNET_MQ_send (h->mq, env);
1405 }
1406 free_it (it);
1407}
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP
static void free_it(struct GNUNET_RECLAIM_AttributeIterator *it)
Free it.
Definition: reclaim_api.c:453
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 1411 of file reclaim_api.c.

1420{
1422 struct GNUNET_MQ_Envelope *env;
1424 uint32_t rid;
1425 size_t key_len;
1426
1427 rid = h->r_id_gen++;
1429 ait->h = h;
1430 ait->error_cb = error_cb;
1431 ait->error_cb_cls = error_cb_cls;
1432 ait->finish_cb = finish_cb;
1433 ait->finish_cb_cls = finish_cb_cls;
1434 ait->proc = proc;
1435 ait->proc_cls = proc_cls;
1436 ait->r_id = rid;
1437 ait->identity = *identity;
1439 GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait);
1440 env =
1442 key_len,
1444 msg->id = htonl (rid);
1445 msg->key_len = htons (key_len);
1447 if (NULL == h->mq)
1448 ait->env = env;
1449 else
1450 GNUNET_MQ_send (h->mq, env);
1451 return ait;
1452}
#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:248
GNUNET_SCHEDULER_TaskCallback error_cb
Function to call on errors.
Definition: reclaim_api.c:287
GNUNET_SCHEDULER_TaskCallback finish_cb
Function to call on completion.
Definition: reclaim_api.c:267
void * proc_cls
Closure for proc.
Definition: reclaim_api.c:282
GNUNET_RECLAIM_CredentialResult proc
The continuation to call with the results.
Definition: reclaim_api.c:277
void * finish_cb_cls
Closure for finish_cb.
Definition: reclaim_api.c:272
uint32_t r_id
The operation id this zone iteration operation has.
Definition: reclaim_api.c:308
struct GNUNET_MQ_Envelope * env
Envelope of the message to send to the service, if not yet sent.
Definition: reclaim_api.c:298
struct GNUNET_CRYPTO_PrivateKey identity
Private key of the zone.
Definition: reclaim_api.c:303
struct GNUNET_RECLAIM_Handle * h
Main handle to access the service.
Definition: reclaim_api.c:262
void * error_cb_cls
Closure for error_cb.
Definition: reclaim_api.c:292

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 1456 of file reclaim_api.c.

1458{
1459 struct GNUNET_RECLAIM_Handle *h = ait->h;
1461 struct GNUNET_MQ_Envelope *env;
1462
1463 env =
1465 msg->id = htonl (ait->r_id);
1466 GNUNET_MQ_send (h->mq, env);
1467}
#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 1471 of file reclaim_api.c.

1473{
1474 struct GNUNET_RECLAIM_Handle *h = ait->h;
1475 struct GNUNET_MQ_Envelope *env;
1477
1478 if (NULL != h->mq)
1479 {
1480 env =
1483 msg->id = htonl (ait->r_id);
1484 GNUNET_MQ_send (h->mq, env);
1485 }
1486 free_ait (ait);
1487}
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP
static void free_ait(struct GNUNET_RECLAIM_CredentialIterator *ait)
Free it.
Definition: reclaim_api.c:470
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 1491 of file reclaim_api.c.

1498{
1500 struct IssueTicketMessage *tim;
1501 size_t attr_len;
1502 size_t key_len;
1503 size_t rpk_len;
1504 ssize_t written;
1505 char *buf;
1506
1508 op->h = h;
1509 op->ti_cb = cb;
1510 op->cls = cb_cls;
1511 op->r_id = h->r_id_gen++;
1514 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1516 op->env = GNUNET_MQ_msg_extra (tim,
1517 attr_len + key_len + rpk_len,
1519 tim->key_len = htons (key_len);
1520 tim->pkey_len = htons (rpk_len);
1521 buf = (char *) &tim[1];
1523 GNUNET_assert (0 <= written);
1524 buf += written;
1525 written = GNUNET_CRYPTO_write_public_key_to_buffer (rp, buf, rpk_len);
1526 GNUNET_assert (0 <= written);
1527 buf += written;
1528 tim->id = htonl (op->r_id);
1529
1531 tim->attr_len = htons (attr_len);
1532 if (NULL != h->mq)
1533 GNUNET_MQ_send_copy (h->mq, op->env);
1534 return op;
1535}
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 1694 of file reclaim_api.c.

1700{
1702 struct RevokeTicketMessage *msg;
1703 uint32_t rid;
1704 size_t key_len;
1705 size_t tkt_len;
1706 ssize_t written;
1707 char *buf;
1708
1709 rid = h->r_id_gen++;
1711 op->h = h;
1712 op->rvk_cb = cb;
1713 op->cls = cb_cls;
1714 op->r_id = rid;
1715 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1718 op->env = GNUNET_MQ_msg_extra (msg,
1719 key_len + tkt_len,
1721 msg->id = htonl (rid);
1722 msg->key_len = htons (key_len);
1723 msg->tkt_len = htons (tkt_len);
1724 buf = (char*) &msg[1];
1726 buf,
1727 key_len);
1728 GNUNET_assert (0 <= written);
1729 buf += written;
1731 buf,
1732 tkt_len);
1733 if (NULL != h->mq)
1734 {
1735 GNUNET_MQ_send (h->mq, op->env);
1736 op->env = NULL;
1737 }
1738 return op;
1739}
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:1785
size_t GNUNET_RECLAIM_ticket_serialize_get_size(const struct GNUNET_RECLAIM_Ticket *tkt)
Get serialized ticket size.
Definition: reclaim_api.c:1742
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 1551 of file reclaim_api.c.

1557{
1559 struct ConsumeTicketMessage *ctm;
1560 size_t key_len;
1561 size_t tkt_len;
1562 char *buf;
1563
1565 op->h = h;
1566 op->atr_cb = cb;
1567 op->cls = cb_cls;
1568 op->r_id = h->r_id_gen++;
1571 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1572 op->env = GNUNET_MQ_msg_extra (ctm,
1573 key_len + tkt_len,
1575 ctm->key_len = htons (key_len);
1576 buf = (char*) &ctm[1];
1578 buf += key_len;
1579 ctm->tkt_len = htons (tkt_len);
1581 ctm->id = htonl (op->r_id);
1582 if (NULL != h->mq)
1583 GNUNET_MQ_send_copy (h->mq, op->env);
1584 else
1585 reconnect (h);
1586 return op;
1587}
#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 1591 of file reclaim_api.c.

1600{
1602 struct GNUNET_MQ_Envelope *env;
1604 uint32_t rid;
1605 size_t key_len;
1606
1607 rid = h->r_id_gen++;
1609 it->h = h;
1610 it->error_cb = error_cb;
1611 it->error_cb_cls = error_cb_cls;
1612 it->finish_cb = finish_cb;
1613 it->finish_cb_cls = finish_cb_cls;
1614 it->tr_cb = proc;
1615 it->cls = proc_cls;
1616 it->r_id = rid;
1617
1619 GNUNET_CONTAINER_DLL_insert_tail (h->ticket_it_head, h->ticket_it_tail, it);
1621 key_len,
1623 msg->id = htonl (rid);
1624 msg->key_len = htons (key_len);
1626 &msg[1],
1627 key_len);
1628 if (NULL == h->mq)
1629 it->env = env;
1630 else
1631 GNUNET_MQ_send (h->mq, env);
1632 return it;
1633}
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START
Handle for a ticket iterator operation.
Definition: reclaim_api.c:118
GNUNET_RECLAIM_TicketCallback tr_cb
The continuation to call with the results.
Definition: reclaim_api.c:147
uint32_t r_id
The operation id this zone iteration operation has.
Definition: reclaim_api.c:173
void * error_cb_cls
Closure for error_cb.
Definition: reclaim_api.c:162
struct GNUNET_RECLAIM_Handle * h
Main handle to access the idp.
Definition: reclaim_api.c:132
GNUNET_SCHEDULER_TaskCallback finish_cb
Function to call on completion.
Definition: reclaim_api.c:137
void * finish_cb_cls
Closure for finish_cb.
Definition: reclaim_api.c:142
struct GNUNET_MQ_Envelope * env
Envelope of the message to send to the service, if not yet sent.
Definition: reclaim_api.c:168
void * cls
Closure for tr_cb.
Definition: reclaim_api.c:152
GNUNET_SCHEDULER_TaskCallback error_cb
Function to call on errors.
Definition: reclaim_api.c:157
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 1643 of file reclaim_api.c.

1644{
1645 struct GNUNET_RECLAIM_Handle *h = it->h;
1647 struct GNUNET_MQ_Envelope *env;
1648
1650 msg->id = htonl (it->r_id);
1651 GNUNET_MQ_send (h->mq, env);
1652}
#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 1663 of file reclaim_api.c.

1664{
1665 struct GNUNET_RECLAIM_Handle *h = it->h;
1666 struct GNUNET_MQ_Envelope *env;
1668
1669 if (NULL != h->mq)
1670 {
1671 env =
1673 msg->id = htonl (it->r_id);
1674 GNUNET_MQ_send (h->mq, env);
1675 }
1676 GNUNET_free (it);
1677}
#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 1145 of file reclaim_api.c.

1146{
1147 GNUNET_assert (NULL != h);
1148 if (NULL != h->mq)
1149 {
1151 h->mq = NULL;
1152 }
1153 if (NULL != h->reconnect_task)
1154 {
1156 h->reconnect_task = NULL;
1157 }
1158 GNUNET_assert (NULL == h->op_head);
1159 GNUNET_free (h);
1160}
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:981
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 1130 of file reclaim_api.c.

1131{
1132 struct GNUNET_RECLAIM_Handle *h = op->h;
1133
1134 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
1135 free_op (op);
1136}
#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:487

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 1742 of file reclaim_api.c.

1744{
1745 size_t size = sizeof (tkt->rnd);
1748 return size;
1749}
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)

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

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

Here is the call graph for this function:
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 1752 of file reclaim_api.c.

1756{
1757 const char *tmp = buffer;
1758 size_t read = 0;
1759 size_t left = len;
1760 if (GNUNET_SYSERR ==
1762 left,
1763 &tkt->identity,
1764 &read))
1765 return GNUNET_SYSERR;
1766 left -= read;
1767 tmp += read;
1768 if (GNUNET_SYSERR ==
1770 left,
1771 &tkt->audience,
1772 &read))
1773 return GNUNET_SYSERR;
1774 left -= read;
1775 tmp += read;
1776 if (left < sizeof (tkt->rnd))
1777 return GNUNET_SYSERR;
1778 memcpy (&tkt->rnd, tmp, sizeof (tkt->rnd));
1779 *tb_read = tmp - (char*) buffer + sizeof (tkt->rnd);
1780 return GNUNET_OK;
1781}
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_read_public_key_from_buffer(), GNUNET_OK, GNUNET_SYSERR, GNUNET_RECLAIM_Ticket::identity, and GNUNET_RECLAIM_Ticket::rnd.

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 1785 of file reclaim_api.c.

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

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

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

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