travis: Enable caching for sonarcloud scan
[strongswan.git] / src / manager / gateway.h
1 /*
2 * Copyright (C) 2007 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 /**
17 * @defgroup gateway gateway
18 * @{ @ingroup manager
19 */
20
21 #ifndef GATEWAY_H_
22 #define GATEWAY_H_
23
24 #include <networking/host.h>
25 #include <collections/enumerator.h>
26
27 typedef struct gateway_t gateway_t;
28
29 /**
30 * A connection to a gateway.
31 */
32 struct gateway_t {
33
34 /**
35 * Send an XML request to the gateway.
36 *
37 * @param xml xml request string
38 * @param ... printf style argument list for xml request string
39 * @return allocated xml response string
40 */
41 char* (*request)(gateway_t *this, char *xml, ...);
42
43 /**
44 * Query the list of IKE_SAs and all its children.
45 *
46 * @return enumerator over ikesa XML elements
47 */
48 enumerator_t* (*query_ikesalist)(gateway_t *this);
49
50 /**
51 * Query the list of peer configs and its subconfigs.
52 *
53 * @return enumerator over peerconfig XML elements
54 */
55 enumerator_t* (*query_configlist)(gateway_t *this);
56
57 /**
58 * Terminate an IKE or a CHILD SA.
59 *
60 * @param ike TRUE for IKE-, FALSE for a CHILD-SA
61 * @param id ID of the SA to terminate
62 * @return enumerator over control response XML children
63 */
64 enumerator_t* (*terminate)(gateway_t *this, bool ike, uint32_t id);
65
66 /**
67 * Initiate an IKE or a CHILD SA.
68 *
69 * @param ike TRUE for IKE-, FALSE for CHILD-SA
70 * @param name name of the peer/child config
71 * @return enumerator over control response XML children
72 */
73 enumerator_t* (*initiate)(gateway_t *this, bool ike, char *name);
74
75 /**
76 * Destroy a gateway instance.
77 */
78 void (*destroy)(gateway_t *this);
79 };
80
81 /**
82 * Create a gateway instance using a TCP connection.
83 *
84 * @param name name of the gateway
85 * @param host gateway connection endpoint
86 * @return gateway connection
87 */
88 gateway_t *gateway_create_tcp(char *name, host_t *host);
89
90 /**
91 * Create a gateway instance using a UNIX socket.
92 *
93 * @param name name of the gateway
94 * @return gateway connection
95 */
96 gateway_t *gateway_create_unix(char *name);
97
98 #endif /** GATEWAY_H_ @}*/