2 * Copyright (C) 2007 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
17 * @defgroup gateway gateway
24 #include <networking/host.h>
25 #include <collections/enumerator.h>
27 typedef struct gateway_t gateway_t
;
30 * A connection to a gateway.
35 * Send an XML request to the gateway.
37 * @param xml xml request string
38 * @param ... printf style argument list for xml request string
39 * @return allocated xml response string
41 char* (*request
)(gateway_t
*this, char *xml
, ...);
44 * Query the list of IKE_SAs and all its children.
46 * @return enumerator over ikesa XML elements
48 enumerator_t
* (*query_ikesalist
)(gateway_t
*this);
51 * Query the list of peer configs and its subconfigs.
53 * @return enumerator over peerconfig XML elements
55 enumerator_t
* (*query_configlist
)(gateway_t
*this);
58 * Terminate an IKE or a CHILD SA.
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
64 enumerator_t
* (*terminate
)(gateway_t
*this, bool ike
, u_int32_t id
);
67 * Initiate an IKE or a CHILD SA.
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
73 enumerator_t
* (*initiate
)(gateway_t
*this, bool ike
, char *name
);
76 * Destroy a gateway instance.
78 void (*destroy
)(gateway_t
*this);
82 * Create a gateway instance using a TCP connection.
84 * @param name name of the gateway
85 * @param host gateway connection endpoint
86 * @return gateway connection
88 gateway_t
*gateway_create_tcp(char *name
, host_t
*host
);
91 * Create a gateway instance using a UNIX socket.
93 * @param name name of the gateway
94 * @return gateway connection
96 gateway_t
*gateway_create_unix(char *name
);
98 #endif /** GATEWAY_H_ @}*/