diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2008-05-23 15:46:25 +0000 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2008-05-23 15:46:25 +0000 |
commit | c7d81ad12c0c209ab164838fda41e97f7bd0181c (patch) | |
tree | 420b5d45974a7b1fd1bcd32f58269fb5d164cd4a /src/charon/plugins/sql | |
parent | de3d65a1322eae06381fb4e27dbdc216a8f60618 (diff) | |
download | strongswan-c7d81ad12c0c209ab164838fda41e97f7bd0181c.tar.bz2 strongswan-c7d81ad12c0c209ab164838fda41e97f7bd0181c.tar.xz |
added --utc option to ipsec pool
Diffstat (limited to 'src/charon/plugins/sql')
-rw-r--r-- | src/charon/plugins/sql/pool.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/charon/plugins/sql/pool.c b/src/charon/plugins/sql/pool.c index 43a4f33ab..5187fdd1d 100644 --- a/src/charon/plugins/sql/pool.c +++ b/src/charon/plugins/sql/pool.c @@ -46,7 +46,7 @@ static host_t *host_create_from_blob(chunk_t blob) /** * print usage info */ -static void usage() +static void usage(void) { printf("\ Usage:\n\ @@ -55,7 +55,7 @@ Usage:\n\ ipsec pool --status\n\ Show a list of installed pools with statistics.\n\ \n\ - ipsec pool --add <name> --start <start> --end <end> --timeout <timeout>\n\ + ipsec pool --add <name> --start <start> --end <end> [--timeout <timeout>]\n\ Add a new pool to the database.\n\ name: Name of the pool, as used in ipsec.conf rightsourceip=%%name\n\ start: Start address of the pool\n\ @@ -71,10 +71,11 @@ Usage:\n\ name: Name of the pool to resize\n\ end: New end address for the pool\n\ \n\ - ipsec pool --leases <name> --filter <filter>\n\ + ipsec pool --leases <name> [--filter <filter>] [--utc]\n\ Show lease information using filters:\n\ name: Name of the pool to show leases from\n\ filter: Filter string - unimplemented\n\ + utc: Show times in UTC instead of local time\n\ \n\ ipsec pool --purge <name>\n\ Delete expired leases of a pool:\n\ @@ -86,7 +87,7 @@ Usage:\n\ /** * ipsec pool --status - show pool overview */ -static void status() +static void status(void) { enumerator_t *pool, *lease; bool found = FALSE; @@ -219,7 +220,7 @@ static void resize(char *name, host_t *end) /** * ipsec pool --leases - show lease information of a pool */ -static void leases(char *name, char *filter) +static void leases(char *name, char *filter, bool utc) { enumerator_t *query; chunk_t address_chunk, identity_chunk; @@ -252,10 +253,10 @@ static void leases(char *name, char *filter) address = host_create_from_blob(address_chunk); identity = identification_create_from_encoding(identity_type, identity_chunk); - printf("%-8s %15H %-32D %T ", name, address, identity, &acquired); + printf("%-8s %15H %-32D %#T ", name, address, identity, &acquired, utc); if (released) { - printf("%T ", &released); + printf("%#T ", &released, utc); } else { @@ -345,6 +346,7 @@ int main(int argc, char *argv[]) { char *uri, *name = "", *filter = ""; int timeout = 0; + bool utc = FALSE; enum { OP_USAGE, OP_STATUS, @@ -381,7 +383,8 @@ int main(int argc, char *argv[]) struct option long_opts[] = { { "help", no_argument, NULL, 'h' }, - + + { "utc", no_argument, NULL, 'u' }, { "status", no_argument, NULL, 'w' }, { "add", required_argument, NULL, 'a' }, { "del", required_argument, NULL, 'd' }, @@ -403,6 +406,9 @@ int main(int argc, char *argv[]) break; case 'h': break; + case 'u': + utc = TRUE; + break; case 'w': operation = OP_STATUS; break; @@ -491,7 +497,7 @@ int main(int argc, char *argv[]) resize(name, end); break; case OP_LEASES: - leases(name, filter); + leases(name, filter, utc); break; case OP_PURGE: purge(name); |