charon-cmd: add a connection object and its initiation to charon-cmd
[strongswan.git] / src / charon-cmd / cmd / cmd_connection.h
1 /*
2 * Copyright (C) 2013 Martin Willi
3 * Copyright (C) 2013 revosec AG
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 cmd_connection cmd_connection
18 * @{ @ingroup cmd
19 */
20
21 #ifndef CMD_CONNECTION_H_
22 #define CMD_CONNECTION_H_
23
24 #include <library.h>
25
26 #include "cmd_options.h"
27
28 typedef struct cmd_connection_t cmd_connection_t;
29
30 /**
31 * Connection definition to construct and initiate.
32 */
33 struct cmd_connection_t {
34
35 /**
36 * Handle a command line option.
37 *
38 * @param opt option to handle
39 * @param arg option argument
40 * @return TRUE if option handled
41 */
42 bool (*handle)(cmd_connection_t *this, cmd_option_type_t opt, char *arg);
43
44 /**
45 * Destroy a cmd_connection_t.
46 */
47 void (*destroy)(cmd_connection_t *this);
48 };
49
50 /**
51 * Create a cmd_connection instance.
52 */
53 cmd_connection_t *cmd_connection_create();
54
55 #endif /** CMD_CONNECTION_H_ @}*/