/* What address is this vty comming from. */
char *address;
- /* Privilege level of this vty. */
- int privilege;
-
/* Failure count */
int fail;
unsigned char escape;
/* Current vty status. */
- enum {VTY_NORMAL, VTY_CLOSE, VTY_MORE, VTY_MORELINE,
- VTY_START, VTY_CONTINUE} status;
+ enum {VTY_NORMAL, VTY_CLOSE, VTY_MORE, VTY_MORELINE} status;
/* IAC handling */
unsigned char iac;
int width;
int height;
- int scroll_one;
-
/* Configure lines. */
int lines;
- /* Current executing function pointer. */
- int (*func) (struct vty *, void *arg);
-
/* Terminal monitor. */
int monitor;
/* Timeout seconds and thread. */
unsigned long v_timeout;
struct thread *t_timeout;
-
- /* Thread output function. */
- struct thread *t_output;
-
- /* Output data pointer. */
- int (*output_func) (struct vty *, int);
- void (*output_clean) (struct vty *);
- void *output_rn;
- unsigned long output_count;
- int output_type;
- void *output_arg;
};
/* Integrated configuration file. */
#define PRINTF_ATTRIBUTE(a,b)
#endif /* __GNUC__ */
-/* Utility macro to convert VTY argument to unsigned integer. */
-#define VTY_GET_INTEGER(NAME,V,STR) \
-{ \
- char *endptr = NULL; \
- (V) = strtoul ((STR), &endptr, 10); \
- if ((V) == ULONG_MAX || *endptr != '\0') \
- { \
+/* Utility macros to convert VTY argument to unsigned long or integer. */
+#define VTY_GET_LONG(NAME,V,STR) \
+{ \
+ char *endptr = NULL; \
+ (V) = strtoul ((STR), &endptr, 10); \
+ if (*endptr != '\0' || (V) == ULONG_MAX) \
+ { \
vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \
- return CMD_WARNING; \
- } \
+ return CMD_WARNING; \
+ } \
}
-#define VTY_GET_INTEGER_RANGE(NAME,V,STR,MIN,MAX) \
-{ \
- char *endptr = NULL; \
- (V) = strtoul ((STR), &endptr, 10); \
- if ((V) == ULONG_MAX || *endptr != '\0' \
- || (V) < (MIN) || (V) > (MAX)) \
- { \
+#define VTY_GET_INTEGER_RANGE(NAME,V,STR,MIN,MAX) \
+{ \
+ unsigned long tmpl; \
+ VTY_GET_LONG(NAME, tmpl, STR) \
+ if ( tmpl < (MIN) || tmpl > (MAX)) \
+ { \
vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \
- return CMD_WARNING; \
- } \
+ return CMD_WARNING; \
+ } \
+ (V) = tmpl; \
}
+#define VTY_GET_INTEGER(NAME,V,STR) \
+ VTY_GET_INTEGER_RANGE(NAME,V,STR,0U,UINT32_MAX)
+
/* Exported variables */
extern char integrate_default[];
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, char *);
+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 *, const char *, va_list);
+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 *);
+/* Send a fixed-size message to all vty terminal monitors; this should be
+ an async-signal-safe function. */
+extern void vty_log_fixed (const char *buf, size_t len);
+
#endif /* _ZEBRA_VTY_H */