]> git.proxmox.com Git - mirror_iproute2.git/blame - tipc/cmdl.h
Merge branch 'master' into net-next
[mirror_iproute2.git] / tipc / cmdl.h
CommitLineData
f043759d
RA
1/*
2 * cmdl.h Framework for handling command line options.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *
9 * Authors: Richard Alpe <richard.alpe@ericsson.com>
10 */
11
12#ifndef _TIPC_CMDL_H
13#define _TIPC_CMDL_H
14
15#include <libmnl/libmnl.h>
16
17extern int help_flag;
18
19struct cmdl {
20 int optind;
21 int argc;
22 char **argv;
23};
24
50afc4db
RA
25struct tipc_sup_media {
26 char *media;
27 char *identifier;
28 void (*help)(struct cmdl *cmdl, char *media);
29};
30
f043759d
RA
31struct cmd {
32 const char *cmd;
33 int (*func)(struct nlmsghdr *nlh, const struct cmd *cmd,
34 struct cmdl *cmdl, void *data);
35 void (*help)(struct cmdl *cmdl);
36};
37
38struct opt {
39 const char *key;
40 char *val;
41};
42
43struct opt *get_opt(struct opt *opts, char *key);
44int parse_opts(struct opt *opts, struct cmdl *cmdl);
45char *shift_cmdl(struct cmdl *cmdl);
46
47int run_cmd(struct nlmsghdr *nlh, const struct cmd *caller,
48 const struct cmd *cmds, struct cmdl *cmdl, void *data);
49
50const struct cmd *find_cmd(const struct cmd *cmds, char *str);
51
52#endif