ignore ports of IPv4 and IPv6 loopback interfaces
[strongswan.git] / src / libimcv / plugins / imc_scanner / imc_scanner_state.c
1 /*
2 * Copyright (C) 2011 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 */
14
15 #include "imc_scanner_state.h"
16
17 #include <debug.h>
18
19 typedef struct private_imc_scanner_state_t private_imc_scanner_state_t;
20
21 /**
22 * Private data of an imc_scanner_state_t object.
23 */
24 struct private_imc_scanner_state_t {
25
26 /**
27 * Public members of imc_scanner_state_t
28 */
29 imc_scanner_state_t public;
30
31 /**
32 * TNCCS connection ID
33 */
34 TNC_ConnectionID connection_id;
35
36 /**
37 * TNCCS connection state
38 */
39 TNC_ConnectionState state;
40 };
41
42 METHOD(imc_state_t, get_connection_id, TNC_ConnectionID,
43 private_imc_scanner_state_t *this)
44 {
45 return this->connection_id;
46 }
47
48 METHOD(imc_state_t, change_state, void,
49 private_imc_scanner_state_t *this, TNC_ConnectionState new_state)
50 {
51 this->state = new_state;
52 }
53
54 METHOD(imc_state_t, destroy, void,
55 private_imc_scanner_state_t *this)
56 {
57 free(this);
58 }
59
60 /**
61 * Described in header.
62 */
63 imc_state_t *imc_scanner_state_create(TNC_ConnectionID connection_id)
64 {
65 private_imc_scanner_state_t *this;
66
67 INIT(this,
68 .public = {
69 .interface = {
70 .get_connection_id = _get_connection_id,
71 .change_state = _change_state,
72 .destroy = _destroy,
73 },
74 },
75 .state = TNC_CONNECTION_STATE_CREATE,
76 .connection_id = connection_id,
77 );
78
79 return &this->public.interface;
80 }
81
82