Don't fail with an error if an attribute that is to be deleted does not exist
[strongswan.git] / src / libhydra / plugins / attr_sql / pool_usage.c
1 /*
2 * Copyright (C) 2008 Martin Willi
3 * Copyright (C) 2009-2010 Andreas Steffen
4 * Hochschule fuer Technik Rapperswil
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 #include <stdio.h>
18
19 /**
20 * print pool usage info
21 */
22 void usage(void)
23 {
24 printf("\
25 Usage:\n\
26 ipsec pool --status|--add|--replace|--del|--resize|--leases|--purge [options]\n\
27 ipsec pool --showattr|--statusattr|--addattr|--delattr [options]\n\
28 \n\
29 ipsec pool --status\n\
30 Show a list of installed pools with statistics plus nameserver info.\n\
31 \n\
32 ipsec pool --statusattr [--hexout]\n\
33 Show a list of all attributes stored in the database with the values\n\
34 converted to the correct format if the type is known by --showattr or\n\
35 in hex format otherwise.\n\
36 hexout: Output all values in hex format\n\
37 \n\
38 ipsec pool --showattr\n\
39 Show a keyword list of the major attribute types.\n\
40 \n\
41 ipsec pool --add <name> --start <start> --end <end> [--timeout <timeout>]\n\
42 ipsec pool --replace <name> --start <start> --end <end> [--timeout <timeout>]\n\
43 Add a new pool to or replace an existing pool in the database.\n\
44 name: Name of the pool, as used in ipsec.conf rightsourceip=%%name\n\
45 start: Start address of the pool\n\
46 end: End address of the pool\n\
47 timeout: Lease time in hours, 0 for static leases\n\
48 \n\
49 ipsec pool --add <name> --addresses <file> [--timeout <timeout>]\n\
50 ipsec pool --replace <name> --addresses <file> [--timeout <timeout>]\n\
51 Add a new pool to or replace an existing pool in the database.\n\
52 name: Name of the pool, as used in ipsec.conf rightsourceip=%%name\n\
53 file: File newline separated addresses for the pool are read from.\n\
54 Optionally each address can be pre-assigned to a roadwarrior\n\
55 identity, e.g. 10.231.14.2=alice@strongswan.org.\n\
56 If a - (hyphen) is given instead of a file name, the addresses\n\
57 are read from STDIN. Reading addresses stops at the end of file\n\
58 or an empty line. Pools created with this command can not be\n\
59 resized.\n\
60 timeout: Lease time in hours, 0 for static leases\n\
61 \n\
62 ipsec pool --addattr <type> --addr|--mask|--server|--subnet|--string|--hex <value>\n\
63 Add a new attribute to the database.\n\
64 type: a keyword from --showattr or a number from the range 1..32767\n\
65 addr: IPv4 or IPv6 address\n\
66 mask: IPv4 or IPv6 netmask (synonym for --addr)\n\
67 server: IPv4 or IPv6 address of a server (synonym for --addr)\n\
68 subnet: IPv4 subnet[s] given by network/mask[,network/mask,...]\n\
69 string: value of a string-type attribute\n\
70 hex: hex value of any attribute\n\
71 \n\
72 ipsec pool --del <name>\n\
73 Delete a pool from the database.\n\
74 name: Name of the pool to delete\n\
75 \n\
76 ipsec pool --delattr <type> [--addr|--mask|--server|--subnet|--string|--hex <value>]\n\
77 Delete a specific or all attributes of a given type from the database.\n\
78 type: a keyword from --showattr or a number from the range 1..32767\n\
79 addr: IPv4 or IPv6 address\n\
80 mask: IPv4 or IPv6 netmask (synonym for --addr)\n\
81 server: IPv4 or IPv6 address of a server (synonym for --addr)\n\
82 subnet: IPv4 subnet[s] given by network/mask[,network/mask,...]\n\
83 string: value of a string-type attribute\n\
84 hex: hex value of any attribute\n\
85 \n\
86 ipsec pool --resize <name> --end <end>\n\
87 Grow or shrink an existing pool.\n\
88 name: Name of the pool to resize\n\
89 end: New end address for the pool\n\
90 \n\
91 ipsec pool --leases [--filter <filter>] [--utc]\n\
92 Show lease information using filters:\n\
93 filter: Filter string containing comma separated key=value filters,\n\
94 e.g. id=alice@strongswan.org,addr=1.1.1.1\n\
95 pool: name of the pool\n\
96 id: assigned identity of the lease\n\
97 addr: lease IP address\n\
98 tstamp: UNIX timestamp when lease was valid, as integer\n\
99 status: status of the lease: online|valid|expired\n\
100 utc: Show times in UTC instead of local time\n\
101 \n\
102 ipsec pool --purge <name>\n\
103 Delete lease history of a pool:\n\
104 name: Name of the pool to purge\n\
105 \n\
106 ipsec pool --batch <file>\n\
107 Read commands from a file and execute them atomically.\n\
108 file: File to read the newline separated commands from. Commands\n\
109 appear as they are written on the command line, e.g.\n\
110 --replace mypool --start 10.0.0.1 --end 10.0.0.254\n\
111 --del dns\n\
112 --add dns --server 10.1.0.1\n\
113 --add dns --server 10.1.1.1\n\
114 If a - (hyphen) is given as a file name, the commands are read\n\
115 from STDIN. Readin commands stops at the end of file. Empty\n\
116 lines are ignored. The file may not contain a --batch command.\n\
117 \n");
118 }
119