removing svn keyword $Id$ from all files
[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 #include <utils/iterator.h>
35
36 typedef struct manager_t manager_t;
37
38 /**
39 * The manager, manages multiple gateways.
40 */
41 struct manager_t {
42
43 /**
44 * implements context_t interface
45 */
46 context_t context;
47
48 /**
49 * Create an iterator over all configured gateways.
50 *
51 * enumerate() arguments: int id, char *name, int port, char *address
52 * If port is 0, address is a Unix socket address.
53 *
54 * @return enumerator
55 */
56 enumerator_t* (*create_gateway_enumerator)(manager_t *this);
57
58 /**
59 * Select a gateway.
60 *
61 * If id is 0, the previously selected gateway is returned. If none has
62 * been selected yet, NULL is returned.
63 *
64 * @param id id of the gateway (from enumerate), or 0
65 * @return selected gateway, or NULL
66 */
67 gateway_t* (*select_gateway)(manager_t *this, int id);
68
69 /**
70 * Try to log in.
71 *
72 * @param username username
73 * @param password cleartext password
74 * @return TRUE if login successful
75 */
76 bool (*login)(manager_t *this, char *username, char *password);
77
78 /**
79 * Check if user logged in.
80 *
81 * @return TRUE if logged in
82 */
83 bool (*logged_in)(manager_t *this);
84
85 /**
86 * Log out.
87 */
88 void (*logout)(manager_t *this);
89 };
90
91 /**
92 * Create a manager instance.
93 */
94 manager_t *manager_create(storage_t *storage);
95
96 #endif /** MANAGER_H_ @}*/