File qc/query_command.c

  $Revision: 1.56 $

Query command module (qc). This is what the whois query gets stored as in memory.
Status: NOT REVUED, TESTED

Included Files


Preprocessor definitions

#define QC_IMPL

#define MAX_OPT_ARG_C 20


Global Variable Lock

pthread_mutex_t Lock
Included from /home/shane/code/RIP/include/ca_defs.h
Visible in:  aa/aa.c
   ac/access_control.c
   ca/ca_configFns.c
   ca/ca_initFn.c
   ca/ca_sanityCheck.c
   ca/ca_sourceLoader.c
   ca/ca_values.c
   co/constants.c
   df/defs.c
   er/er.c
   er/er_arrays.c
   er/er_macro.c
   er/er_paths.c
   er/er_print.c
   ip/ip.c
   ma/bitmask.c
   mm/mm.c
   nh/nh.c
   pa/gpg.c
   pa/spawn.c
   pc/pc_commands.c
   pc/protocol_config.c
   pm/pm_serials.c
   pm/protocol_mirror.c
   pr/properties.c
   pw/protocol_whois.c
   qc/mg_getopt.c
   qc/query_command.c
Used in: ca_get_adminIntElement()ca/ca_configFns.c
  ca_get_adminStrElement()ca/ca_configFns.c
  ca_get_boolean()ca/ca_configFns.c
  ca_get_dirlist()ca/ca_configFns.c
  ca_get_int()ca/ca_configFns.c
  ca_get_string()ca/ca_configFns.c
  ca_set_boolean()ca/ca_configFns.c
  ca_srchandle2Intelement()ca/ca_configFns.c
  ca_srchandle2Strelement()ca/ca_configFns.c

Global Variable qrytype_str

char* qrytype_str[]
Included from /home/shane/code/RIP/include/query_command.h
Visible in:  qc/query_command.c
Used in: QC_get_qrytype()qc/query_command.c

External Variables

suboptarg
extern char* suboptarg

Global Function QC_create()

  try to parse the query and fill in the QC struct, setting 
  qc->query_type accordingly.

Author: marek.
Query_command* QC_create ( char* input, Query_environ* qe )
Query_command* QC_create
returns allocated structure
char* input
user query
Query_environ* qe
query environment structure
Prototyped in: /home/shane/code/RIP/include/query_command.h
Calls: QC_fill()qc/query_command.c
  UT_calloc_real(), UT_free_real(), strchr(), strcmp(), strlen()
Called by: PW_interact()pw/protocol_whois.c

Global Function QC_environ_free()

  Free the query_environ.

Query_command *qc query_environ to be freed.
More:
  Authors:
        ottrey
Online References:
void QC_environ_free ( Query_environ* qe )
Prototyped in: /home/shane/code/RIP/include/query_command.h
Calls: UT_free_real(), g_list_free()
Called by: PW_interact()pw/protocol_whois.c

Global Function QC_environ_new()

  Create a new query environment.

More:
  Authors:
        ottrey
Online References:
Query_environ* QC_environ_new ( char* ip, int sock )
Prototyped in: /home/shane/code/RIP/include/query_command.h
Calls: ca_get_SourceHandleByPosition()ca/ca_configFns.c
  ca_srchandle2Strelement()ca/ca_configFns.c
  UT_calloc_real(), UT_free_real(), g_list_append(), strcmp()
Called by: PW_interact()pw/protocol_whois.c

Global Function QC_environ_to_string()

  Convert the query_environ to a string.

Query_environ *query_environ The query_environ to be converted.
More:
  Authors:
        ottrey
Online References:
char* QC_environ_to_string ( Query_environ qe )
Prototyped in: /home/shane/code/RIP/include/query_command.h
Calls: IP_addr_b2a()ip/ip.c
  qc_sources_list_to_string()qc/query_command.c
  UT_free_real(), UT_strdup_real(), g_string_free(), g_string_sized_new(), g_string_sprintf()

Global Function QC_free()

  Free the query_command.

XXX I'm not sure the bitmaps will get freed. qc->inv_attrs_bitmap qc->object_type_bitmap qc->keytypes_bitmap
More:
  Authors:
        ottrey
Online References:
void QC_free ( Query_command* qc )
Query_command* qc
query_command to be freed.
Prototyped in: /home/shane/code/RIP/include/query_command.h
Calls: UT_free_real()
Called by: PW_interact()pw/protocol_whois.c

Global Function QC_get_qrytype()

  Get the name of the given query type code.
char* QC_get_qrytype ( qc_qtype_t qrytype )
char* QC_get_qrytype
returns a pointer to an element of array of static strings
qc_qtype_t qrytype
query type code
Prototyped in: /home/shane/code/RIP/include/query_command.h
Calls: fprintf()
Called by: pw_log_query()pw/protocol_whois.c
References Variables: qrytype_strqc/query_command.c

Global Function QC_query_command_to_string()

  Convert the query_command to a string.

More:
  Authors:
        ottrey
Online References:
char* QC_query_command_to_string ( Query_command* query_command )
Query_command* query_command
The query_command to be converted.
Prototyped in: /home/shane/code/RIP/include/query_command.h
Calls: DF_get_attribute_names()df/defs.c
  DF_get_class_names()df/defs.c
  MA_to_string()ma/bitmask.c
  UT_free_real(), UT_strdup_real(), WK_to_string(), sprintf()
Called by: log_command()qc/query_command.c

Global Function qc_sources_list_to_string()

  make a list of sources. expects list to hold source handles

char * qc_sources_list_to_string returns an allocated string, must be freed
char* qc_sources_list_to_string ( GList* list )
GList* list
list of source handles (as defined by CA)
Calls: ca_srchandle2Strelement()ca/ca_configFns.c
  UT_strdup_real(), g_list_first(), g_string_append(), g_string_append_c(), g_string_free(), g_string_sized_new()
Called by: QC_environ_to_string()qc/query_command.c

Local Function QC_fill()

  Create a new query_command.
  Returns 0 when OK, -1 when query incorrect.

More:
  Authors:
        ottrey - original code
	marek - modified for my getopts, multiple sources;
	        and generally cleaned.
Online References:
static int QC_fill ( char* query_str, Query_command* query_command, Query_environ* qe )
char* query_str
The garden variety whois query string.
Query_command* query_command
&nbs;
Query_environ* qe
the environment
Calls: DF_get_attribute_aliases()df/defs.c
  DF_get_attribute_index()df/defs.c
  DF_get_class_aliases()df/defs.c
  DF_get_class_index()df/defs.c
  DF_get_server_queries()df/defs.c
  IP_addr_t2b()ip/ip.c
  MA_bitcount()ma/bitmask.c
  MA_isset()ma/bitmask.c
  MA_new()ma/bitmask.c
  MA_not()ma/bitmask.c
  MA_set()ma/bitmask.c
  ca_get_SourceHandleByName()ca/ca_configFns.c
  ca_get_SourceHandleByPosition()ca/ca_configFns.c
  ca_get_string()ca/ca_configFns.c
  log_command()qc/query_command.c
  mg_getopt()qc/mg_getopt.c
  mg_new()qc/mg_getopt.c
  SK_cd_printf(), SK_cd_puts(), UT_calloc_real(), UT_free_real(), UT_strdup_real(), WK_new(), fprintf(), g_list_append(), g_list_free(), g_strfreev(), g_strsplit(), getsubopt(), strcat(), strcmp(), strlen(), strtok_r(), toupper()
Called by: QC_create()qc/query_command.c

Local Function asctime_r()

static char* asctime_r ( const struct tm* __tm, char* __buf )
Included from: /usr/include/time.h
Calls: __posix_asctime_r()

Local Function ctime_r()

static char* ctime_r ( const time_t* __time, char* __buf )
Included from: /usr/include/time.h
Calls: __posix_ctime_r()

Local Function getlogin_r()

static int getlogin_r ( char* __name, int __len )
Included from: /usr/include/unistd.h
Calls: __posix_getlogin_r()

Local Function log_command()

  Log the command.
  This is more to do with Tracing.  And should/will get merged with a tracing
  module (when it is finalized.)

More:
  Authors:
        ottrey
Online References:
static void log_command ( char* query_str, Query_command* query_command )
Calls: ER_dbg_va()er/er.c
  ER_is_traced()er/er.c
  QC_query_command_to_string()qc/query_command.c
  UT_free_real()
Called by: QC_fill()qc/query_command.c

Local Function readdir_r()

static int readdir_r ( DIR* __dp, struct dirent* __ent, struct dirent** __res )
Included from: /usr/include/dirent.h
Calls: __posix_readdir_r()

Local Function sigwait()

static int sigwait ( const sigset_t* __setp, int* __signo )
Included from: /usr/include/signal.h
Calls: __posix_sigwait()

Local Function ttyname_r()

static int ttyname_r ( int __fildes, char* __buf, size_t __size )
Included from: /usr/include/unistd.h
Calls: __posix_ttyname_r()