d383b19a2905a568ab7f0a9cf856298e939d5a95
[strongswan.git] / src / libimcv / ietf / ietf_attr_port_filter.h
1 /*
2 * Copyright (C) 2011-2014 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 ietf_attr_port_filtert ietf_attr_port_filter
18 * @{ @ingroup ietf_attr
19 */
20
21 #ifndef IETF_ATTR_PORT_FILTER_H_
22 #define IETF_ATTR_PORT_FILTER_H_
23
24 typedef struct ietf_attr_port_filter_t ietf_attr_port_filter_t;
25
26 #include "ietf_attr.h"
27 #include "pa_tnc/pa_tnc_attr.h"
28
29
30 /**
31 * Class implementing the IETF PA-TNC Port Filter attribute.
32 *
33 */
34 struct ietf_attr_port_filter_t {
35
36 /**
37 * Public PA-TNC attribute interface
38 */
39 pa_tnc_attr_t pa_tnc_attribute;
40
41 /**
42 * Add a port entry
43 *
44 * @param blocked TRUE if blocked, FALSE if allowed
45 * @param protocol IP protocol type
46 * @param port TCP/UDP port number
47 */
48 void (*add_port)(ietf_attr_port_filter_t *this, bool blocked,
49 u_int8_t protocol, u_int16_t port);
50
51 /**
52 * Enumerates over all ports
53 * Format: bool *blocked, u_int8_t *protocol, u_int16_t *port
54 *
55 * @return enumerator
56 */
57 enumerator_t* (*create_port_enumerator)(ietf_attr_port_filter_t *this);
58
59 };
60
61 /**
62 * Creates an ietf_attr_port_filter_t object
63 *
64 */
65 pa_tnc_attr_t* ietf_attr_port_filter_create(void);
66
67 /**
68 * Creates an ietf_attr_port_filter_t object from received data
69 *
70 * @param length Total length of attribute value
71 * @param value Unparsed attribute value (might be a segment)
72 */
73 pa_tnc_attr_t* ietf_attr_port_filter_create_from_data(size_t length,
74 chunk_t value);
75
76 #endif /** IETF_ATTR_PORT_FILTER_H_ @}*/