* replaced __thread with pthread_key_t/pthread_setspecific
[strongswan.git] / src / manager / lib / session.h
1 /**
2 * @file session.h
3 *
4 * @brief Interface of session_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2007 Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #ifndef SESSION_H_
24 #define SESSION_H_
25
26 #include "request.h"
27 #include "controller.h"
28
29 typedef struct session_t session_t;
30
31 /**
32 * @brief A session, identified by a session ID.
33 *
34 */
35 struct session_t {
36
37 /**
38 * @brief Get the session ID of the session.
39 *
40 * @return session ID
41 */
42 char* (*get_sid)(session_t *this);
43
44 /**
45 * @brief Add a controller instance to the session.
46 *
47 * @param controller controller to add
48 */
49 void (*add_controller)(session_t *this, controller_t *controller);
50
51 /**
52 * @brief Process a request in this session.
53 *
54 * @param request request to process
55 */
56 void (*process)(session_t *this, request_t *request);
57
58 /**
59 * @brief Destroy the session_t.
60 *
61 * @param this calling object
62 */
63 void (*destroy) (session_t *this);
64 };
65
66 /**
67 * @brief Create a session.
68 *
69 * @param context user defined session context instance
70 */
71 session_t *session_create(context_t *context);
72
73 #endif /* SESSION_H_ */