/*
This file is part of GNUnet.
Copyright (C) 2016 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file identity-provider/identity_provider_api.c
* @brief api to interact with the identity provider service
* @author Martin Schanzenbach
*/
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_constants.h"
#include "gnunet_protocols.h"
#include "gnunet_mq_lib.h"
#include "gnunet_identity_provider_service.h"
#include "gnunet_identity_attribute_lib.h"
#include "identity_provider.h"
#define LOG(kind,...) GNUNET_log_from (kind, "identity-api",__VA_ARGS__)
/**
* Handle for an operation with the service.
*/
struct GNUNET_IDENTITY_PROVIDER_Operation
{
/**
* Main handle.
*/
struct GNUNET_IDENTITY_PROVIDER_Handle *h;
/**
* We keep operations in a DLL.
*/
struct GNUNET_IDENTITY_PROVIDER_Operation *next;
/**
* We keep operations in a DLL.
*/
struct GNUNET_IDENTITY_PROVIDER_Operation *prev;
/**
* Message to send to the service.
* Allocated at the end of this struct.
*/
const struct GNUNET_MessageHeader *msg;
/**
* Continuation to invoke after attribute store call
*/
GNUNET_IDENTITY_PROVIDER_ContinuationWithStatus as_cb;
/**
* Attribute result callback
*/
GNUNET_IDENTITY_PROVIDER_AttributeResult ar_cb;
/**
* Revocation result callback
*/
GNUNET_IDENTITY_PROVIDER_ContinuationWithStatus rvk_cb;
/**
* Ticket result callback
*/
GNUNET_IDENTITY_PROVIDER_TicketCallback tr_cb;
/**
* Envelope with the message for this queue entry.
*/
struct GNUNET_MQ_Envelope *env;
/**
* request id
*/
uint32_t r_id;
/**
* Closure for @e cont or @e cb.
*/
void *cls;
};
/**
* Handle for a ticket iterator operation
*/
struct GNUNET_IDENTITY_PROVIDER_TicketIterator
{
/**
* Kept in a DLL.
*/
struct GNUNET_IDENTITY_PROVIDER_TicketIterator *next;
/**
* Kept in a DLL.
*/
struct GNUNET_IDENTITY_PROVIDER_TicketIterator *prev;
/**
* Main handle to access the idp.
*/
struct GNUNET_IDENTITY_PROVIDER_Handle *h;
/**
* Function to call on completion.
*/
GNUNET_SCHEDULER_TaskCallback finish_cb;
/**
* Closure for @e error_cb.
*/
void *finish_cb_cls;
/**
* The continuation to call with the results
*/
GNUNET_IDENTITY_PROVIDER_TicketCallback tr_cb;
/**
* Closure for @e tr_cb.
*/
void *cls;
/**
* Function to call on errors.
*/
GNUNET_SCHEDULER_TaskCallback error_cb;