]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lldpcli: put port restriction into a commands.c for use in other files
authorVincent Bernat <bernat@luffy.cx>
Tue, 22 Jan 2013 21:33:57 +0000 (22:33 +0100)
committerVincent Bernat <bernat@luffy.cx>
Tue, 22 Jan 2013 21:33:57 +0000 (22:33 +0100)
src/client/actions.c
src/client/client.h
src/client/commands.c
src/client/show.c

index f852390d522350ea7dc9d6803b1fd3340827bfea..85af9dc3783f57d1586563c361ccad7bb9faab80 100644 (file)
@@ -379,23 +379,6 @@ cmd_dot3power(struct lldpctl_conn_t *conn, struct writer *w,
        return 1;
 }
 
-/**
- * Restrict the command to some ports.
- */
-static void
-restrict_ports(struct cmd_node *root)
-{
-       /* Restrict to some ports. */
-       commands_new(
-               commands_new(root,
-                   "ports",
-                   "Restrict configuration to some ports",
-                   cmd_check_no_env, NULL, "ports"),
-               NULL,
-               "Restrict configuration to the specified ports (comma-separated list)",
-               NULL, cmd_store_env_value_and_pop2, "ports");
-}
-
 /**
  * Register `configure med location coordinate` commands.
  */
@@ -905,7 +888,7 @@ register_commands_configure(struct cmd_node *root)
                "configure",
                "Change system settings",
                NULL, NULL, NULL);
-       restrict_ports(configure);
+       cmd_restrict_ports(configure);
 
        if (has_med) {
                struct cmd_node *configure_med = commands_new(
index 3b490c7b4bc722aed55f59564bc28372bc70c0db..0e1d73c6193ad073c39dea30fa5c6450bd2800a4 100644 (file)
@@ -94,6 +94,7 @@ int cmd_store_env_value_and_pop3(struct lldpctl_conn_t *, struct writer *,
     struct cmd_env *, void *);
 lldpctl_atom_t* cmd_iterate_on_interfaces(struct lldpctl_conn_t *,
     struct cmd_env *);
+void cmd_restrict_ports(struct cmd_node *);
 
 /* misc.c */
 int contains(const char *, const char *);
index be30b723a0c42f0a582a300b15f83cedc7a4fa78..869ecdacd8afbeb34783519a8da7e55465bb3b68 100644 (file)
@@ -652,3 +652,20 @@ cmd_iterate_on_interfaces(struct lldpctl_conn_t *conn, struct cmd_env *env)
 
        return iface;
 }
+
+/**
+ * Restrict the command to some ports.
+ */
+void
+cmd_restrict_ports(struct cmd_node *root)
+{
+       /* Restrict to some ports. */
+       commands_new(
+               commands_new(root,
+                   "ports",
+                   "Restrict configuration to some ports",
+                   cmd_check_no_env, NULL, "ports"),
+               NULL,
+               "Restrict configuration to the specified ports (comma-separated list)",
+               NULL, cmd_store_env_value_and_pop2, "ports");
+}
index 8f6463608a982d1c9fa6dd2c8d5fa987420d4016..581c7134bb04a3deae12dfd2403e67d92528ac8a 100644 (file)
@@ -153,14 +153,7 @@ register_common_commands(struct cmd_node *root)
            cmd_check_no_detailed_nor_summary, cmd_store_env_and_pop, "summary");
 
        /* Some specific port */
-       commands_new(
-               commands_new(root,
-                   "ports",
-                   "Restrict to neighbors seen on some ports",
-                   cmd_check_no_env, NULL, "ports"),
-               NULL,
-               "Restrict to neighbors on those ports (comma-separated list)",
-               NULL, cmd_store_env_value_and_pop2, "ports");
+       cmd_restrict_ports(root);
 }
 
 /**