responder.h revision 9de5878d247b77b8f520a57727cd55f42e179caa
/*
SSSD
SSS Client Responder, header file
Copyright (C) Simo Sorce <ssorce@redhat.com> 2008
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 __SSS_RESPONDER_H__
#define __SSS_RESPONDER_H__
#include "config.h"
#include <stdint.h>
#include <pcre.h>
#include <sys/resource.h>
#include <talloc.h>
#include <tevent.h>
#include <ldb.h>
#include <dhash.h>
#include "sbus/sssd_dbus.h"
#include "sss_client/sss_cli.h"
extern hash_table_t *dp_requests;
/* if there is a provider other than the special local */
#define NEED_CHECK_PROVIDER(provider) \
/* needed until nsssrv.h is updated */
struct cli_request {
/* original request from the wire */
struct sss_packet *in;
/* reply data */
struct sss_packet *out;
};
struct cli_protocol_version {
const char *date;
const char *description;
};
struct resp_ctx;
struct be_conn {
const char *cli_name;
struct sss_domain_info *domain;
char *sbus_address;
struct sbus_interface *intf;
struct sbus_connection *conn;
};
struct resp_ctx {
struct tevent_context *ev;
int lfd;
int priv_lfd;
struct confdb_ctx *cdb;
const char *sock_name;
const char *priv_sock_name;
struct sbus_connection *mon_conn;
struct sss_domain_info *domains;
int domains_timeout;
int client_idle_timeout;
struct sss_cmd_table *sss_cmds;
const char *sss_pipe_name;
const char *confdb_service_path;
struct timeval get_domains_last_call;
char *default_domain;
void *pvt_ctx;
bool shutting_down;
};
struct cli_ctx {
struct tevent_context *ev;
int cfd;
struct sockaddr_un addr;
struct cli_request *creq;
struct cli_protocol_version *cli_protocol_version;
int priv;
int pwent_dom_idx;
int pwent_cur;
int grent_dom_idx;
int grent_cur;
int svc_dom_idx;
int svcent_cur;
char *netgr_name;
int netgrent_cur;
char *automntmap_name;
struct tevent_timer *idle;
};
struct sss_cmd_table {
enum sss_cli_command cmd;
};
/* responder_common.c */
struct tevent_context *ev,
struct confdb_ctx *cdb,
struct sss_cmd_table sss_cmds[],
const char *sss_pipe_name,
const char *sss_priv_pipe_name,
const char *confdb_service_path,
const char *svc_name,
struct sbus_interface *monitor_intf,
const char *cli_name,
struct sbus_interface *dp_intf,
struct resp_ctx **responder_ctx);
struct sss_domain_info *
struct sss_domain_info **_ret_dom);
/* responder_cmd.c */
enum sss_cli_command cmd,
struct sss_cmd_table *sss_cmds);
struct cli_protocol_version *register_cli_protocol_version(void);
struct setent_req_list;
/* A facility for notifying setent requests */
void *pvt,
struct setent_req_list **list,
struct tevent_req *req);
struct dp_callback_ctx {
void *ptr;
void *mem_ctx;
};
struct sbus_connection *conn);
/* Each responder-specific request must create a constructor
* function that creates a DBus Message that would be sent to
* the back end
*/
typedef DBusMessage * (dbus_msg_constructor)(void *);
/*
* This function is indended for consumption by responders to create
* responder-specific requests such as sss_dp_get_account_send for
* downloading account data.
*
* Issues a new back end request based on strkey if not already running
* or registers a callback that is called when an existing request finishes.
*/
struct tevent_req *nreq);
/* Every provider specific request uses this structure as the tevent_req
* "state" structure.
*/
struct sss_dp_req_state {
char *err_msg;
};
/* The _recv functions of provider specific requests usually need to
* only call sss_dp_req_recv() to get return codes from back end
*/
struct tevent_req *sidereq,
char **err_msg);
/* Send a request to the data provider
* Once this function is called, the communication
* with the data provider will always run to
* completion. Freeing the returned tevent_req will
* cancel the notification of completion, but not
* the data provider action.
*/
enum sss_dp_acct_type {
SSS_DP_USER = 1,
};
struct tevent_req *
struct sss_domain_info *dom,
bool fast_reply,
enum sss_dp_acct_type type,
const char *opt_name,
const char *extra);
struct tevent_req *req,
char **err_msg);
#define GET_DOMAINS_DEFAULT_TIMEOUT 60
bool force,
const char *hint);
struct tevent_context *ev,
bool allow_sss_loop,
#endif /* __SSS_RESPONDER_H__ */