Migrated auth_controller_t to INIT/METHOD macros.
[strongswan.git] / src / manager / manager.h
1 /*
2 * Copyright (C) 2007 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup manager manager
18 *
19 * @defgroup controller controller
20 * @ingroup manager
21 *
22 * @defgroup manager_i manager
23 * @{ @ingroup manager
24 */
25
26 #ifndef MANAGER_H_
27 #define MANAGER_H_
28
29 #include "storage.h"
30 #include "gateway.h"
31
32 #include <context.h>
33
34 typedef struct manager_t manager_t;
35
36 /**
37 * The manager, manages multiple gateways.
38 */
39 struct manager_t {
40
41 /**
42 * implements context_t interface
43 */
44 context_t context;
45
46 /**
47 * Create an enumerator over all configured gateways.
48 *
49 * enumerate() arguments: int id, char *name, int port, char *address
50 * If port is 0, address is a Unix socket address.
51 *
52 * @return enumerator
53 */
54 enumerator_t* (*create_gateway_enumerator)(manager_t *this);
55
56 /**
57 * Select a gateway.
58 *
59 * If id is 0, the previously selected gateway is returned. If none has
60 * been selected yet, NULL is returned.
61 *
62 * @param id id of the gateway (from enumerate), or 0
63 * @return selected gateway, or NULL
64 */
65 gateway_t* (*select_gateway)(manager_t *this, int id);
66
67 /**
68 * Try to log in.
69 *
70 * @param username username
71 * @param password cleartext password
72 * @return TRUE if login successful
73 */
74 bool (*login)(manager_t *this, char *username, char *password);
75
76 /**
77 * Check if user logged in.
78 *
79 * @return TRUE if logged in
80 */
81 bool (*logged_in)(manager_t *this);
82
83 /**
84 * Log out.
85 */
86 void (*logout)(manager_t *this);
87 };
88
89 /**
90 * Create a manager instance.
91 */
92 manager_t *manager_create(storage_t *storage);
93
94 #endif /** MANAGER_H_ @}*/