]>
Commit | Line | Data |
---|---|---|
4b292b55 | 1 | /* -*- mode: c; c-file-style: "openbsd" -*- */ |
0c79e036 VB |
2 | /* |
3 | * Copyright (c) 2012 Vincent Bernat <bernat@luffy.cx> | |
4 | * | |
5 | * Permission to use, copy, modify, and/or distribute this software for any | |
6 | * purpose with or without fee is hereby granted, provided that the above | |
7 | * copyright notice and this permission notice appear in all copies. | |
8 | * | |
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
16 | */ | |
17 | ||
4b292b55 VB |
18 | #ifndef _CLIENT_H |
19 | #define _CLIENT_H | |
0c79e036 | 20 | |
4b292b55 VB |
21 | #if HAVE_CONFIG_H |
22 | # include <config.h> | |
23 | #endif | |
24 | ||
25 | #include "../lib/lldpctl.h" | |
26 | #include "../lldp-const.h" | |
9a775667 VB |
27 | #include "../log.h" |
28 | #include "../ctl.h" | |
0c79e036 VB |
29 | #include "writer.h" |
30 | ||
9a775667 VB |
31 | /* commands.c */ |
32 | #define NEWLINE "<CR>" | |
33 | struct cmd_node; | |
34 | struct cmd_env; | |
35 | struct cmd_node *commands_root(void); | |
36 | struct cmd_node *commands_new( | |
37 | struct cmd_node *, | |
38 | const char *, | |
39 | const char *, | |
40 | int(*validate)(struct cmd_env*, void *), | |
41 | int(*execute)(struct lldpctl_conn_t*, struct writer*, | |
42 | struct cmd_env*, void *), | |
43 | void *); | |
44 | void commands_free(struct cmd_node *); | |
45 | const char *cmdenv_arg(struct cmd_env*); | |
46 | const char *cmdenv_get(struct cmd_env*, const char*); | |
47 | int cmdenv_put(struct cmd_env*, const char*, const char*); | |
48 | int cmdenv_pop(struct cmd_env*, int); | |
49 | int commands_execute(struct lldpctl_conn_t *, struct writer *, | |
50 | struct cmd_node *, int argc, const char **argv); | |
51 | char *commands_complete(struct cmd_node *, int argc, const char **argv, | |
52 | int cursorc, int cursoro, int all); | |
53 | /* helpers */ | |
54 | int cmd_not_implemented(struct lldpctl_conn_t *, struct writer *, | |
55 | struct cmd_env *, void *); | |
56 | int cmd_check_no_env(struct cmd_env *, void *); | |
57 | int cmd_check_env(struct cmd_env *, void *); | |
58 | int cmd_store_env(struct lldpctl_conn_t *, struct writer *, | |
59 | struct cmd_env *, void *); | |
60 | int cmd_store_env_and_pop(struct lldpctl_conn_t *, struct writer *, | |
61 | struct cmd_env *, void *); | |
62 | int cmd_store_env_value(struct lldpctl_conn_t *, struct writer *, | |
63 | struct cmd_env *, void *); | |
64 | int cmd_store_env_value_and_pop(struct lldpctl_conn_t *, struct writer *, | |
65 | struct cmd_env *, void *); | |
66 | int cmd_store_env_value_and_pop2(struct lldpctl_conn_t *, struct writer *, | |
67 | struct cmd_env *, void *); | |
68 | int cmd_store_env_value_and_pop3(struct lldpctl_conn_t *, struct writer *, | |
69 | struct cmd_env *, void *); | |
70 | lldpctl_atom_t* cmd_iterate_on_interfaces(struct lldpctl_conn_t *, | |
71 | struct cmd_env *); | |
72 | ||
73 | /* misc.c */ | |
74 | int contains(const char *, const char *); | |
75 | char* totag(const char *); | |
0c79e036 VB |
76 | |
77 | /* display.c */ | |
9a775667 VB |
78 | #define DISPLAY_BRIEF 1 |
79 | #define DISPLAY_NORMAL 2 | |
80 | #define DISPLAY_DETAILS 3 | |
81 | void display_interfaces(lldpctl_conn_t *, struct writer *, | |
82 | struct cmd_env *, int, int); | |
4e90a9e0 | 83 | void display_interface(lldpctl_conn_t *, struct writer *, int, |
9a775667 | 84 | lldpctl_atom_t *, lldpctl_atom_t *, int); |
8729d69f | 85 | void display_configuration(lldpctl_conn_t *, struct writer *); |
4b292b55 | 86 | |
9a775667 VB |
87 | /* show.c */ |
88 | void register_commands_show(struct cmd_node *); | |
89 | void register_commands_watch(struct cmd_node *); | |
90 | ||
4b292b55 | 91 | /* actions.c */ |
9a775667 | 92 | void register_commands_configure(struct cmd_node *); |
0c79e036 VB |
93 | |
94 | #endif |