2 * Copyright (C) 2008 Martin Willi
3 * Hochschule fuer Technik Rapperswil
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>.
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
16 #include "load_tester_ipsec.h"
20 typedef struct private_load_tester_ipsec_t private_load_tester_ipsec_t
;
23 * Private variables and functions of kernel_pfkey class.
25 struct private_load_tester_ipsec_t
{
29 load_tester_ipsec_t
public;
37 METHOD(kernel_ipsec_t
, get_spi
, status_t
,
38 private_load_tester_ipsec_t
*this, host_t
*src
, host_t
*dst
,
39 u_int8_t protocol
, u_int32_t reqid
, u_int32_t
*spi
)
45 METHOD(kernel_ipsec_t
, get_cpi
, status_t
,
46 private_load_tester_ipsec_t
*this, host_t
*src
, host_t
*dst
,
47 u_int32_t reqid
, u_int16_t
*cpi
)
52 METHOD(kernel_ipsec_t
, add_sa
, status_t
,
53 private_load_tester_ipsec_t
*this, host_t
*src
, host_t
*dst
,
54 u_int32_t spi
, u_int8_t protocol
, u_int32_t reqid
, mark_t mark
,
55 lifetime_cfg_t
*lifetime
, u_int16_t enc_alg
, chunk_t enc_key
,
56 u_int16_t int_alg
, chunk_t int_key
, ipsec_mode_t mode
, u_int16_t ipcomp
,
57 u_int16_t cpi
, bool encap
, bool inbound
, traffic_selector_t
*src_ts
,
58 traffic_selector_t
*dst_ts
)
63 METHOD(kernel_ipsec_t
, update_sa
, status_t
,
64 private_load_tester_ipsec_t
*this, u_int32_t spi
, u_int8_t protocol
,
65 u_int16_t cpi
, host_t
*src
, host_t
*dst
, host_t
*new_src
,
66 host_t
*new_dst
, bool encap
, bool new_encap
, mark_t mark
)
71 METHOD(kernel_ipsec_t
, query_sa
, status_t
,
72 private_load_tester_ipsec_t
*this, host_t
*src
, host_t
*dst
,
73 u_int32_t spi
, u_int8_t protocol
, mark_t mark
, u_int64_t
*bytes
)
78 METHOD(kernel_ipsec_t
, del_sa
, status_t
,
79 private_load_tester_ipsec_t
*this, host_t
*src
, host_t
*dst
,
80 u_int32_t spi
, u_int8_t protocol
, u_int16_t cpi
, mark_t mark
)
85 METHOD(kernel_ipsec_t
, add_policy
, status_t
,
86 private_load_tester_ipsec_t
*this, host_t
*src
, host_t
*dst
,
87 traffic_selector_t
*src_ts
, traffic_selector_t
*dst_ts
,
88 policy_dir_t direction
, u_int32_t spi
, u_int32_t ah_spi
,
89 u_int32_t reqid
, mark_t mark
, ipsec_mode_t mode
, u_int16_t ipcomp
,
90 u_int16_t cpi
, bool routed
)
95 METHOD(kernel_ipsec_t
, query_policy
, status_t
,
96 private_load_tester_ipsec_t
*this, traffic_selector_t
*src_ts
,
97 traffic_selector_t
*dst_ts
, policy_dir_t direction
, mark_t mark
,
100 *use_time
= time_monotonic(NULL
);
104 METHOD(kernel_ipsec_t
, del_policy
, status_t
,
105 private_load_tester_ipsec_t
*this, traffic_selector_t
*src_ts
,
106 traffic_selector_t
*dst_ts
, policy_dir_t direction
, mark_t mark
,
112 METHOD(kernel_ipsec_t
, bypass_socket
, bool,
113 private_load_tester_ipsec_t
*this, int fd
, int family
)
118 METHOD(kernel_ipsec_t
, destroy
, void,
119 private_load_tester_ipsec_t
*this)
125 * Described in header.
127 load_tester_ipsec_t
*load_tester_ipsec_create()
129 private_load_tester_ipsec_t
*this;
137 .update_sa
= _update_sa
,
138 .query_sa
= _query_sa
,
140 .add_policy
= _add_policy
,
141 .query_policy
= _query_policy
,
142 .del_policy
= _del_policy
,
143 .bypass_socket
= _bypass_socket
,
150 return &this->public;