modules/pc/protocol_config.h

/* [<][>][^][v][top]
[bottom][index][help] */

FUNCTIONS

This source file includes following functions.

   1 #ifndef READ_PROTOCOL_CONFIG
   2 #define READ_PROTOCOL_CONFIG
   3 
   4 /***************************************
   5   $Revision: 1.20 $
   6 
   7   Protocol config module (pc).  This is the protocol that the admin uses to
   8   talk to the server.
   9 
  10   Status: NOT REVUED, TESTED
  11 
  12   
  13   
  14   ******************/ /******************
  15   Copyright (c) 1999,2000,2001,2002               RIPE NCC
  16  
  17   All Rights Reserved
  18   
  19   Permission to use, copy, modify, and distribute this software and its
  20   documentation for any purpose and without fee is hereby granted,
  21   provided that the above copyright notice appear in all copies and that
  22   both that copyright notice and this permission notice appear in
  23   supporting documentation, and that the name of the author not be
  24   used in advertising or publicity pertaining to distribution of the
  25   software without specific, written prior permission.
  26   
  27   THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  28   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
  29   AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
  30   DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
  31   AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  32   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  33   ***************************************/
  34 
  35 #define DEFAULT_USER_NAME "user"
  36 
  37 /*+ Log message +*/
  38 #define LOG_CONFIG "[%d] %s %s %s\n"
  39 
  40 /*+ This propmt is sent to the user. +*/
  41 /*
  42 #define PROMPT  "\nwhois R.I.P. config> "
  43 #define PROMPT  "\nwhois \033[0;1;33;40mR.I.P.\033[0m config> "
  44 */
  45 
  46 /*+ This login propmt is sent to the user. +*/
  47 #define LOGIN_PROMPT  "\nlogin: "
  48 
  49 /*+ This password propmt is sent to the user. +*/
  50 #define PASSWD_PROMPT  "password: "
  51 
  52 /* XXX Why doesn't invisible work ???!?!?!
  53 
  54 http://www.dee.ufpb.br/~bob/tools/ansi.html
  55 http://cs.wwc.edu/~bellmi/ANSI_escape_codes.html
  56 
  57 #define ECHO_ON "\033[8m"
  58 */
  59 
  60 /* Use reverse video instead - grrr. */
  61 #define ECHO_ON "\033[33;43m"
  62 
  63 #define ECHO_OFF "\033[0m"
  64 
  65 #define CLEAR_SCREEN "\033[2J"
  66 
  67 /*+ This welcome message is sent to the user, upon connecting. +*/
  68 /*
  69 #define WELCOME  "Welcome to the whois R.I.P. server.\n"
  70 */
  71 
  72 #define HELP_ERROR        "Invalid help command: "
  73 #define HELP_HELP         "Print help information."
  74 #define HELP_QUIT         "Quit the server."
  75 #define HELP_SHOW         "Show the values of: (type show for a list)"
  76 #define HELP_SHOW_ERROR   "Invalid show command: "
  77 #define HELP_SHOW_CONST   "The values of a constant used in the server."
  78 #define HELP_SHOW_CONSTS  "The values of constants used in the server.\n"\
  79                           "(This is set from values in properties object.)"
  80 #define HELP_SHOW_PROPS   "The values of properties in the properties file."
  81 #define HELP_SHOW_THREADS "The properties of the client's thread."
  82 #define HELP_SHOW_WHOIS   "The values of the whois query module."
  83 #define HELP_SHOW_ACCESS  "The access to server."
  84 #define HELP_SHOW_ACL     "The access control list for server."
  85 #define HELP_SHOW_ERR     "Show the setup of the error path system"
  86 #define HELP_SHOW_MACROS  "Show the currently defined macros of the error path system"
  87 #define HELP_SHOW_UPTIME  "Show system uptime statistics"
  88 
  89 #define HELP_SET          "Set the values of: (type set for a list)"
  90 #define HELP_SET_ERROR    "Invalid set command: "
  91 #define HELP_SET_CONST    "Set the values of a constants: (type set const name=value)"
  92 #define HELP_SET_CONSTS   "Set the values of constants used in the server.\n"\
  93                           "(This is set from values in properties object.)"
  94 #define HELP_SET_PROPS    "Set the values of properties in the properties file."
  95 #define HELP_SET_ACL      "Create/modify acl entries for a given address or prefix.\n" \
  96 "\tSyntax:  set acl ip[/prefixlength] column=value,column=value...\n" \
  97 "\tColumn names as in acl display. Unset columns are inherited."
  98 #define HELP_SET_NODENY   "Set the deny counter in the access tree to 0\n"\
  99                           "\tSyntax:  set nodeny ip"
 100 #define HELP_STOP         "Stop activities (type stop for a list)"
 101 #define HELP_STOP_QUERY   "Stop a query thread (arguments are: <socket #> <thread #>)"
 102 #define HELP_SET_UPDATES  "Pause/resume all update threads: \n"\
 103                           "\tSyntax: set updates {pause|resume}"
 104 #define HELP_SET_QUERIES  "Pause/resume all queries: \n"\
 105                           "\tSyntax: set queries {pause|resume}"
 106 #define HELP_SET_INITRX   "Reload radix trees for a given source: \n"\
 107                           "\tSyntax: set initrx <source>" 
 108 #define HELP_SET_ERR      "Modify the error path system.\n"\
 109                           "\tSyntax: set err <errspec>\n"\
 110                           "\tFor details of <errspec> please see the error specification document\n"
 111 
 112 #define HELP_SET_MACRO    "Set a new macro in the error path system"
 113 #define HELP_SET_COUNTER "Reset the counter for the given thread. Argument: thread_id"
 114 
 115 
 116 #define PC_RET_QUIT     (0xabcdef) /* make it really uniq */
 117 #define PC_RET_ERR      (1)
 118 
 119 
 120 void PC_interact(int sock);
 121 
 122 
 123 /*+ Each command has a +*/
 124 typedef struct _command {
 125   const char *name;                          /*+ Name to be invoked. +*/
 126   int (*function)(char *, GString *, sk_conn_st *);/*+ Function to be invoked. +*/
 127   const char *help;                                /*+ Command help. +*/
 128 } Command;
 129 
 130 int show_commands(Command *comm, char *comm_name, GString *output);
 131 
 132 #ifdef PC_IMPL
 133 
 134 /*+
 135  * Contains the command definitions
 136 +*/
 137 struct _command command[] = {
 138   {"help"   , command_help   , HELP_HELP   },
 139   {"quit"   , command_quit   , HELP_QUIT   },
 140   {"show"   , command_show   , HELP_SHOW   },
 141   {"stop"   , command_stop   , HELP_STOP   },
 142   {"set"    , command_set    , HELP_SET    },
 143   {"purify" , command_purify , "trigger a new memory-in-use report" },
 144   {NULL     , NULL           , NULL        }
 145 };
 146 
 147 /*+
 148  * Contains the show commands
 149 +*/
 150 struct _command show[] = {
 151   {"const"   , show_const   , HELP_SHOW_CONST   },
 152   {"consts"  , show_consts  , HELP_SHOW_CONSTS  },
 153   {"props"   , show_props   , HELP_SHOW_PROPS   },
 154   {"threads" , show_threads , HELP_SHOW_THREADS },
 155   {"whois"   , show_whois   , HELP_SHOW_WHOIS   },
 156   {"access"  , show_access  , HELP_SHOW_ACCESS  },
 157   {"acl"     , show_acl     , HELP_SHOW_ACL     },
 158   {"err"     , show_err     , HELP_SHOW_ERR     },
 159   {"macros"  , show_macros  , HELP_SHOW_MACROS  },
 160   {"uptime"  , show_uptime  , HELP_SHOW_UPTIME  },
 161   {NULL      , NULL         , NULL              }
 162 };
 163  
 164 /*+
 165  * Contains the set commands
 166 +*/
 167 struct _command set[] = {
 168   {"acl"    , set_acl    , HELP_SET_ACL    },
 169   {"nodeny" , set_nodeny , HELP_SET_NODENY },
 170   {"updates", set_updates, HELP_SET_UPDATES},
 171   {"queries", set_queries, HELP_SET_QUERIES},
 172   {"err"    , set_err    , HELP_SET_ERR    },
 173   {"macro"  , set_macro  , HELP_SET_MACRO  }, 
 174 /*  {"counter", set_counter, HELP_SET_COUNTER},*/
 175   {"initrx",  set_initrx,  HELP_SET_INITRX },
 176   {NULL     , NULL       , NULL            }
 177 };
 178 
 179 struct _command stop[] = {
 180 /*  {"query"  , stop_query  , HELP_STOP_QUERY  },*/
 181   {NULL     , NULL        , NULL            }
 182 };
 183 
 184 #else
 185 
 186 extern struct _command command[], show[], set[], stop[]; 
 187 
 188 #endif /* PC_IMPL */
 189 
 190 int command_execute(Command *comm, char *comm_name,
 191                     char *input, GString *output, sk_conn_st *condat) ;
 192 
 193 #endif /* READ_PROTOCOL_CONFIG */

/* [<][>][^][v][top][bottom][index][help] */