9d00be5bce539c358f81a8c8c32a51ae5815c5db
[strongswan.git] / Source / charon / config / traffic_selector.h
1 /**
2 * @file traffic_selector.h
3 *
4 * @brief Interface of traffic_selector_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, 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 _TRAFFIC_SELECTOR_H_
24 #define _TRAFFIC_SELECTOR_H_
25
26 #include <types.h>
27 #include <encoding/payloads/traffic_selector_substructure.h>
28
29
30 typedef struct traffic_selector_t traffic_selector_t;
31
32 /**
33 * @brief
34 *
35 *
36 * @ingroup config
37 */
38 struct traffic_selector_t {
39
40 traffic_selector_t *(*get_subset) (traffic_selector_t *this, traffic_selector_t *other);
41
42 traffic_selector_t *(*clone) (traffic_selector_t *this);
43
44 chunk_t (*get_from_address) (traffic_selector_t *this);
45
46 chunk_t (*get_to_address) (traffic_selector_t *this);
47
48 u_int16_t (*get_from_port) (traffic_selector_t *this);
49
50 u_int16_t (*get_to_port) (traffic_selector_t *this);
51
52 /**
53 * @brief Destroys the config object
54 *
55 *
56 * @param this calling object
57 */
58 void (*destroy) (traffic_selector_t *this);
59 };
60
61 /**
62 * @brief
63 *
64 * @return created traffic_selector_t
65 *
66 * @ingroup config
67 */
68 traffic_selector_t *traffic_selector_create_from_string(u_int8_t protocol, ts_type_t type, char *from_addr, u_int16_t from_port, char *to_addr, u_int16_t to_port);
69
70 traffic_selector_t *traffic_selector_create_from_bytes(u_int8_t protocol, ts_type_t type, chunk_t from_address, int16_t from_port, chunk_t to_address, u_int16_t to_port);
71
72 #endif //_TRAFFIC_SELECTOR_H_
73
74