/*
Authors:
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2016 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _DP_PRIVATE_H_
#define _DP_PRIVATE_H_
#include <tevent.h>
#include <dhash.h>
#include "sbus/sssd_dbus.h"
#include "providers/data_provider/dp.h"
enum dp_clients {
};
struct dp_req;
struct dp_client;
struct dp_module {
bool initialized;
const char *name;
void *module_data;
void *libhandle;
};
struct dp_target {
const char *name;
const char *module_name;
bool explicitly_configured;
bool initialized;
};
struct dp_method {
void *method_data;
const char *method_dtype;
const char *request_dtype;
const char *output_dtype;
};
struct data_provider {
bool terminating;
struct {
/* Numeric identificator that will be assigned to next request. */
/* List of all ongoing requests. */
/* Table containing list of sbus_requests where DP sends reply when
* a request is finished. Value of this table is pair
* <tevent_req, list of sbus_request>
*/
} requests;
};
enum dp_targets target,
enum dp_methods method,
struct data_provider *provider,
const char *name);
struct data_provider *provider,
/* Reply callbacks. */
struct data_provider *provider,
void *post_data,
void *reply_data);
struct sbus_request *sbus_req,
void *data);
void dp_req_reply_default(const char *req_name,
struct sbus_request *sbus_req,
void **data);
/* Data provider request table. */
struct dp_sbus_req_item;
struct dp_table_value {
const char *key;
};
struct dp_sbus_req_item {
};
enum dp_targets target,
enum dp_methods method,
const char *custom_part);
const char *key);
const char *key,
struct tevent_req *req,
struct sbus_request *sbus_req);
const char *key);
const char *key);
const char *key);
/* Data provider request. */
const char *req_name,
const char *domain,
const char *request_name,
const char *custom_key,
struct sbus_request *sbus_req,
enum dp_targets target,
enum dp_methods method,
void *request_data,
void *postprocess_data,
const char *output_dtype);
/**
* If @domain is NULL, be_ctx->domain is used.
* If req_key is NULL, address of sbus_req is used.
*
* If @pp_fn (post process function) is set it is call on a successful
* DP request before reply is sent.
*/
do { \
/* Check postprocess function parameter types. */ \
void (*__pp_fn)(const char *, struct data_provider *, \
\
/* Check reply function parameter types. */ \
void (*__reply_fn)(const char *, struct sbus_request *, \
output_dtype *) = (reply_fn); \
\
} while(0)
output_dtype) \
/* Client shared functions. */
#endif /* _DP_PRIVATE_H_ */