Diff for /embedaddon/quagga/lib/vty.h between versions 1.1 and 1.1.1.4

version 1.1, 2012/02/21 17:26:12 version 1.1.1.4, 2016/11/02 10:09:11
Line 23  Software Foundation, Inc., 59 Temple Place - Suite 330 Line 23  Software Foundation, Inc., 59 Temple Place - Suite 330
   
 #include "thread.h"  #include "thread.h"
 #include "log.h"  #include "log.h"
   #include "sockunion.h"
   
 #define VTY_BUFSIZ 512  #define VTY_BUFSIZ 512
 #define VTY_MAXHIST 20  #define VTY_MAXHIST 20
Line 33  struct vty  Line 34  struct vty 
   /* File descripter of this vty. */    /* File descripter of this vty. */
   int fd;    int fd;
   
     /* output FD, to support stdin/stdout combination */
     int wfd;
   
   /* Is this vty connect to file or not */    /* Is this vty connect to file or not */
   enum {VTY_TERM, VTY_FILE, VTY_SHELL, VTY_SHELL_SERV} type;    enum {VTY_TERM, VTY_FILE, VTY_SHELL, VTY_SHELL_SERV} type;
   
   /* Node status of this vty */    /* Node status of this vty */
   int node;    int node;
   
   /* What address is this vty comming from. */  
   char *address;  
   
   /* Failure count */    /* Failure count */
   int fail;    int fail;
   
Line 118  struct vty  Line 119  struct vty 
   /* Timeout seconds and thread. */    /* Timeout seconds and thread. */
   unsigned long v_timeout;    unsigned long v_timeout;
   struct thread *t_timeout;    struct thread *t_timeout;
   
     /* What address is this vty comming from. */
     char address[SU_ADDRSTRLEN];
 };  };
   
 /* Integrated configuration file. */  /* Integrated configuration file. */
Line 148  struct vty  Line 152  struct vty 
 #define PRINTF_ATTRIBUTE(a,b)  #define PRINTF_ATTRIBUTE(a,b)
 #endif /* __GNUC__ */  #endif /* __GNUC__ */
   
/* Utility macros to convert VTY argument to unsigned long or integer. *//* Utility macros to convert VTY argument to unsigned long */
#define VTY_GET_LONG(NAME,V,STR) \#define VTY_GET_ULONG(NAME,V,STR) \
 do { \  do { \
   char *endptr = NULL; \    char *endptr = NULL; \
     errno = 0; \
   (V) = strtoul ((STR), &endptr, 10); \    (V) = strtoul ((STR), &endptr, 10); \
  if (*endptr != '\0' || (V) == ULONG_MAX) \  if (*(STR) == '-' || *endptr != '\0' || errno) \
     { \      { \
       vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \        vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \
       return CMD_WARNING; \        return CMD_WARNING; \
     } \      } \
 } while (0)  } while (0)
   
#define VTY_GET_INTEGER_RANGE(NAME,V,STR,MIN,MAX) \/*
do { \ * The logic below ((TMPL) <= ((MIN) && (TMPL) != (MIN)) is
  unsigned long tmpl; \ * done to circumvent the compiler complaining about
  VTY_GET_LONG(NAME, tmpl, STR); \ * comparing unsigned numbers against zero, if MIN is zero.
  if ( (tmpl < (MIN)) || (tmpl > (MAX))) \ * NB: The compiler isn't smart enough to supress the warning
    { \ * if you write (MIN) != 0 && tmpl < (MIN).
      vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \ */
      return CMD_WARNING; \#define VTY_GET_INTEGER_RANGE_HEART(NAME,TMPL,STR,MIN,MAX)      \
    } \do {                                                            \
  (V) = tmpl; \  VTY_GET_ULONG(NAME, (TMPL), STR);                             \
   if ( ((TMPL) <= (MIN) && (TMPL) != (MIN)) || (TMPL) > (MAX) ) \
     {                                                           \
       vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE);\
       return CMD_WARNING;                                       \
     }                                                           \
 } while (0)  } while (0)
   
#define VTY_GET_INTEGER(NAME,V,STR) \#define VTY_GET_INTEGER_RANGE(NAME,V,STR,MIN,MAX)               \
  VTY_GET_INTEGER_RANGE(NAME,V,STR,0U,UINT32_MAX)do {                                                            \
   unsigned long tmpl;                                           \
   VTY_GET_INTEGER_RANGE_HEART(NAME,tmpl,STR,MIN,MAX);           \
   (V) = tmpl;                                                   \
 } while (0)
   
   #define VTY_CHECK_INTEGER_RANGE(NAME,STR,MIN,MAX)               \
   do {                                                            \
     unsigned long tmpl;                                           \
     VTY_GET_INTEGER_RANGE_HEART(NAME,tmpl,STR,MIN,MAX);           \
   } while (0)
   
   #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)                                      \  #define VTY_GET_IPV4_ADDRESS(NAME,V,STR)                                      \
 do {                                                                             \  do {                                                                             \
   int retv;                                                                   \    int retv;                                                                   \
Line 197  do {                                                   Line 220  do {                                                  
     }                                                                         \      }                                                                         \
 } while (0)  } while (0)
   
   #define VTY_WARN_EXPERIMENTAL()                                               \
   do {                                                                          \
     vty_out (vty, "%% WARNING: this command is experimental. Both its name and" \
                   " parameters may%s%% change in a future version of Quagga,"   \
                   " possibly breaking your configuration!%s",                   \
                   VTY_NEWLINE, VTY_NEWLINE);                                    \
   } while (0)
   
 /* Exported variables */  /* Exported variables */
 extern char integrate_default[];  extern char integrate_default[];
   
Line 206  extern void vty_init_vtysh (void); Line 237  extern void vty_init_vtysh (void);
 extern void vty_terminate (void);  extern void vty_terminate (void);
 extern void vty_reset (void);  extern void vty_reset (void);
 extern struct vty *vty_new (void);  extern struct vty *vty_new (void);
   extern struct vty *vty_stdio (void (*atclose)(void));
 extern int vty_out (struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3);  extern int vty_out (struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3);
 extern void vty_read_config (char *, char *);  extern void vty_read_config (char *, char *);
 extern void vty_time_print (struct vty *, int);  extern void vty_time_print (struct vty *, int);
Line 222  extern void vty_hello (struct vty *); Line 254  extern void vty_hello (struct vty *);
   
 /* Send a fixed-size message to all vty terminal monitors; this should be  /* Send a fixed-size message to all vty terminal monitors; this should be
    an async-signal-safe function. */     an async-signal-safe function. */
extern void vty_log_fixed (const char *buf, size_t len);extern void vty_log_fixed (char *buf, size_t len);
   
 #endif /* _ZEBRA_VTY_H */  #endif /* _ZEBRA_VTY_H */

Removed from v.1.1  
changed lines
  Added in v.1.1.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>