1    | #ifndef READ_QUERY_COMMAND
2    | #define READ_QUERY_COMMAND
3    | 
4    | /***************************************
5    |   $Revision: 1.13 $
6    | 
7    |   Query command module (qc)
8    | 
9    |   Status: NOT REVUED, NOT TESTED
10   | 
11   |   ******************/ /******************
12   |   Copyright (c) 1999                              RIPE NCC
13   |  
14   |   All Rights Reserved
15   |   
16   |   Permission to use, copy, modify, and distribute this software and its
17   |   documentation for any purpose and without fee is hereby granted,
18   |   provided that the above copyright notice appear in all copies and that
19   |   both that copyright notice and this permission notice appear in
20   |   supporting documentation, and that the name of the author not be
21   |   used in advertising or publicity pertaining to distribution of the
22   |   software without specific, written prior permission.
23   |   
24   |   THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
25   |   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
26   |   AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
27   |   DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
28   |   AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
29   |   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
30   |   ***************************************/
31   | #define USAGE  "Usage: whois [-aFLmMrSvR] [-h hostname] [-s sources] [-T types] [-i attr] keys\n" \
32   | "whois -t type       whois -v type\n" \
33   | "\n"\
34   | "Where:\n"\
35   | "\n"\
36   | "-a                         search all databases\n"\
37   | "-F                         fast raw output\n"\
38   | "-h hostname                search alternate server\n"\
39   | "-i [attr][[,attr] ... ]    do an inverse lookup for specified attributes\n"\
40   | "-l                         ???\n"\
41   | "-L                         find all Less specific matches\n"\
42   | "-m                         find first level more specific matches\n"\
43   | "-M                         find all More specific matches\n"\
44   | "-r                         turn off recursive lookups\n"\
45   | "-s source[[,source] ... ]  search databases with source 'source'\n"\
46   | "-S                         tell server to leave out 'syntactic sugar'\n"\
47   | "-t type                    requests template for object of type 'type'\n"\
48   | "-v type                    requests verbose template for object of type 'type'\n"\
49   | "-R                         force to show local copy of the domain object even if it contains referral\n"\
50   | "-T type[[,type] ... ]      only look for objects of type 'type'\n"\
51   | "\n"\
52   | "Please note that most of these flags are NOT understood by\n"\
53   | "non RIPE whois servers\n\n"
54   | 
55   | #include <glib.h>
56   | #include "bitmask.h"
57   | #include "socket.h"
58   | 
59   | typedef struct Query_environ_t {
60   |   sk_conn_st   condat;
61   |   unsigned int k;
62   |   GList *sources_list;
63   |   char *version;
64   |   ip_addr_t pIP; /* passed IP */
65   | } Query_environ;
66   | 
67   | typedef struct Query_command_t {
68   |   unsigned int e;
69   |   unsigned int fast;
70   |   unsigned int g;
71   |   mask_t inv_attrs_bitmap;
72   |   unsigned int recursive;
73   |   unsigned int l;
74   |   unsigned int m;
75   |   unsigned int q;
76   |   unsigned int t;
77   |   unsigned int v;
78   |   unsigned int x;
79   |   unsigned int filtered;
80   |   unsigned int L;
81   |   unsigned int M;
82   |   unsigned int R;
83   |   unsigned int S;
84   |   mask_t object_type_bitmap;
85   |   mask_t keytypes_bitmap;
86   |   char *keys;
87   | } Query_command;
88   | 
89   | char *QC_bitmap_to_string(mask_t bitmap);
90   | char *QC_environ_to_string(Query_environ qe);
91   | char *QC_query_command_to_string(Query_command *query_command);
92   | void QC_environ_free(Query_environ *qe);
93   | void QC_free(Query_command *qc);
94   | Query_command *QC_new(char *query_str, Query_environ *qe);
95   | Query_environ *QC_environ_new(char *ip, unsigned sock);
96   | Query_environ *QC_environ_update(Query_command *qc, Query_environ *qe);
97   | 
98   | #endif /* READ_QUERY_COMMAND */