summaryrefslogtreecommitdiff
path: root/lib/vty.h
diff options
context:
space:
mode:
authorpaul <paul>2005-05-06 21:25:49 +0000
committerpaul <paul>2005-05-06 21:25:49 +0000
commit8cc4198f9fabe5f10f5a773de1503d82f33a01fb (patch)
tree77045da709ff66629bd12029b9ee17700360909b /lib/vty.h
parente7fe8c88c3d552400e1ae3ae9243319ab95d6f2d (diff)
2005-05-06 Paul Jakma <paul@dishone.st>
* (general) extern and static'ification of functions in code and header. Cleanup any definitions with unspecified arguments. Add casts for callback assignments where the callback is defined, typically, as passing void *, but the function being assigned has some other pointer type defined as its argument, as gcc complains about casts from void * to X* via function arguments. Fix some old K&R style function argument definitions. Add noreturn gcc attribute to some functions, as appropriate. Add unused gcc attribute to some functions (eg ones meant to help while debugging) Add guard defines to headers which were missing them. * command.c: (install_node) add const qualifier, still doesnt shut up the warning though, because of the double pointer. (cmp_node) ditto * keychain.c: (key_str2time) Add GET_LONG_RANGE() macro, derived fromn vty.h ones to fix some of the (long) < 0 warnings. * thread.c: (various) use thread_empty (cpu_record_hash_key) should cast to uintptr_t, a stdint.h type * vty.h: Add VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX so they removed from ospfd/ospf_vty.h * zebra.h: Move definition of ZEBRA_PORT to here, to remove dependence of lib on zebra/zserv.h
Diffstat (limited to 'lib/vty.h')
-rw-r--r--lib/vty.h55
1 files changed, 39 insertions, 16 deletions
diff --git a/lib/vty.h b/lib/vty.h
index 6faa7d89..7289b7e6 100644
--- a/lib/vty.h
+++ b/lib/vty.h
@@ -174,26 +174,49 @@ struct vty
#define VTY_GET_INTEGER(NAME,V,STR) \
VTY_GET_INTEGER_RANGE(NAME,V,STR,0U,UINT32_MAX)
+#define VTY_GET_IPV4_ADDRESS(NAME,V,STR) \
+{ \
+ int retv; \
+ retv = inet_aton ((STR), &(V)); \
+ if (!retv) \
+ { \
+ vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \
+ return CMD_WARNING; \
+ } \
+}
+
+#define VTY_GET_IPV4_PREFIX(NAME,V,STR) \
+{ \
+ int retv; \
+ retv = str2prefix_ipv4 ((STR), &(V)); \
+ if (retv <= 0) \
+ { \
+ vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \
+ return CMD_WARNING; \
+ } \
+}
+
/* Exported variables */
extern char integrate_default[];
/* Prototypes. */
-void vty_init (struct thread_master *);
-void vty_init_vtysh (void);
-void vty_reset (void);
-struct vty *vty_new (void);
-int vty_out (struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3);
-void vty_read_config (char *, char *);
-void vty_time_print (struct vty *, int);
-void vty_serv_sock (const char *, unsigned short, const char *);
-void vty_close (struct vty *);
-char *vty_get_cwd (void);
-void vty_log (const char *level, const char *proto, const char *fmt, va_list);
-int vty_config_lock (struct vty *);
-int vty_config_unlock (struct vty *);
-int vty_shell (struct vty *);
-int vty_shell_serv (struct vty *);
-void vty_hello (struct vty *);
+extern void vty_init (struct thread_master *);
+extern void vty_init_vtysh (void);
+extern void vty_reset (void);
+extern struct vty *vty_new (void);
+extern int vty_out (struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3);
+extern void vty_read_config (char *, char *);
+extern void vty_time_print (struct vty *, int);
+extern void vty_serv_sock (const char *, unsigned short, const char *);
+extern void vty_close (struct vty *);
+extern char *vty_get_cwd (void);
+extern void vty_log (const char *level, const char *proto,
+ const char *fmt, va_list);
+extern int vty_config_lock (struct vty *);
+extern int vty_config_unlock (struct vty *);
+extern int vty_shell (struct vty *);
+extern int vty_shell_serv (struct vty *);
+extern void vty_hello (struct vty *);
/* Send a fixed-size message to all vty terminal monitors; this should be
an async-signal-safe function. */