root/trunk/src/manager/manager.h

Revision 3589, 2.1 kB (checked in by martin, 10 months ago)

merged the modularization branch (credentials) back to trunk

  • Property svn:keywords set to Id
Line 
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  * $Id$
16  */
17
18 /**
19  * @defgroup manager manager
20  *
21  * @defgroup controller controller
22  * @ingroup manager
23  *
24  * @defgroup manager_i manager
25  * @{ @ingroup manager
26  */
27
28 #ifndef MANAGER_H_
29 #define MANAGER_H_
30
31 #include "storage.h"
32 #include "gateway.h"
33
34 #include <context.h>
35
36 #include <utils/iterator.h>
37
38 typedef struct manager_t manager_t;
39
40 /**
41  * The manager, manages multiple gateways.
42  */
43 struct manager_t {
44
45     /**
46      * implements context_t interface
47      */
48     context_t context;
49    
50     /**
51      * Create an iterator over all configured gateways.
52      *
53      * enumerate() arguments: int id, char *name, int port, char *address
54      * If port is 0, address is a Unix socket address.
55      *
56      * @return          enumerator
57      */
58     enumerator_t* (*create_gateway_enumerator)(manager_t *this);
59    
60     /**
61      * Select a gateway.
62      *
63      * If id is 0, the previously selected gateway is returned. If none has
64      * been selected yet, NULL is returned.
65      *
66      * @param id        id of the gateway (from enumerate), or 0
67      * @return          selected gateway, or NULL
68      */
69     gateway_t* (*select_gateway)(manager_t *this, int id);
70    
71     /**
72      * Try to log in.
73      *
74      * @param username  username
75      * @param password  cleartext password
76      * @return          TRUE if login successful
77      */
78     bool (*login)(manager_t *this, char *username, char *password);
79    
80     /**
81      * Check if user logged in.
82      *
83      * @return          TRUE if logged in
84      */
85     bool (*logged_in)(manager_t *this);
86    
87     /**
88      * Log out.
89      */
90     void (*logout)(manager_t *this);
91 };
92
93 /**
94  * Create a manager instance.
95  */
96 manager_t *manager_create(storage_t *storage);
97
98 #endif /* MANAGER_H_ @} */
Note: See TracBrowser for help on using the browser.