auth-client.h revision 9c3577aeb78a27920439ad9f1e62ee03699378c3
5d4c793b4e3dbc07f08daa4465594b1857f80725Timo Sirainentypedef void auth_request_callback_t(struct auth_request *request, int status,
5d4c793b4e3dbc07f08daa4465594b1857f80725Timo Sirainentypedef void auth_connect_notify_callback_t(struct auth_client *client,
5d4c793b4e3dbc07f08daa4465594b1857f80725Timo Sirainen/* Create new authentication client. */
5d4c793b4e3dbc07f08daa4465594b1857f80725Timo Sirainenstruct auth_client *auth_client_new(unsigned int client_pid);
5d4c793b4e3dbc07f08daa4465594b1857f80725Timo Sirainenvoid auth_client_free(struct auth_client **client);
5d4c793b4e3dbc07f08daa4465594b1857f80725Timo Sirainen/* Destroy all connections and reconnect. */
5d4c793b4e3dbc07f08daa4465594b1857f80725Timo Sirainenvoid auth_client_reconnect(struct auth_client *client);
5d4c793b4e3dbc07f08daa4465594b1857f80725Timo Sirainenbool auth_client_is_connected(struct auth_client *client);
5d4c793b4e3dbc07f08daa4465594b1857f80725Timo Sirainenvoid auth_client_set_connect_notify(struct auth_client *client,
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainenauth_client_get_available_mechs(struct auth_client *client,
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainen unsigned int *mech_count);
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainenauth_client_find_mech(struct auth_client *client, const char *name);
e9ac518aaf49a06d976bf7f24ab14a3e2d6d86abTimo Sirainen/* Reserve connection for specific mechanism. The id can be given to
71056e0f5e1f68cb9ac002a7827eb98435c40d62Timo Sirainen auth_client_request_new() to force it to use the same connection, or fail.
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainen This is currently useful only for APOP authentication. Returns TRUE if
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainen successfull. */
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainenbool auth_client_reserve_connection(struct auth_client *client,
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainen/* Create a new authentication request. callback is called whenever something
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainen happens for the request. id can be NULL. */
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainenauth_client_request_new(struct auth_client *client, struct auth_connect_id *id,
78fa3c578c14ee8a612f86cf73b6181c7f16463fTimo Sirainen auth_request_callback_t *callback, void *context,
6c2ce1d5bf17b21e804a079eb0f973b7ab83e0d8Timo Sirainen const char **error_r);
6c2ce1d5bf17b21e804a079eb0f973b7ab83e0d8Timo Sirainen/* Continue authentication. Call when
e9ac518aaf49a06d976bf7f24ab14a3e2d6d86abTimo Sirainen reply->result == AUTH_CLIENT_REQUEST_CONTINUE */
e9ac518aaf49a06d976bf7f24ab14a3e2d6d86abTimo Sirainenvoid auth_client_request_continue(struct auth_request *request,
6c2ce1d5bf17b21e804a079eb0f973b7ab83e0d8Timo Sirainen/* Abort ongoing authentication request. */
6c2ce1d5bf17b21e804a079eb0f973b7ab83e0d8Timo Sirainenvoid auth_client_request_abort(struct auth_request *request);
230ef558135f16a66b86cbe3762524eaa9ae9d81Timo Sirainen/* Return ID of this request. */
6c2ce1d5bf17b21e804a079eb0f973b7ab83e0d8Timo Sirainenunsigned int auth_client_request_get_id(struct auth_request *request);
e9ac518aaf49a06d976bf7f24ab14a3e2d6d86abTimo Sirainen/* Return the PID of the server that handled this request. */
e9ac518aaf49a06d976bf7f24ab14a3e2d6d86abTimo Sirainenunsigned int auth_client_request_get_server_pid(struct auth_request *request);