modules/qc/query_command.h
/* [<][>][^][v][top][bottom][index][help] */
FUNCTIONS
This source file includes following functions.
1 #ifndef READ_QUERY_COMMAND
2 #define READ_QUERY_COMMAND
3
4 /***************************************
5 $Revision: 1.17 $
6
7 Query command module (qc)
8
9 Status: NOT REVUED, 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
60 typedef enum {
61 QC_EMPTY,
62 QC_ERROR,
63 QC_NOKEY,
64 QC_TEMPLATE,
65 QC_HELP,
66 QC_REAL,
67 QC_FILTERED,
68
69 QC_TYPE_MAX
70 } qc_qtype_t;
71 /* now this must be sync'ed with that: */
72 #ifdef QC_IMPL
73 char *qrytype_str[] = {
74 "EMPTY",
75 "SYNTAX ERROR",
76 "NO KEY",
77 "TEMPLATE",
78 "HELP",
79 "REAL",
80 "FILTERED"
81 };
82 #endif
83
84
85 typedef struct Query_environ_t {
86 sk_conn_st condat;
87 unsigned int k;
88 GList *sources_list;
89 char *version;
90 ip_addr_t pIP; /* passed IP */
91 } Query_environ;
92
93 typedef struct Query_command_t {
94 qc_qtype_t query_type;
95 int e;
96 int fast;
97 int g;
98 mask_t inv_attrs_bitmap;
99 int recursive;
100 int l;
101 int m;
102 int q;
103 int t;
104 int v;
105 int x;
106 int filtered;
107 int L;
108 int M;
109 int R;
110 int S;
111 mask_t object_type_bitmap;
112 mask_t keytypes_bitmap;
113 char *keys;
114 } Query_command;
115
116 char *QC_bitmap_to_string(mask_t bitmap);
117 char *QC_environ_to_string(Query_environ qe);
118 char *QC_query_command_to_string(Query_command *query_command);
119 void QC_environ_free(Query_environ *qe);
120 void QC_free(Query_command *qc);
121 Query_command *QC_create(char *query_str, Query_environ *qe);
122 Query_environ *QC_environ_new(char *ip, unsigned sock);
123 Query_environ *QC_environ_update(Query_command *qc, Query_environ *qe);
124 char *QC_get_qrytype(qc_qtype_t qrytype);
125 #endif /* READ_QUERY_COMMAND */