1// AuthenticationServer.h
2
3#ifndef NETFS_AUTHENTICATION_SERVER_H
4#define NETFS_AUTHENTICATION_SERVER_H
5
6#include <Application.h>
7#include <Locker.h>
8
9#include "HashString.h"
10
11class AuthenticationServer : public BApplication {
12public:
13								AuthenticationServer();
14								~AuthenticationServer();
15
16			status_t			Init();
17private:
18	static	int32				_RequestThreadEntry(void* data);
19			int32				_RequestThread();
20
21			bool				_GetAuthentication(const char* context,
22									const char* server, const char* share,
23									HashString* user, HashString* password);
24			status_t			_AddAuthentication(const char* context,
25									const char* server, const char* share,
26									const char* user, const char* password,
27									bool makeDefault);
28			status_t			_SendRequestReply(port_id port, int32 token,
29									status_t error, bool cancelled,
30									const char* user, const char* password);
31
32private:
33			class Authentication;
34			class ServerKey;
35			class ServerEntry;
36			class ServerEntryMap;
37			struct AuthenticationRequest;
38			class UserDialogTask;
39			friend class UserDialogTask;
40
41			BLocker				fLock;
42			port_id				fRequestPort;
43			thread_id			fRequestThread;
44			ServerEntryMap*		fServerEntries;
45			bool				fTerminating;
46};
47
48#endif	// NETFS_AUTHENTICATION_SERVER_H
49