Controls API Structures
The Controls API uses and manipulates two structures called
pr_ctrls_t
and pr_ctrls_cl_t
.
The code definining the structures of these objects is in include/ctrls.h, but is included here for your reading pleasure:
/* Controls handler object */ typedef struct ctrls_obj { struct ctrls_obj *ctrls_next, *ctrls_prev; /* Object ID */ unsigned int ctrls_id; /* Registering module */ module *ctrls_module; /* Requesting client */ pr_ctrls_cl_t *ctrls_cl; /* Control "action" */ const char *ctrls_action; /* Control trigger time; if zero, will trigger immediately */ time_t ctrls_when; /* Temporary pool for control handler use */ pool *ctrls_tmp_pool; /* Control handler callback */ int (*ctrls_cb)(struct ctrls_ob *, int, char **); /* Control handler callback arguments */ array_header *ctrls_cb_args; /* Control handler callback return value; used to determine when to clear this object * from the requested handler list */ int ctrls_cb_retval; /* Control handler callback responses */ array_header *ctrls_cb_resps; /* For possibly passing arbitrary data among control handlers */ void *ctrls_data; /* For internal use only */ volatile unsigned long ctrls_flags; } pr_ctrls_t; /* Controls client object */ typedef struct cl_obj { struct cl_obj *cl_next, *cl_prev; /* Pool for this object's use */ pool *cl_pool; /* Client socket file descriptor */ int cl_fd; /* Credentials of the connecting client */ uid_t cl_uid; const char *cl_user; gid_t cl_gid; const char *cl_group; pid_t cl_pid; /* For internal use only */ volatile unsigned long cl_flags; /* Pointers to all controls matching client request */ array_header *cl_ctrls; } pr_ctrls_cl_t;