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.16 $
   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                              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 /*+ Maximum size of input that can be recieved from the client. +*/
  41 #define MAX_INPUT_SIZE  1024
  42 
  43 /*+ This propmt is sent to the user. +*/
  44 /*
  45 #define PROMPT  "\nwhois R.I.P. config> "
  46 #define PROMPT  "\nwhois \033[0;1;33;40mR.I.P.\033[0m config> "
  47 */
  48 
  49 /*+ This login propmt is sent to the user. +*/
  50 #define LOGIN_PROMPT  "\nlogin: "
  51 
  52 /*+ This password propmt is sent to the user. +*/
  53 #define PASSWD_PROMPT  "password: "
  54 
  55 /* XXX Why doesn't invisible work ???!?!?!
  56 
  57 http://www.dee.ufpb.br/~bob/tools/ansi.html
  58 http://cs.wwc.edu/~bellmi/ANSI_escape_codes.html
  59 
  60 #define ECHO_ON "\033[8m"
  61 */
  62 
  63 /* Use reverse video instead - grrr. */
  64 #define ECHO_ON "\033[33;43m"
  65 
  66 #define ECHO_OFF "\033[0m"
  67 
  68 #define CLEAR_SCREEN "\033[2J"
  69 
  70 /*+ This welcome message is sent to the user, upon connecting. +*/
  71 /*
  72 #define WELCOME  "Welcome to the whois R.I.P. server.\n"
  73 */
  74 
  75 #define HELP_ERROR        "Invalid help command: "
  76 #define HELP_HELP         "Print help information."
  77 #define HELP_QUIT         "Quit the server."
  78 #define HELP_SHOW         "Show the values of: (type show for a list)"
  79 #define HELP_SHOW_ERROR   "Invalid show command: "
  80 #define HELP_SHOW_CONST   "The values of a constant used in the server."
  81 #define HELP_SHOW_CONSTS  "The values of constants used in the server.\n"\
  82                           "(This is set from values in properties object.)"
  83 #define HELP_SHOW_PROPS   "The values of properties in the properties file."
  84 #define HELP_SHOW_THREADS "The properties of the client's thread."
  85 #define HELP_SHOW_WHOIS   "The values of the whois query module."
  86 #define HELP_SHOW_ACCESS  "The access to server."
  87 #define HELP_SHOW_ACL     "The access control list for server."
  88 #define HELP_SHOW_ERR     "Show the setup of the error path system"
  89 #define HELP_SHOW_MACROS  "Show the currently defined macros of the error path system"
  90 #define HELP_SHOW_UPTIME  "Show system uptime statistics"
  91 
  92 #define HELP_SET          "Set the values of: (type set for a list)"
  93 #define HELP_SET_ERROR    "Invalid set command: "
  94 #define HELP_SET_CONST    "Set the values of a constants: (type set const name=value)"
  95 #define HELP_SET_CONSTS   "Set the values of constants used in the server.\n"\
  96                           "(This is set from values in properties object.)"
  97 #define HELP_SET_PROPS    "Set the values of properties in the properties file."
  98 #define HELP_SET_ACL      "Create/modify acl entries for a given address or prefix.\n" \
  99 "\tSyntax:  set acl ip[/prefixlength] column=value,column=value...\n" \
 100 "\tColumn names as in acl display. Unset columns are inherited."
 101 #define HELP_SET_NODENY   "Set the deny counter in the access tree to 0\n"\
 102                           "\tSyntax:  set nodeny ip"
 103 #define HELP_STOP         "Stop activities (type stop for a list)"
 104 #define HELP_STOP_QUERY   "Stop a query thread (arguments are: <socket #> <thread #>)"
 105 #define HELP_SET_UPDATES  "Pause/resume all update threads: \n"\
 106                           "\tSyntax: set updates {pause|resume}"
 107 #define HELP_SET_QUERIES  "Pause/resume all queries: \n"\
 108                           "\tSyntax: set queries {pause|resume}"
 109 #define HELP_SET_INITRX   "Reload radix trees for a given source: \n"\
 110                           "\tSyntax: set initrx <source>" 
 111 #define HELP_SET_ERR      "Modify the error path system.\n"\
 112                           "\tSyntax: set err <errspec>\n"\
 113                           "\tFor details of <errspec> please see the error specification document\n"
 114 
 115 #define HELP_SET_MACRO    "Set a new macro in the error path system"
 116 #define HELP_SET_COUNTER "Reset the counter for the given thread. Argument: thread_id"
 117 
 118 
 119 #define PC_RET_QUIT     (0xabcdef) /* make it really uniq */
 120 #define PC_RET_ERR      (1)
 121 
 122 
 123 void PC_interact(int sock);
 124 
 125 
 126 /*+ Each command has a +*/
 127 typedef struct _command {
 128   const char *name;                          /*+ Name to be invoked. +*/
 129   int (*function)(char *, GString *, sk_conn_st *);/*+ Function to be invoked. +*/
 130   const char *help;                                /*+ Command help. +*/
 131 } Command;
 132 
 133 int show_commands(Command *comm, char *comm_name, GString *output);
 134 
 135 #ifdef PC_IMPL
 136 
 137 /*+
 138  * Contains the command definitions
 139 +*/
 140 struct _command command[] = {
 141   {"help"   , command_help   , HELP_HELP   },
 142   {"quit"   , command_quit   , HELP_QUIT   },
 143   {"show"   , command_show   , HELP_SHOW   },
 144   {"stop"   , command_stop   , HELP_STOP   },
 145   {"set"    , command_set    , HELP_SET    },
 146   {"purify" , command_purify , "trigger a new memory-in-use report" },
 147   {NULL     , NULL           , NULL        }
 148 };
 149 
 150 /*+
 151  * Contains the show commands
 152 +*/
 153 struct _command show[] = {
 154   {"const"   , show_const   , HELP_SHOW_CONST   },
 155   {"consts"  , show_consts  , HELP_SHOW_CONSTS  },
 156   {"props"   , show_props   , HELP_SHOW_PROPS   },
 157   {"threads" , show_threads , HELP_SHOW_THREADS },
 158   {"whois"   , show_whois   , HELP_SHOW_WHOIS   },
 159   {"access"  , show_access  , HELP_SHOW_ACCESS  },
 160   {"acl"     , show_acl     , HELP_SHOW_ACL     },
 161   {"err"     , show_err     , HELP_SHOW_ERR     },
 162   {"macros"  , show_macros  , HELP_SHOW_MACROS  },
 163   {"uptime"  , show_uptime  , HELP_SHOW_UPTIME  },
 164   {NULL      , NULL         , NULL              }
 165 };
 166  
 167 /*+
 168  * Contains the set commands
 169 +*/
 170 struct _command set[] = {
 171   {"acl"    , set_acl    , HELP_SET_ACL    },
 172   {"nodeny" , set_nodeny , HELP_SET_NODENY },
 173   {"updates", set_updates, HELP_SET_UPDATES},
 174   {"queries", set_queries, HELP_SET_QUERIES},
 175   {"err"    , set_err    , HELP_SET_ERR    },
 176   {"macro"  , set_macro  , HELP_SET_MACRO  }, 
 177   {"counter", set_counter, HELP_SET_COUNTER},
 178   {"initrx",  set_initrx,  HELP_SET_INITRX },
 179   {NULL     , NULL       , NULL            }
 180 };
 181 
 182 struct _command stop[] = {
 183   {"query"  , stop_query  , HELP_STOP_QUERY  },
 184   {NULL     , NULL        , NULL            }
 185 };
 186 
 187 #else
 188 
 189 extern struct _command command[], show[], set[], stop[]; 
 190 
 191 #endif /* PC_IMPL */
 192 
 193 int command_execute(Command *comm, char *comm_name,
 194                     char *input, GString *output, sk_conn_st *condat) ;
 195 
 196 #endif /* READ_PROTOCOL_CONFIG */

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