2 * Copyright (C) 2014 Martin Willi
3 * Copyright (C) 2014 revosec AG
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
20 static int version(vici_conn_t
*conn
)
29 switch (command_getopt(&arg
))
32 return command_usage(NULL
);
39 return command_usage("invalid --terminate option");
44 req
= vici_begin("version");
45 res
= vici_submit(req
, conn
);
48 fprintf(stderr
, "version request failed: %s\n", strerror(errno
));
53 vici_dump(res
, "version reply", stdout
);
57 printf("strongSwan %s %s (%s, %s, %s)\n",
58 vici_find_str(res
, "", "version"),
59 vici_find_str(res
, "", "daemon"),
60 vici_find_str(res
, "", "sysname"),
61 vici_find_str(res
, "", "release"),
62 vici_find_str(res
, "", "machine"));
69 * Register the command.
71 static void __attribute__ ((constructor
))reg()
73 command_register((command_t
) {
74 version
, 'v', "version", "show daemon version information",
77 {"help", 'h', 0, "show usage information"},
78 {"raw", 'r', 0, "dump raw response message"},