register received scanner attributes
[strongswan.git] / src / libimcv / plugins / imv_scanner / imv_scanner_state.h
1 /*
2 * Copyright (C) 2011-2013 Andreas Steffen
3 * HSR 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 imv_scanner imv_scanner
18 * @ingroup libimcv_plugins
19 *
20 * @defgroup imv_scanner_state_t imv_scanner_state
21 * @{ @ingroup imv_scanner
22 */
23
24 #ifndef IMV_SCANNER_STATE_H_
25 #define IMV_SCANNER_STATE_H_
26
27 #include <imv/imv_state.h>
28 #include <library.h>
29
30 typedef struct imv_scanner_state_t imv_scanner_state_t;
31 typedef enum imv_scanner_handshake_state_t imv_scanner_handshake_state_t;
32
33 /**
34 * IMV Scanner Handshake States (state machine)
35 */
36 enum imv_scanner_handshake_state_t {
37 IMV_SCANNER_STATE_INIT,
38 IMV_SCANNER_STATE_POLICY_START,
39 IMV_SCANNER_STATE_WORKITEMS
40 };
41
42 /**
43 * Internal state of an imv_scanner_t connection instance
44 */
45 struct imv_scanner_state_t {
46
47 /**
48 * imv_state_t interface
49 */
50 imv_state_t interface;
51
52 /**
53 * Set state of the handshake
54 *
55 * @param new_state the handshake state of IMV
56 */
57 void (*set_handshake_state)(imv_scanner_state_t *this,
58 imv_scanner_handshake_state_t new_state);
59
60 /**
61 * Get state of the handshake
62 *
63 * @return the handshake state of IMV
64 */
65 imv_scanner_handshake_state_t (*get_handshake_state)(imv_scanner_state_t *this);
66
67 /**
68 * Set flags for received attributes
69 *
70 * @param flags Flags to be set
71 */
72 void (*set_received)(imv_scanner_state_t *this, u_int flags);
73
74 /**
75 * Get flags set for received attributes
76 *
77 * @return Flags set for received attributes
78 */
79 u_int (*get_received)(imv_scanner_state_t *this);
80
81 /**
82 * add a violating TCP or UDP port
83 */
84 void (*add_violating_port)(imv_scanner_state_t *this, char *port);
85 };
86
87 /**
88 * Create an imv_scanner_state_t instance
89 *
90 * @param id connection ID
91 */
92 imv_state_t* imv_scanner_state_create(TNC_ConnectionID id);
93
94 #endif /** IMV_SCANNER_STATE_H_ @}*/