File modules/qc/query_command.c

  $Revision: 1.48 $

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

String sizes

#define STR_S 63

#define STR_M 255

#define STR_L 1023

#define STR_XL 4095

#define STR_XXL 16383


Global Variable qrytype_str

char* qrytype_str[]
Included from modules/qc/query_command.h
Visible in:  modules/qc/query_command.c
Used in: QC_get_qrytype()modules/qc/query_command.c

Global Variable Lock

pthread_mutex_t Lock
Included from include/ca_defs.h
Visible in:  modules/ac/access_control.c
   modules/ca/ca_configFns.c
   modules/ca/ca_initFn.c
   modules/ca/ca_sanityCheck.c
   modules/ca/ca_sourceLoader.c
   modules/ca/ca_values.c
   modules/er/er_macro.c
   modules/pc/pc_commands.c
   modules/pm/pm_serials.c
   modules/pm/protocol_mirror.c
   modules/pw/protocol_whois.c
   modules/qc/query_command.c
Used in: ca_get_adminIntElement()modules/ca/ca_configFns.c
  ca_get_adminStrElement()modules/ca/ca_configFns.c
  ca_get_boolean()modules/ca/ca_configFns.c
  ca_get_dirlist()modules/ca/ca_configFns.c
  ca_get_int()modules/ca/ca_configFns.c
  ca_get_string()modules/ca/ca_configFns.c
  ca_set_boolean()modules/ca/ca_configFns.c
  ca_set_string()modules/ca/ca_configFns.c
  ca_srchandle2Intelement()modules/ca/ca_configFns.c
  ca_srchandle2Strelement()modules/ca/ca_configFns.c

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: modules/qc/query_command.h
Calls: QC_fill()modules/qc/query_command.c
  calloc(), fprintf(), free(), strchr(), strcmp(), strlen(), wr_real_calloc()
Called by: PW_interact()modules/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: modules/qc/query_command.h
Calls: g_list_free(), wr_real_free()
Called by: PW_interact()modules/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: modules/qc/query_command.h
Calls: ca_get_SourceHandleByPosition()modules/ca/ca_configFns.c
  ca_srchandle2Strelement()modules/ca/ca_configFns.c
  fprintf(), free(), g_list_append(), strcmp(), wr_real_calloc()
Called by: PW_interact()modules/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: modules/qc/query_command.h
Calls: IP_addr_b2a()modules/ip/ip.c
  qc_sources_list_to_string()modules/qc/query_command.c
  fprintf(), sprintf(), strcpy(), strlen(), wr_real_free(), wr_real_malloc()

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: modules/qc/query_command.h
Calls: wr_real_free()
Called by: PW_interact()modules/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: modules/qc/query_command.h
Calls: fprintf()
Called by: pw_log_query()modules/pw/protocol_whois.c
References Variables: qrytype_strmodules/qc/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: modules/qc/query_command.h
Calls: DF_get_attribute_names()modules/df/defs.c
  DF_get_class_names()modules/df/defs.c
  MA_to_string()modules/ma/bitmask.c
  WK_to_string(), fprintf(), sprintf(), strcpy(), strlen(), wr_real_free(), wr_real_malloc()
Called by: log_command()modules/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()modules/ca/ca_configFns.c
  fprintf(), g_list_first(), strcat(), strlen(), wr_real_realloc()
Called by: QC_environ_to_string()modules/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()modules/df/defs.c
  DF_get_attribute_index()modules/df/defs.c
  DF_get_class_aliases()modules/df/defs.c
  DF_get_class_index()modules/df/defs.c
  DF_get_server_queries()modules/df/defs.c
  IP_addr_t2b()modules/ip/ip.c
  MA_bitcount()modules/ma/bitmask.c
  MA_isset()modules/ma/bitmask.c
  MA_new()modules/ma/bitmask.c
  MA_not()modules/ma/bitmask.c
  MA_set()modules/ma/bitmask.c
  ca_get_SourceHandleByName()modules/ca/ca_configFns.c
  ca_get_SourceHandleByPosition()modules/ca/ca_configFns.c
  ca_get_string()modules/ca/ca_configFns.c
  log_command()modules/qc/query_command.c
  mg_getopt()modules/qc/mg_getopt.c
  mg_new()modules/qc/mg_getopt.c
  SK_cd_printf(), SK_cd_puts(), WK_new(), fprintf(), g_list_append(), g_list_free(), g_strfreev(), g_strsplit(), getsubopt(), strcat(), strcmp(), strcpy(), strlen(), strncpy(), strtok_r(), toupper(), wr_real_calloc(), wr_real_free(), wr_real_malloc()
Called by: QC_create()modules/qc/query_command.c

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()modules/er/er.c
  ER_is_traced()modules/er/er.c
  QC_query_command_to_string()modules/qc/query_command.c
  wr_real_free()
Called by: QC_fill()modules/qc/query_command.c