5 #define OPT_TYPE_SERVICE_DISCOVERY 1
6 #define OPT_TYPE_DATA_PATH 2
7 #define OPT_TYPE_SECURITY 3
9 #define OPT_TYPE_MAX 99
11 typedef int opt_type_t;
19 // Usage: vine-tool [options...]
20 // ------------------------------------------------------------
21 // -r, --register Register a service
22 // -d, --discovery Discovery services
23 // -n, --name <name> Service name
24 // -t, --type <type> Service type
25 // -i, --iface <iface> Interface name
26 // ------------------------------------------------------------
27 // -a, --addr <IP> Remote IP
28 // -4, --ipv4 IPv4 only (optional)
29 // -6, --ipv6 IPv6 (optional)
30 // -p, --port <port> Port
31 // -D, --dp <DP type> DP Type (client|server|pubsub)
32 // -T, --topic <topic> Topic
33 // -m, --message <message> Send Message
34 // -f, --file <file> Send File
35 // -C, --max-conn <conns> Max number of connections
36 // ------------------------------------------------------------
37 // --cacert <path> CA certificates path
38 // --cert <path> Server certificate path
39 // --key <path> Private Key
41 //-------------------------------------------------------------
42 // -I, --interval <sec> Interval of sending a message (repeated until terminating app)
43 // -v, --verbose Print log messages
45 static const struct help_msg help_msgs[] = {
46 {OPT_TYPE_SERVICE_DISCOVERY, "-r, --register", "Register a service"},
47 {OPT_TYPE_SERVICE_DISCOVERY, "-d, --discovery", "Discovery services"},
48 {OPT_TYPE_SERVICE_DISCOVERY, "-n, --name <name>", "Service name"},
49 {OPT_TYPE_SERVICE_DISCOVERY, "-t, --type <type>", "Service type"},
50 {OPT_TYPE_SERVICE_DISCOVERY, "-i, --iface <iface>", "Interface name"},
51 {OPT_TYPE_SERVICE_DISCOVERY, "-b --ble", "Use BLE"},
52 {OPT_TYPE_DATA_PATH, "-a, --addr <IP>", "Remote IP"},
53 {OPT_TYPE_DATA_PATH, "-4, --ipv4", "IPv4 only (optional)"},
54 {OPT_TYPE_DATA_PATH, "-6, --ipv6", "IPv6 (optional)"},
55 {OPT_TYPE_DATA_PATH, "-p, --port <port>", "Port"},
56 {OPT_TYPE_DATA_PATH, "-D, --dp <DP type>", "DP Type (client|server|pubsub)"},
57 {OPT_TYPE_DATA_PATH, "-C, --max-conn <conns>", "Max number of connections"},
58 {OPT_TYPE_DATA_PATH, "-T, --topic <topic>", "Topic"},
59 {OPT_TYPE_DATA_PATH, "-m, --message <message>", "Send Message"},
60 {OPT_TYPE_DATA_PATH, "-f, --file <file>", "Send File"},
61 {OPT_TYPE_DATA_PATH, "-I, --interval <sec>",
62 "Interval of sending a message\n\t\t\t(repeated until terminating app)"},
63 {OPT_TYPE_SECURITY, "--cacert <path>", "CA certificates path"},
64 {OPT_TYPE_SECURITY, "--key <path>", "Private key path"},
65 {OPT_TYPE_SECURITY, "--cert <path>", "Server certificate path"},
66 {OPT_TYPE_SECURITY, "--psk <psk>", "PSK"},
67 {OPT_TYPE_EXT, "-v, --verbose", "Print log messages"},
68 {OPT_TYPE_EXT, "-w <file>", "Log file"},
69 {OPT_TYPE_EXT, "-h, --help", "Show the help messages"},
70 {OPT_TYPE_MAX, "", ""},
75 printf(" Usage: vine-tool [options...]\n");
76 for (int i = 0; help_msgs[i].type != OPT_TYPE_MAX ; i++) {
77 if (i == 0 || help_msgs[i].type != help_msgs[i - 1].type)
78 printf(" --------------------------------------------------\n");
79 printf(" %-22s %s\n", help_msgs[i].opt, help_msgs[i].desc);