handle zero size Base64 conversions
[strongswan.git] / src / manager / gateway.h
1 /*
2 * Copyright (C) 2007 Martin Willi
3 * 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 <utils/host.h>
25 #include <utils/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 * @return allocated xml response string
39 */
40 char* (*request)(gateway_t *this, char *xml);
41
42 /**
43 * Query the list of IKE_SAs and all its children.
44 *
45 * @return enumerator over ikesa XML elements
46 */
47 enumerator_t* (*query_ikesalist)(gateway_t *this);
48
49 /**
50 * Query the list of peer configs and its subconfigs.
51 *
52 * @return enumerator over peerconfig XML elements
53 */
54 enumerator_t* (*query_configlist)(gateway_t *this);
55
56 /**
57 * Terminate an IKE or a CHILD SA.
58 *
59 * @param ike TRUE for IKE-, FALSE for a CHILD-SA
60 * @param id ID of the SA to terminate
61 * @return enumerator over control response XML children
62 */
63 enumerator_t* (*terminate)(gateway_t *this, bool ike, u_int32_t id);
64
65 /**
66 * Initiate an IKE or a CHILD SA.
67 *
68 * @param ike TRUE for IKE-, FALSE for CHILD-SA
69 * @param name name of the peer/child config
70 * @return enumerator over control response XML children
71 */
72 enumerator_t* (*initiate)(gateway_t *this, bool ike, char *name);
73
74 /**
75 * Destroy a gateway instance.
76 */
77 void (*destroy)(gateway_t *this);
78 };
79
80 /**
81 * Create a gateway instance using a TCP connection.
82 *
83 * @param name name of the gateway
84 * @param host gateway connection endpoint
85 * @return gateway connection
86 */
87 gateway_t *gateway_create_tcp(char *name, host_t *host);
88
89 /**
90 * Create a gateway instance using a UNIX socket.
91 *
92 * @param name name of the gateway
93 * @return gateway connection
94 */
95 gateway_t *gateway_create_unix(char *name);
96
97 #endif /** GATEWAY_H_ @}*/