GNUnet  0.18.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_IDENTITY_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_IDENTITY_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_IDENTITY_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_IDENTITY_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_IDENTITY_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_IDENTITY_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_IDENTITY_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_IDENTITY_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_IDENTITY_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_IDENTITY_PrivateKey *iss, const struct GNUNET_IDENTITY_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_IDENTITY_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_IDENTITY_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_IDENTITY_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 51 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 98 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 110 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 124 of file gnunet_reclaim_service.h.

◆ GNUNET_RECLAIM_AttributeResult

typedef void(* GNUNET_RECLAIM_AttributeResult) (void *cls, const struct GNUNET_IDENTITY_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 135 of file gnunet_reclaim_service.h.

◆ GNUNET_RECLAIM_AttributeTicketResult

typedef void(* GNUNET_RECLAIM_AttributeTicketResult) (void *cls, const struct GNUNET_IDENTITY_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 147 of file gnunet_reclaim_service.h.

◆ GNUNET_RECLAIM_CredentialResult

typedef void(* GNUNET_RECLAIM_CredentialResult) (void *cls, const struct GNUNET_IDENTITY_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 161 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 1112 of file reclaim_api.c.

1113 {
1114  struct GNUNET_RECLAIM_Handle *h;
1115 
1116  h = GNUNET_new (struct GNUNET_RECLAIM_Handle);
1117  h->cfg = cfg;
1118  reconnect (h);
1119  if (NULL == h->mq)
1120  {
1121  GNUNET_free (h);
1122  return NULL;
1123  }
1124  return h;
1125 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
#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:1063
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:318

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

Referenced by libgnunet_plugin_rest_openid_connect_init(), libgnunet_plugin_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_IDENTITY_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 1163 of file reclaim_api.c.

1170 {
1171  struct GNUNET_RECLAIM_Operation *op;
1172  struct AttributeStoreMessage *sam;
1173  size_t attr_len;
1174  size_t key_len;
1175  ssize_t written;
1176  char *buf;
1177 
1179  op->h = h;
1180  op->as_cb = cont;
1181  op->cls = cont_cls;
1182  op->r_id = h->r_id_gen++;
1183  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1186  op->env = GNUNET_MQ_msg_extra (sam,
1187  attr_len + key_len,
1189  sam->key_len = htons (key_len);
1190  buf = (char *) &sam[1];
1192  GNUNET_assert (0 < written);
1193  buf += written;
1194  sam->id = htonl (op->r_id);
1196 
1198 
1199  sam->attr_len = htons (attr_len);
1200  if (NULL != h->mq)
1201  GNUNET_MQ_send_copy (h->mq, op->env);
1202  return op;
1203 }
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.
static char buf[2048]
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
ssize_t GNUNET_IDENTITY_write_private_key_to_buffer(const struct GNUNET_IDENTITY_PrivateKey *key, void *buffer, size_t len)
Writes a GNUNET_IDENTITY_PrivateKey to a compact buffer.
Definition: identity_api.c:933
ssize_t GNUNET_IDENTITY_private_key_get_length(const struct GNUNET_IDENTITY_PrivateKey *key)
Get the compacted length of a GNUNET_IDENTITY_PrivateKey.
Definition: identity_api.c:809
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:36
#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:373
#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:56
#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:42
uint64_t rel_value_us
The actual value.

References AttributeStoreMessage::attr_len, buf, AttributeStoreMessage::exp, exp_interval, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_htonll(), GNUNET_IDENTITY_private_key_get_length(), GNUNET_IDENTITY_write_private_key_to_buffer(), 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(), GNUNET_ARM_Operation::h, 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_IDENTITY_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 1248 of file reclaim_api.c.

1255 {
1256  struct GNUNET_RECLAIM_Operation *op;
1257  struct AttributeStoreMessage *sam;
1258  size_t attr_len;
1259  size_t key_len;
1260  ssize_t written;
1261  char *buf;
1262 
1264  op->h = h;
1265  op->as_cb = cont;
1266  op->cls = cont_cls;
1267  op->r_id = h->r_id_gen++;
1269  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1271  op->env = GNUNET_MQ_msg_extra (sam,
1272  attr_len + key_len,
1274  sam->key_len = htons (key_len);
1275  buf = (char *) &sam[1];
1277  GNUNET_assert (0 <= written);
1278  buf += written;
1279  sam->id = htonl (op->r_id);
1281 
1283 
1284  sam->attr_len = htons (attr_len);
1285  if (NULL != h->mq)
1286  GNUNET_MQ_send_copy (h->mq, op->env);
1287  return op;
1288 }
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, buf, credential, AttributeStoreMessage::exp, exp_interval, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_htonll(), GNUNET_IDENTITY_private_key_get_length(), GNUNET_IDENTITY_write_private_key_to_buffer(), 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(), GNUNET_ARM_Operation::h, 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_IDENTITY_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 1207 of file reclaim_api.c.

1213 {
1214  struct GNUNET_RECLAIM_Operation *op;
1215  struct AttributeDeleteMessage *dam;
1216  size_t attr_len;
1217  size_t key_len;
1218  ssize_t written;
1219  char *buf;
1220 
1222  op->h = h;
1223  op->as_cb = cont;
1224  op->cls = cont_cls;
1225  op->r_id = h->r_id_gen++;
1226  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1229  op->env = GNUNET_MQ_msg_extra (dam,
1230  attr_len + key_len,
1232  dam->key_len = htons (key_len);
1233  buf = (char *) &dam[1];
1235  GNUNET_assert (0 < written);
1236  buf += written;
1237  dam->id = htonl (op->r_id);
1239 
1240  dam->attr_len = htons (attr_len);
1241  if (NULL != h->mq)
1242  GNUNET_MQ_send_copy (h->mq, op->env);
1243  return op;
1244 }
#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, buf, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_IDENTITY_private_key_get_length(), GNUNET_IDENTITY_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(), GNUNET_ARM_Operation::h, 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_IDENTITY_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 1292 of file reclaim_api.c.

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

References AttributeDeleteMessage::attr_len, buf, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_IDENTITY_private_key_get_length(), GNUNET_IDENTITY_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(), GNUNET_ARM_Operation::h, 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_IDENTITY_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 1333 of file reclaim_api.c.

1342 {
1344  struct GNUNET_MQ_Envelope *env;
1346  uint32_t rid;
1347  size_t key_len;
1348 
1349  rid = h->r_id_gen++;
1351  it->h = h;
1352  it->error_cb = error_cb;
1353  it->error_cb_cls = error_cb_cls;
1354  it->finish_cb = finish_cb;
1355  it->finish_cb_cls = finish_cb_cls;
1356  it->proc = proc;
1357  it->proc_cls = proc_cls;
1358  it->r_id = rid;
1359  it->identity = *identity;
1361  GNUNET_CONTAINER_DLL_insert_tail (h->it_head, h->it_tail, it);
1362  env =
1364  key_len,
1366  msg->id = htonl (rid);
1367  msg->key_len = htons (key_len);
1369  if (NULL == h->mq)
1370  it->env = env;
1371  else
1372  GNUNET_MQ_send (h->mq, env);
1373  return it;
1374 }
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:303
#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:183
struct GNUNET_RECLAIM_Handle * h
Main handle to access the service.
Definition: reclaim_api.c:197
void * error_cb_cls
Closure for error_cb.
Definition: reclaim_api.c:227
GNUNET_RECLAIM_AttributeResult proc
The continuation to call with the results.
Definition: reclaim_api.c:212
struct GNUNET_IDENTITY_PrivateKey identity
Private key of the zone.
Definition: reclaim_api.c:238
struct GNUNET_MQ_Envelope * env
Envelope of the message to send to the service, if not yet sent.
Definition: reclaim_api.c:233
void * proc_cls
Closure for proc.
Definition: reclaim_api.c:217
GNUNET_SCHEDULER_TaskCallback error_cb
Function to call on errors.
Definition: reclaim_api.c:222
GNUNET_SCHEDULER_TaskCallback finish_cb
Function to call on completion.
Definition: reclaim_api.c:202
uint32_t r_id
The operation id this zone iteration operation has.
Definition: reclaim_api.c:243
void * finish_cb_cls
Closure for finish_cb.
Definition: reclaim_api.c:207

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_IDENTITY_private_key_get_length(), GNUNET_IDENTITY_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 1378 of file reclaim_api.c.

1379 {
1380  struct GNUNET_RECLAIM_Handle *h = it->h;
1382  struct GNUNET_MQ_Envelope *env;
1383 
1384  env =
1386  msg->id = htonl (it->r_id);
1387  GNUNET_MQ_send (h->mq, env);
1388 }
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:71
#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 1392 of file reclaim_api.c.

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

1419 {
1421  struct GNUNET_MQ_Envelope *env;
1423  uint32_t rid;
1424  size_t key_len;
1425 
1426  rid = h->r_id_gen++;
1428  ait->h = h;
1429  ait->error_cb = error_cb;
1430  ait->error_cb_cls = error_cb_cls;
1431  ait->finish_cb = finish_cb;
1432  ait->finish_cb_cls = finish_cb_cls;
1433  ait->proc = proc;
1434  ait->proc_cls = proc_cls;
1435  ait->r_id = rid;
1436  ait->identity = *identity;
1438  GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait);
1439  env =
1441  key_len,
1443  msg->id = htonl (rid);
1444  msg->key_len = htons (key_len);
1446  if (NULL == h->mq)
1447  ait->env = env;
1448  else
1449  GNUNET_MQ_send (h->mq, env);
1450  return ait;
1451 }
#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:250
GNUNET_SCHEDULER_TaskCallback error_cb
Function to call on errors.
Definition: reclaim_api.c:289
GNUNET_SCHEDULER_TaskCallback finish_cb
Function to call on completion.
Definition: reclaim_api.c:269
void * proc_cls
Closure for proc.
Definition: reclaim_api.c:284
GNUNET_RECLAIM_CredentialResult proc
The continuation to call with the results.
Definition: reclaim_api.c:279
void * finish_cb_cls
Closure for finish_cb.
Definition: reclaim_api.c:274
uint32_t r_id
The operation id this zone iteration operation has.
Definition: reclaim_api.c:310
struct GNUNET_IDENTITY_PrivateKey identity
Private key of the zone.
Definition: reclaim_api.c:305
struct GNUNET_MQ_Envelope * env
Envelope of the message to send to the service, if not yet sent.
Definition: reclaim_api.c:300
struct GNUNET_RECLAIM_Handle * h
Main handle to access the service.
Definition: reclaim_api.c:264
void * error_cb_cls
Closure for error_cb.
Definition: reclaim_api.c:294

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_IDENTITY_private_key_get_length(), GNUNET_IDENTITY_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 1455 of file reclaim_api.c.

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

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

1497 {
1498  struct GNUNET_RECLAIM_Operation *op;
1499  struct IssueTicketMessage *tim;
1500  size_t attr_len;
1501  size_t key_len;
1502  size_t rpk_len;
1503  ssize_t written;
1504  char *buf;
1505 
1507  op->h = h;
1508  op->ti_cb = cb;
1509  op->cls = cb_cls;
1510  op->r_id = h->r_id_gen++;
1513  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1515  op->env = GNUNET_MQ_msg_extra (tim,
1516  attr_len + key_len + rpk_len,
1518  tim->key_len = htons (key_len);
1519  tim->pkey_len = htons (rpk_len);
1520  buf = (char *) &tim[1];
1522  GNUNET_assert (0 <= written);
1523  buf += written;
1524  written = GNUNET_IDENTITY_write_public_key_to_buffer (rp, buf, rpk_len);
1525  GNUNET_assert (0 <= written);
1526  buf += written;
1527  tim->id = htonl (op->r_id);
1528 
1530  tim->attr_len = htons (attr_len);
1531  if (NULL != h->mq)
1532  GNUNET_MQ_send_copy (h->mq, op->env);
1533  return op;
1534 }
static char * rp
Relying party.
ssize_t GNUNET_IDENTITY_write_public_key_to_buffer(const struct GNUNET_IDENTITY_PublicKey *key, void *buffer, size_t len)
Writes a GNUNET_IDENTITY_PublicKey to a compact buffer.
Definition: identity_api.c:890
ssize_t GNUNET_IDENTITY_public_key_get_length(const struct GNUNET_IDENTITY_PublicKey *key)
Get the compacted length of a GNUNET_IDENTITY_PublicKey.
Definition: identity_api.c:830
#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, buf, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_IDENTITY_private_key_get_length(), GNUNET_IDENTITY_public_key_get_length(), GNUNET_IDENTITY_write_private_key_to_buffer(), GNUNET_IDENTITY_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(), GNUNET_ARM_Operation::h, 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_IDENTITY_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 1693 of file reclaim_api.c.

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

1556 {
1557  struct GNUNET_RECLAIM_Operation *op;
1558  struct ConsumeTicketMessage *ctm;
1559  size_t key_len;
1560  size_t tkt_len;
1561  char *buf;
1562 
1564  op->h = h;
1565  op->atr_cb = cb;
1566  op->cls = cb_cls;
1567  op->r_id = h->r_id_gen++;
1570  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1571  op->env = GNUNET_MQ_msg_extra (ctm,
1572  key_len + tkt_len,
1574  ctm->key_len = htons (key_len);
1575  buf = (char*) &ctm[1];
1577  buf += key_len;
1578  ctm->tkt_len = htons (tkt_len);
1580  ctm->id = htonl (op->r_id);
1581  if (NULL != h->mq)
1582  GNUNET_MQ_send_copy (h->mq, op->env);
1583  else
1584  reconnect (h);
1585  return op;
1586 }
#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 buf, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_IDENTITY_private_key_get_length(), GNUNET_IDENTITY_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(), GNUNET_ARM_Operation::h, 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_IDENTITY_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 1590 of file reclaim_api.c.

1599 {
1600  struct GNUNET_RECLAIM_TicketIterator *it;
1601  struct GNUNET_MQ_Envelope *env;
1603  uint32_t rid;
1604  size_t key_len;
1605 
1606  rid = h->r_id_gen++;
1608  it->h = h;
1609  it->error_cb = error_cb;
1610  it->error_cb_cls = error_cb_cls;
1611  it->finish_cb = finish_cb;
1612  it->finish_cb_cls = finish_cb_cls;
1613  it->tr_cb = proc;
1614  it->cls = proc_cls;
1615  it->r_id = rid;
1616 
1618  GNUNET_CONTAINER_DLL_insert_tail (h->ticket_it_head, h->ticket_it_tail, it);
1620  key_len,
1622  msg->id = htonl (rid);
1623  msg->key_len = htons (key_len);
1625  &msg[1],
1626  key_len);
1627  if (NULL == h->mq)
1628  it->env = env;
1629  else
1630  GNUNET_MQ_send (h->mq, env);
1631  return it;
1632 }
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START
Handle for a ticket iterator operation.
Definition: reclaim_api.c:120
GNUNET_RECLAIM_TicketCallback tr_cb
The continuation to call with the results.
Definition: reclaim_api.c:149
uint32_t r_id
The operation id this zone iteration operation has.
Definition: reclaim_api.c:175
void * error_cb_cls
Closure for error_cb.
Definition: reclaim_api.c:164
struct GNUNET_RECLAIM_Handle * h
Main handle to access the idp.
Definition: reclaim_api.c:134
GNUNET_SCHEDULER_TaskCallback finish_cb
Function to call on completion.
Definition: reclaim_api.c:139
void * finish_cb_cls
Closure for finish_cb.
Definition: reclaim_api.c:144
struct GNUNET_MQ_Envelope * env
Envelope of the message to send to the service, if not yet sent.
Definition: reclaim_api.c:170
void * cls
Closure for tr_cb.
Definition: reclaim_api.c:154
GNUNET_SCHEDULER_TaskCallback error_cb
Function to call on errors.
Definition: reclaim_api.c:159
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_IDENTITY_private_key_get_length(), GNUNET_IDENTITY_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 1642 of file reclaim_api.c.

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

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

1145 {
1146  GNUNET_assert (NULL != h);
1147  if (NULL != h->mq)
1148  {
1149  GNUNET_MQ_destroy (h->mq);
1150  h->mq = NULL;
1151  }
1152  if (NULL != h->reconnect_task)
1153  {
1155  h->reconnect_task = NULL;
1156  }
1157  GNUNET_assert (NULL == h->op_head);
1158  GNUNET_free (h);
1159 }
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:686
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:943
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(), libgnunet_plugin_rest_openid_connect_done(), and libgnunet_plugin_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 1129 of file reclaim_api.c.

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

References free_op(), GNUNET_CONTAINER_DLL_remove, GNUNET_ARM_Operation::h, 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 1741 of file reclaim_api.c.

1743 {
1744  size_t size = sizeof (tkt->rnd);
1747  return size;
1748 }
static unsigned int size
Size of the "table".
Definition: peer.c:67
struct GNUNET_RECLAIM_Identifier rnd
The ticket random identifier.
struct GNUNET_IDENTITY_PublicKey audience
The ticket audience (= relying party)
struct GNUNET_IDENTITY_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 1741 of file reclaim_api.c.

1755 {
1756  const char *tmp = buffer;
1757  size_t read = 0;
1758  size_t left = len;
1759  if (GNUNET_SYSERR ==
1761  left,
1762  &tkt->identity,
1763  &read))
1764  return GNUNET_SYSERR;
1765  left -= read;
1766  tmp += read;
1767  if (GNUNET_SYSERR ==
1769  left,
1770  &tkt->audience,
1771  &read))
1772  return GNUNET_SYSERR;
1773  left -= read;
1774  tmp += read;
1775  if (left < sizeof (tkt->rnd))
1776  return GNUNET_SYSERR;
1777  memcpy (&tkt->rnd, tmp, sizeof (tkt->rnd));
1778  *tb_read = tmp - (char*) buffer + sizeof (tkt->rnd);
1779  return GNUNET_OK;
1780 }
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_read_public_key_from_buffer(const void *buffer, size_t len, struct GNUNET_IDENTITY_PublicKey *key, size_t *kb_read)
Reads a GNUNET_IDENTITY_PublicKey from a compact buffer.
Definition: identity_api.c:865
@ GNUNET_OK
Definition: gnunet_common.h:99
@ GNUNET_SYSERR
Definition: gnunet_common.h:97

References GNUNET_RECLAIM_Ticket::audience, GNUNET_IDENTITY_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 1784 of file reclaim_api.c.

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

References GNUNET_RECLAIM_Ticket::audience, GNUNET_IDENTITY_write_public_key_to_buffer(), GNUNET_RECLAIM_Ticket::identity, len, 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: