File modules/qc/query_command.c

  $Revision: 1.10 $

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

Included Files


Preprocessor definitions

#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 Function QC_bitmap_to_string()

  Convert the bitmap of attributes used in this query_command to a string.

More:
  Authors:
        ottrey
Online References:
char* QC_bitmap_to_string ( mask_t bitmap )
mask_t bitmap
The bitmap of attribute to be converted.
Prototyped in: modules/qc/query_command.h
Calls: AT_get_attributes()modules/at/attributes.c
  MA_to_string()modules/ma/bitmask.c
Called by: QC_query_command_to_string()modules/qc/query_command.c

Global Function QC_environ_update()

  Update the query environment.
  Return the new environment?
  This will include things like setting recursion, and the sources, and other
  options deemed to be of an environmental type.
  XXX This hasn't been implemented yet.  Haven't quite decided what to do here
  yet.
  (I personally don't like functions that change two things at once, so that
  may also be looked into aswell.)

More:
  Authors:
        ottrey
Online References:
Query_command* QC_environ_update ( Query_command* qc, Query_command* qe )
Query_command* qc
The query command to be updated.
Query_command* qe
The current environment.
Prototyped in: modules/qc/query_command.h
Calls: calloc()

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: free(), g_list_free()
Called by: PW_interact()modules/pw/protocol_whois.c

Global Function QC_new()

  Create a new query_command.

Pre-condition: OB_init() must be called before this. Ie the objects have to be created first.
XXX sock shouldn't be passed here. But it needs to in order to report errors to the client. Doh!.... this needs some looking into.
More:
  Authors:
        ottrey
Online References:
Query_command* QC_new ( char* query_str, int sock )
char* query_str
The garden variety whois query string.
int sock
The client socket.
Prototyped in: modules/qc/query_command.h
Calls: AT_get_attributes()modules/at/attributes.c
  AT_get_source()modules/at/attributes.c
  AT_get_sources()modules/at/attributes.c
  AT_sources_to_string()modules/at/attributes.c
  CO_get_comnd_logging()modules/co/constants.c
  MA_free()modules/ma/bitmask.c
  MA_isset()modules/ma/bitmask.c
  MA_new()modules/ma/bitmask.c
  MA_set()modules/ma/bitmask.c
  MA_xor()modules/ma/bitmask.c
  OB_get_inv_attr_mask()modules/ob/objects.c
  OB_get_object_mask()modules/ob/objects.c
  log_command()modules/qc/query_command.c
  my_getopt()modules/qc/query_command.c
  SK_puts(), WK_new(), calloc(), g_list_append(), g_list_remove(), getsubopt(), sprintf(), strcat(), strcpy(), strlen(), strncmp(), strncpy(), strtok(), toupper()
Called by: PW_interact()modules/pw/protocol_whois.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: AT_sources_list_to_string()modules/at/attributes.c
  QC_bitmap_to_string()modules/qc/query_command.c
  WK_to_string(), calloc(), free(), sprintf(), strcpy(), strlen()
Called by: log_command()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: CO_get_comnd_logfile()modules/co/constants.c
  CO_get_comnd_logging()modules/co/constants.c
  QC_query_command_to_string()modules/qc/query_command.c
  fclose(), fopen(), fprintf(), free(), printf(), strcmp()
Called by: QC_new()modules/qc/query_command.c

Local Function my_getopt()

  A thread safe version of getopt, used to get the options from the whois
  query.

More:
  Authors:
        ottrey
Online References:
  • man getopt
static int my_getopt ( int opt_argc, char** opt_argv, char* optstring, int* my_optind_ptr, char** my_optarg_ptr )
int opt_argc
The number of query arguments.
char** opt_argv
The query arguments.
char* optstring
The string containing valid options.
int* my_optind_ptr
A pointer to the index into the options of the option returned.
char** my_optarg_ptr
A pointer to the arguments to be returned.
Calls: strlen(), strncmp()
Called by: QC_new()modules/qc/query_command.c