2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina/*
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina Authors:
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina Pavel Březina <pbrezina@redhat.com>
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina Copyright (C) 2016 Red Hat
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina This program is free software; you can redistribute it and/or modify
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina it under the terms of the GNU General Public License as published by
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina the Free Software Foundation; either version 3 of the License, or
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina (at your option) any later version.
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina This program is distributed in the hope that it will be useful,
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina but WITHOUT ANY WARRANTY; without even the implied warranty of
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina GNU General Public License for more details.
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina You should have received a copy of the GNU General Public License
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina along with this program. If not, see <http://www.gnu.org/licenses/>.
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina*/
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina#ifndef _CACHE_REQ_PRIVATE_H_
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina#define _CACHE_REQ_PRIVATE_H_
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina#include <stdint.h>
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina#include "responder/common/responder.h"
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina#include "responder/common/cache_req/cache_req.h"
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina#define CACHE_REQ_DEBUG(level, cr, fmt, ...) \
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina DEBUG(level, "CR [%s #%u]: " fmt, \
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina (cr)->reqname, (cr)->reqid, ##__VA_ARGS__)
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březinastruct cache_req {
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina /* Provided input. */
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina struct cache_req_data *data;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina struct cache_req_plugin *plugin;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina struct resp_ctx *rctx;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina struct sss_nc_ctx *ncache;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina int midpoint;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina /* Data Provider request type resolved from @type.
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina * FIXME: This is currently needed for data provider calls. We should
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina * refactor responder_dp.c to get rid of this member. */
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina enum sss_dp_acct_type dp_type;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina /* Domain related informations. */
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina struct sss_domain_info *domain;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina /* Debug information */
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina uint32_t reqid;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina const char *reqname;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina const char *debugobj;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina /* Time when the request started. Useful for by-filter lookups */
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina time_t req_start;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina};
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina/* Input data. */
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březinastruct cache_req_data {
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina enum cache_req_type type;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina struct {
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina const char *input; /* Original input. */
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina const char *name; /* Parsed name or UPN. */
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina const char *lookup; /* Converted per domain rules. */
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina } name;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina uint32_t id;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina const char *cert;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina const char *sid;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina const char **attrs;
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina};
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březinastruct tevent_req *
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březinacache_req_search_send(TALLOC_CTX *mem_ctx,
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina struct tevent_context *ev,
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina struct cache_req *cr);
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březinaerrno_t cache_req_search_recv(TALLOC_CTX *mem_ctx,
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina struct tevent_req *req,
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina struct ldb_result **_result);
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březinastruct tevent_req *
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březinacache_req_steal_data_and_send(TALLOC_CTX *mem_ctx,
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina struct tevent_context *ev,
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina struct resp_ctx *rctx,
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina struct sss_nc_ctx *ncache,
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina int cache_refresh_percent,
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina const char *domain,
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina struct cache_req_data *data);
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina
2749964664a69bbb99d09409c1110095cbfcc664Pavel Březina#endif /* _CACHE_REQ_PRIVATE_H_ */