]> git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libimcv/plugins/imv_scanner/imv_scanner_state.h
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / libimcv / plugins / imv_scanner / imv_scanner_state.h
1 /*
2 * Copyright (C) 2011-2013 Andreas Steffen
3 *
4 * Copyright (C) secunet Security Networks AG
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 /**
18 * @defgroup imv_scanner imv_scanner
19 * @ingroup libimcv_plugins
20 *
21 * @defgroup imv_scanner_state_t imv_scanner_state
22 * @{ @ingroup imv_scanner
23 */
24
25 #ifndef IMV_SCANNER_STATE_H_
26 #define IMV_SCANNER_STATE_H_
27
28 #include <imv/imv_state.h>
29 #include <ietf/ietf_attr_port_filter.h>
30
31 #include <library.h>
32
33 typedef struct imv_scanner_state_t imv_scanner_state_t;
34 typedef enum imv_scanner_handshake_state_t imv_scanner_handshake_state_t;
35
36 /**
37 * IMV Scanner Handshake States (state machine)
38 */
39 enum imv_scanner_handshake_state_t {
40 IMV_SCANNER_STATE_INIT,
41 IMV_SCANNER_STATE_ATTR_REQ,
42 IMV_SCANNER_STATE_WORKITEMS,
43 IMV_SCANNER_STATE_END
44 };
45
46 /**
47 * Internal state of an imv_scanner_t connection instance
48 */
49 struct imv_scanner_state_t {
50
51 /**
52 * imv_state_t interface
53 */
54 imv_state_t interface;
55
56 /**
57 * Set state of the handshake
58 *
59 * @param new_state the handshake state of IMV
60 */
61 void (*set_handshake_state)(imv_scanner_state_t *this,
62 imv_scanner_handshake_state_t new_state);
63
64 /**
65 * Get state of the handshake
66 *
67 * @return the handshake state of IMV
68 */
69 imv_scanner_handshake_state_t (*get_handshake_state)(imv_scanner_state_t *this);
70
71 /**
72 * Store an IETF Port Filter attribute for later evaluation
73 *
74 * @param attr IETF Port Filter attribute
75 */
76 void (*set_port_filter_attr)(imv_scanner_state_t *this,
77 ietf_attr_port_filter_t *attr);
78
79 /**
80 * Get the stored IETF Port Filter attribute
81 *
82 * @return IETF Port Filter attribute
83 */
84 ietf_attr_port_filter_t* (*get_port_filter_attr)(imv_scanner_state_t *this);
85
86 /**
87 * add a violating TCP or UDP port
88 */
89 void (*add_violating_port)(imv_scanner_state_t *this, char *port);
90 };
91
92 /**
93 * Create an imv_scanner_state_t instance
94 *
95 * @param id connection ID
96 */
97 imv_state_t* imv_scanner_state_create(TNC_ConnectionID id);
98
99 #endif /** IMV_SCANNER_STATE_H_ @}*/