c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen#ifndef AUTH_CLIENT_CONNECTION_H
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen#define AUTH_CLIENT_CONNECTION_H
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen#include "master-auth.h"
419baa2c17c63ae516b2df6cc5695f15aaccbff8Timo Sirainen
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainenstruct auth_client_connection {
29d4c6eac14a0b3d79656eb6b206a102fd09d24aTimo Sirainen struct auth_client_connection *prev, *next;
97c339398f1aba6f315b55a9b6ee6b020e33bea4Timo Sirainen struct auth *auth;
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen int refcount;
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen int fd;
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen struct io *io;
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen struct istream *input;
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen struct ostream *output;
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen
bf5315c55718a62516e331e2696354976b4211e9Stephan Bosch unsigned int version_minor;
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen unsigned int pid;
8eea67470c1bd8562a62e7445d930bb2079b1a43Timo Sirainen unsigned int connect_uid;
419baa2c17c63ae516b2df6cc5695f15aaccbff8Timo Sirainen uint8_t cookie[MASTER_AUTH_COOKIE_SIZE];
657afb33796f8216c568ad813627da89970760beTimo Sirainen struct auth_request_handler *request_handler;
2fc7292a8c0f11e71b001c60797f5791f3b3cd7cTimo Sirainen
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool login_requests:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool version_received:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool token_auth:1;
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen};
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen
e2a88d59c0d47d63ce1ad5b1fd95e487124a3fd4Timo Sirainenvoid auth_client_connection_create(struct auth *auth, int fd,
ab90f702ceedb7ba445a9a592be0b213b27cbafaStephan Bosch bool login_requests, bool token_auth);
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainenvoid auth_client_connection_destroy(struct auth_client_connection **conn);
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainenstruct auth_client_connection *
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainenauth_client_connection_lookup(unsigned int pid);
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen
29d4c6eac14a0b3d79656eb6b206a102fd09d24aTimo Sirainenvoid auth_client_connections_destroy_all(void);
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen#endif