Annotation of embedaddon/strongswan/src/libcharon/plugins/load_tester/load_tester_ipsec.c, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2008 Martin Willi
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: #include "load_tester_ipsec.h"
17:
18: #include <time.h>
19:
20: typedef struct private_load_tester_ipsec_t private_load_tester_ipsec_t;
21:
22: /**
23: * Private variables and functions of kernel_pfkey class.
24: */
25: struct private_load_tester_ipsec_t {
26: /**
27: * Public interface.
28: */
29: load_tester_ipsec_t public;
30:
31: /**
32: * faked SPI counter
33: */
34: refcount_t spi;
35: };
36:
37: METHOD(kernel_ipsec_t, get_spi, status_t,
38: private_load_tester_ipsec_t *this, host_t *src, host_t *dst,
39: uint8_t protocol, uint32_t *spi)
40: {
41: *spi = (uint32_t)ref_get(&this->spi);
42: return SUCCESS;
43: }
44:
45: METHOD(kernel_ipsec_t, get_cpi, status_t,
46: private_load_tester_ipsec_t *this, host_t *src, host_t *dst,
47: uint16_t *cpi)
48: {
49: return FAILED;
50: }
51:
52: METHOD(kernel_ipsec_t, add_sa, status_t,
53: private_load_tester_ipsec_t *this, kernel_ipsec_sa_id_t *id,
54: kernel_ipsec_add_sa_t *data)
55: {
56: return SUCCESS;
57: }
58:
59: METHOD(kernel_ipsec_t, update_sa, status_t,
60: private_load_tester_ipsec_t *this, kernel_ipsec_sa_id_t *id,
61: kernel_ipsec_update_sa_t *data)
62: {
63: return SUCCESS;
64: }
65:
66: METHOD(kernel_ipsec_t, query_sa, status_t,
67: private_load_tester_ipsec_t *this, kernel_ipsec_sa_id_t *id,
68: kernel_ipsec_query_sa_t *data, uint64_t *bytes, uint64_t *packets,
69: time_t *time)
70: {
71: return NOT_SUPPORTED;
72: }
73:
74: METHOD(kernel_ipsec_t, del_sa, status_t,
75: private_load_tester_ipsec_t *this, kernel_ipsec_sa_id_t *id,
76: kernel_ipsec_del_sa_t *data)
77: {
78: return SUCCESS;
79: }
80:
81: METHOD(kernel_ipsec_t, add_policy, status_t,
82: private_load_tester_ipsec_t *this, kernel_ipsec_policy_id_t *id,
83: kernel_ipsec_manage_policy_t *data)
84: {
85: return SUCCESS;
86: }
87:
88: METHOD(kernel_ipsec_t, query_policy, status_t,
89: private_load_tester_ipsec_t *this, kernel_ipsec_policy_id_t *id,
90: kernel_ipsec_query_policy_t *data, time_t *use_time)
91: {
92: *use_time = 1;
93: return SUCCESS;
94: }
95:
96: METHOD(kernel_ipsec_t, del_policy, status_t,
97: private_load_tester_ipsec_t *this, kernel_ipsec_policy_id_t *id,
98: kernel_ipsec_manage_policy_t *data)
99: {
100: return SUCCESS;
101: }
102:
103: METHOD(kernel_ipsec_t, destroy, void,
104: private_load_tester_ipsec_t *this)
105: {
106: free(this);
107: }
108:
109: /*
110: * Described in header.
111: */
112: load_tester_ipsec_t *load_tester_ipsec_create()
113: {
114: private_load_tester_ipsec_t *this;
115:
116: INIT(this,
117: .public = {
118: .interface = {
119: .get_spi = _get_spi,
120: .get_cpi = _get_cpi,
121: .add_sa = _add_sa,
122: .update_sa = _update_sa,
123: .query_sa = _query_sa,
124: .del_sa = _del_sa,
125: .flush_sas = (void*)return_failed,
126: .add_policy = _add_policy,
127: .query_policy = _query_policy,
128: .del_policy = _del_policy,
129: .flush_policies = (void*)return_failed,
130: .bypass_socket = (void*)return_true,
131: .enable_udp_decap = (void*)return_true,
132: .destroy = _destroy,
133: },
134: },
135: .spi = 0,
136: );
137:
138: return &this->public;
139: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>