pool: Move the pool utility to its own directory in src
[strongswan.git] / src / pool / 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> [--pool <name> [--identity <id>]]\n\
63 --addr|--mask|--server|--subnet|--string|--hex <value>\n\
64 Add a new attribute to the database. Attributes can be bundled by using\n\
65 the --pool and --identity options. If a bundle matches a peer the contained\n\
66 attributes are sent to that peer instead of the global ones.\n\
67 type: a keyword from --showattr or a number from the range 1..32767\n\
68 name: the name of the pool this attribute is added to\n\
69 id: identity of the peer this attribute is bound to\n\
70 addr: IPv4 or IPv6 address\n\
71 mask: IPv4 or IPv6 netmask (synonym for --addr)\n\
72 server: IPv4 or IPv6 address of a server (synonym for --addr)\n\
73 subnet: IPv4 subnet[s] given by network/mask[,network/mask,...]\n\
74 string: value of a string-type attribute\n\
75 hex: hex value of any attribute\n\
76 \n\
77 ipsec pool --del <name>\n\
78 Delete a pool from the database.\n\
79 name: Name of the pool to delete\n\
80 \n\
81 ipsec pool --delattr <type> [--pool <name> [--identity <id>]]\n\
82 [--addr|--mask|--server|--subnet|--string|--hex <value>]\n\
83 Delete a specific or all attributes of a given type from the database.\n\
84 type: a keyword from --showattr or a number from the range 1..32767\n\
85 name: the name of the pool this attribute is added to\n\
86 id: identity of the peer this attribute is bound to\n\
87 addr: IPv4 or IPv6 address\n\
88 mask: IPv4 or IPv6 netmask (synonym for --addr)\n\
89 server: IPv4 or IPv6 address of a server (synonym for --addr)\n\
90 subnet: IPv4 subnet[s] given by network/mask[,network/mask,...]\n\
91 string: value of a string-type attribute\n\
92 hex: hex value of any attribute\n\
93 \n\
94 ipsec pool --resize <name> --end <end>\n\
95 Grow or shrink an existing pool.\n\
96 name: Name of the pool to resize\n\
97 end: New end address for the pool\n\
98 \n\
99 ipsec pool --leases [--filter <filter>] [--utc]\n\
100 Show lease information using filters:\n\
101 filter: Filter string containing comma separated key=value filters,\n\
102 e.g. id=alice@strongswan.org,addr=1.1.1.1\n\
103 pool: name of the pool\n\
104 id: assigned identity of the lease\n\
105 addr: lease IP address\n\
106 tstamp: UNIX timestamp when lease was valid, as integer\n\
107 status: status of the lease: online|valid|expired\n\
108 utc: Show times in UTC instead of local time\n\
109 \n\
110 ipsec pool --purge <name>\n\
111 Delete lease history of a pool:\n\
112 name: Name of the pool to purge\n\
113 \n\
114 ipsec pool --batch <file>\n\
115 Read commands from a file and execute them atomically.\n\
116 file: File to read the newline separated commands from. Commands\n\
117 appear as they are written on the command line, e.g.\n\
118 --replace mypool --start 10.0.0.1 --end 10.0.0.254\n\
119 --del dns\n\
120 --add dns --server 10.1.0.1\n\
121 --add dns --server 10.1.1.1\n\
122 If a - (hyphen) is given as a file name, the commands are read\n\
123 from STDIN. Readin commands stops at the end of file. Empty\n\
124 lines are ignored. The file may not contain a --batch command.\n\
125 \n");
126 }