authd: add provider timeout setting API

This commit is contained in:
Elizabeth Myers 2016-04-04 04:24:49 -05:00
parent 1b4dba98a6
commit 2e1e0b9981
2 changed files with 16 additions and 0 deletions

View file

@ -389,3 +389,17 @@ set_provider_data(struct auth_client *auth, uint32_t id, void *data)
auth->data[(size_t)id] = data; auth->data[(size_t)id] = data;
} }
void
set_provider_timeout_relative(struct auth_client *auth, uint32_t id, time_t timeout)
{
lrb_assert(id < rb_dlink_list_length(&auth_providers));
auth->timeout[(size_t)id] = timeout + rb_current_time();
}
void
set_provider_timeout_absolute(struct auth_client *auth, uint32_t id, time_t timeout)
{
lrb_assert(id < rb_dlink_list_length(&auth_providers));
auth->timeout[(size_t)id] = timeout;
}

View file

@ -117,6 +117,8 @@ void handle_cancel_connection(int parc, char *parv[]);
void *get_provider_data(struct auth_client *auth, uint32_t id); void *get_provider_data(struct auth_client *auth, uint32_t id);
void set_provider_data(struct auth_client *auth, uint32_t id, void *data); void set_provider_data(struct auth_client *auth, uint32_t id, void *data);
void set_provider_timeout_relative(struct auth_client *auth, uint32_t id, time_t timeout);
void set_provider_timeout_absolute(struct auth_client *auth, uint32_t id, time_t timeout);
/* Provider is operating on this auth_client (set this if you have async work to do) */ /* Provider is operating on this auth_client (set this if you have async work to do) */
static inline void static inline void