Skip to content

Commit ab99ba7

Browse files
committed
Removed GETDNS_ prefix from constants, to match code
1 parent 0600f91 commit ab99ba7

File tree

3 files changed

+56
-56
lines changed

3 files changed

+56
-56
lines changed

doc/functions.rst

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ as its methods and attributes.
3333
3434
Specifies whether DNS queries are performed with
3535
nonrecursive lookups or as a stub resolver. The value is
36-
either ``getdns.GETDNS_RESOLUTION_RECURSING`` or
37-
``getdns.GETDNS_RESOLUTION_STUB``.
36+
either ``getdns.RESOLUTION_RECURSING`` or
37+
``getdns.RESOLUTION_STUB``.
3838

3939
If an implementation of this API is only able to act as a
4040
recursive resolver, setting `resolution_type`
41-
to ``getdns.GETDNS_RESOLUTION_STUB`` will throw an exception.
41+
to ``getdns.RESOLUTION_STUB`` will throw an exception.
4242

4343
.. py:attribute:: namespaces
4444
@@ -47,9 +47,9 @@ as its methods and attributes.
4747
setting is ignored for the getdns.general() function;
4848
it is used for the other
4949
functions.*) The allowed values are
50-
``getdns.GETDNS_NAMESPACE_DNS``, ``getdns.GETDNS_NAMESPACE_LOCALNAMES``,
51-
``getdns.GETDNS_NAMESPACE_NETBIOS``,
52-
``getdns.GETDNS_NAMESPACE_MDNS``, and ``getdns.GETDNS_NAMESPACE_NIS``. When a
50+
``getdns.NAMESPACE_DNS``, ``getdns.NAMESPACE_LOCALNAMES``,
51+
``getdns.NAMESPACE_NETBIOS``,
52+
``getdns.NAMESPACE_MDNS``, and ``getdns.NAMESPACE_NIS``. When a
5353
normal lookup is done, the API does the lookups in the
5454
order given and stops when it gets the first result; a
5555
different method with the same result would be to run the
@@ -62,9 +62,9 @@ as its methods and attributes.
6262
.. py:attribute:: dns_transport
6363
6464
Specifies what transport is used for DNS lookups. The
65-
value must be one of ``getdns.GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP``,
66-
``getdns.GETDNS_TRANSPORT_UDP_ONLY``, ``getdns.GETDNS_TRANSPORT_TCP_ONLY``, or
67-
``getdns.GETDNS_TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN``.
65+
value must be one of ``getdns.TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP``,
66+
``getdns.TRANSPORT_UDP_ONLY``, ``getdns.TRANSPORT_TCP_ONLY``, or
67+
``getdns.TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN``.
6868

6969
.. py:attribute:: limit_outstanding_queries
7070
@@ -77,9 +77,9 @@ as its methods and attributes.
7777
.. py:attribute:: follow_redirects
7878
7979
Specifies whether or not DNS queries follow
80-
redirects. The value must be one of ``getdns.GETDNS_REDIRECTS_FOLLOW`` for
80+
redirects. The value must be one of ``getdns.REDIRECTS_FOLLOW`` for
8181
normal following of redirects though CNAME and DNAME; or
82-
``getdns.GETDNS_REDIRECTS_DO_NOT_FOLLOW`` to cause any lookups that
82+
``getdns.REDIRECTS_DO_NOT_FOLLOW`` to cause any lookups that
8383
would have gone through CNAME and DNAME to return the
8484
CNAME or DNAME, not the eventual target.
8585

@@ -105,10 +105,10 @@ as its methods and attributes.
105105
Specifies whether to append a suffix to the query string
106106
before the API starts resolving a name. Its value must be
107107
one of
108-
``getdns.GETDNS_APPEND_NAME_ALWAYS``,
109-
``getdns.GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE``,
110-
``getdns.GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE``,
111-
or ``getdns.GETDNS_APPEND_NAME_NEVER``. This controls whether or not
108+
``getdns.APPEND_NAME_ALWAYS``,
109+
``getdns.APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE``,
110+
``getdns.APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE``,
111+
or ``getdns.APPEND_NAME_NEVER``. This controls whether or not
112112
to append the suffix given by :attr:`suffix`.
113113

114114
.. py:attribute:: suffix
@@ -253,7 +253,7 @@ Extensions are Python dictionaries, with the keys being the names of the
253253
extensions. The definition of each extension describes the values that
254254
may be assigned to that extension. For most extensions it is a Boolean,
255255
and since the default value is "False" it will most often take the value
256-
``getdns.GETDNS_EXTENSION_TRUE``.
256+
``getdns.EXTENSION_TRUE``.
257257

258258
The extensions currently supported by :py:mod:`getdns` are:
259259

@@ -279,30 +279,30 @@ a few circumstances.
279279
To return the DNSSEC status for each DNS record in the
280280
``replies_tree`` list, use the ``dnssec_return_status``
281281
extension. Set the extension's value to
282-
``getdns.GETDNS_EXTENSION_TRUE`` to cause the returned status to have
282+
``getdns.EXTENSION_TRUE`` to cause the returned status to have
283283
the name ``dnssec_status`` added to the other names in
284284
the record's dictionary ("header", "question", and so on). The
285-
potential values for that name are ``getdns.GETDNS_DNSSEC_SECURE``,
286-
``getdns.GETDNS_DNSSEC_BOGUS``, ``getdns.GETDNS_DNSSEC_INDETERMINATE``, and
287-
``getdns.GETDNS_DNSSEC_INSECURE``.
285+
potential values for that name are ``getdns.DNSSEC_SECURE``,
286+
``getdns.DNSSEC_BOGUS``, ``getdns.DNSSEC_INDETERMINATE``, and
287+
``getdns.DNSSEC_INSECURE``.
288288

289289
If instead of returning the status, you want to only see
290290
secure results, use the ``dnssec_return_only_secure``
291291
extension. The extension's value is set to
292-
``getdns.GETDNS_EXTENSION_TRUE`` to cause only records that the API can
292+
``getdns.EXTENSION_TRUE`` to cause only records that the API can
293293
validate as secure with DNSSEC to be returned in the
294294
``replies_tree`` and ``replies_full lists``. No additional names are
295295
added to the dict of the record; the change is that some
296296
records might not appear in the results. When this context
297297
option is set, if the API receives DNS replies but none are
298298
determined to be secure, the error code at the top level of
299-
the ``response`` object is ``getdns.GETDNS_RESPSTATUS_NO_SECURE_ANSWERS``.
299+
the ``response`` object is ``getdns.RESPSTATUS_NO_SECURE_ANSWERS``.
300300

301301
Applications that want to do their own validation will want
302302
to have the DNSSEC-related records for a particular
303303
response. Use the ``dnssec_return_validation_chain``
304304
extension. Set the extension's value to
305-
``getdns.GETDNS_EXTENSION_TRUE`` to cause a set of additional
305+
``getdns.EXTENSION_TRUE`` to cause a set of additional
306306
DNSSEC-related records needed for validation to be returned
307307
in the ``response object``. This set comes as ``validation_chain``
308308
(a list) at the top level of the ``response`` object. This list
@@ -315,7 +315,7 @@ set, and that request also has any of the
315315
``dnssec_return_status``, ``dnssec_return_only_secure``, or
316316
``dnssec_return_validation_chain`` extensions specified, the API
317317
will not perform the request and will instead return an
318-
error of ``getdns.GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED``.
318+
error of ``getdns.RETURN_DNSSEC_WITH_STUB_DISALLOWED``.
319319

320320
Returning both IPv4 and IPv6 responses
321321
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -327,7 +327,7 @@ method is able to do this automatically. If you are
327327
using the :meth:`general` method,
328328
you can enable this with the ``return_both_v4_and_v6``
329329
extension. The extension's value must be set to
330-
``getdns.GETDNS_EXTENSION_TRUE`` to cause the results to be the lookup
330+
``getdns.EXTENSION_TRUE`` to cause the results to be the lookup
331331
of either A or AAAA records to include any A and AAAA
332332
records for the queried name (otherwise, the extension does
333333
nothing). These results are expected to be usable with Happy
@@ -370,20 +370,20 @@ Getting Warnings for Responses that Violate the DNS Standard
370370
To receive a warning if a particular response violates some
371371
parts of the DNS standard, use the ``add_warning_for_bad_dns``
372372
extension. The extension's value is set to
373-
``getdns.GETDNS_EXTENSION_TRUE`` to cause each reply in the
373+
``getdns.EXTENSION_TRUE`` to cause each reply in the
374374
``replies_tree`` to contain an additional name, ``bad_dns`` (a
375375
list). The list is zero or more values that indicate types of
376376
bad DNS found in that reply. The list of values is:
377377

378-
.. py:data:: GETDNS_BAD_DNS_CNAME_IN_TARGET
378+
.. py:data:: BAD_DNS_CNAME_IN_TARGET
379379
380380
A DNS query type that does not allow a target to be a CNAME pointed to a CNAME
381381

382-
.. py:data:: GETDNS_BAD_DNS_ALL_NUMERIC_LABEL
382+
.. py:data:: BAD_DNS_ALL_NUMERIC_LABEL
383383
384384
One or more labels in a returned domain name is all-numeric; this is not legal for a hostname
385385

386-
.. py:data:: GETDNS_BAD_DNS_CNAME_RETURNED_FOR_OTHER_TYPE
386+
.. py:data:: BAD_DNS_CNAME_RETURNED_FOR_OTHER_TYPE
387387
388388
A DNS query for a type other than CNAME returned a CNAME response
389389

@@ -403,7 +403,7 @@ An application might want to see debugging information for
403403
queries, such as the length of time it takes for each query
404404
to return to the API. Use the ``return_call_debugging``
405405
extension. The extension's value is set to
406-
``getdns.GETDNS_EXTENSION_TRUE`` to add the name ``call_debugging`` (a
406+
``getdns.EXTENSION_TRUE`` to add the name ``call_debugging`` (a
407407
list) to the top level of the ``response`` object. Each member
408408
of the list is a dict that represents one call made for the
409409
call to the API. Each member has the following names:
@@ -414,7 +414,7 @@ call to the API. Each member has the following names:
414414
* ``start_time`` is the time the query started in milliseconds since the epoch, represented as an integer
415415
* ``end_time`` is the time the query was received in milliseconds since the epoch, represented as an integer
416416
* ``entire_reply`` is the entire response received
417-
* ``dnssec_result`` is the DNSSEC status, or ``getdns.GETDNS_DNSSEC_NOT_PERFORMED`` if DNSSEC validation was not performed
417+
* ``dnssec_result`` is the DNSSEC status, or ``getdns.DNSSEC_NOT_PERFORMED`` if DNSSEC validation was not performed
418418

419419

420420
Asynchronous queries
@@ -478,12 +478,12 @@ This is an example callback function:
478478
def cbk(type, result, userarg, tid):
479479
if type == getdns.CALLBACK_COMPLETE:
480480
status = result.status
481-
if status == getdns.GETDNS_RESPSTATUS_GOOD:
481+
if status == getdns.RESPSTATUS_GOOD:
482482
for addr in result.just_address_answers:
483483
addr_type = addr['address_type']
484484
addr_data = addr['address_data']
485485
print '{0}: {1} {2}'.format(userarg, addr_type, addr_data)
486-
elif status == getdns.GETDNS_RESPSTATUS_NO_SECURE_ANSWERS:
486+
elif status == getdns.RESPSTATUS_NO_SECURE_ANSWERS:
487487
print "{0}: No DNSSEC secured responses found".format(hostname)
488488
else:
489489
print "{0}: getdns.address() returned error: {1}".format(hostname, status)
@@ -508,7 +508,7 @@ At the present time we support one utility method.
508508

509509
.. code-block:: python
510510
511-
if results.replies_full['status'] != getdns.GETDNS_RESPSTATUS_GOOD:
511+
if results.replies_full['status'] != getdns.RESPSTATUS_GOOD:
512512
print(getdns.get_errorstr_by_id(id=results.replies_full['status'])
513513
sys.exit(1)
514514

doc/index.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ results to the screen:
106106
107107
ctx = getdns.Context()
108108
extensions = { "return_both_v4_and_v6" :
109-
getdns.GETDNS_EXTENSION_TRUE }
109+
getdns.EXTENSION_TRUE }
110110
results = ctx.address(name=sys.argv[1],
111111
extensions=extensions)
112112
if results.status == getdns.RESPSTATUS_GOOD:
@@ -131,11 +131,11 @@ In this example, we do a DNSSEC query and check the response:
131131
import getdns, sys
132132
133133
dnssec_status = {
134-
"GETDNS_DNSSEC_SECURE" : 400,
135-
"GETDNS_DNSSEC_BOGUS" : 401,
136-
"GETDNS_DNSSEC_INDETERINATE" : 402,
137-
"GETDNS_DNSSEC_INSECURE" : 403,
138-
"GETDNS_DNSSEC_NOT_PERFORMED" : 404
134+
"DNSSEC_SECURE" : 400,
135+
"DNSSEC_BOGUS" : 401,
136+
"DNSSEC_INDETERINATE" : 402,
137+
"DNSSEC_INSECURE" : 403,
138+
"DNSSEC_NOT_PERFORMED" : 404
139139
}
140140
141141

doc/response.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ Response data from queries
222222
}
223223
],
224224
"canonical_name": <bindata of "www.example.com">,
225-
"answer_type": GETDNS_NAMETYPE_DNS,
225+
"answer_type": NAMETYPE_DNS,
226226
"intermediate_aliases": [],
227227
"replies_tree":
228228
[
@@ -259,7 +259,7 @@ Response data from queries
259259
]
260260
"additional": [],
261261
"canonical_name": <bindata of "www.example.com">,
262-
"answer_type": GETDNS_NAMETYPE_DNS
262+
"answer_type": NAMETYPE_DNS
263263
},
264264
{ # This is the second reply
265265
"header": { "id": 47809, "qr": 1, "opcode": 0, ... },
@@ -291,58 +291,58 @@ Return Codes
291291
------------
292292
The return codes for all the functions are:
293293

294-
.. py:data:: GETDNS_RETURN_GOOD
294+
.. py:data:: RETURN_GOOD
295295
296296
Good
297297

298-
.. py:data:: GETDNS_RETURN_GENERIC_ERROR
298+
.. py:data:: RETURN_GENERIC_ERROR
299299
300300
Generic error
301301

302-
.. py:data:: GETDNS_RETURN_BAD_DOMAIN_NAME
302+
.. py:data:: RETURN_BAD_DOMAIN_NAME
303303
304304
Badly-formed domain name in first argument
305305

306-
.. py:data:: GETDNS_RETURN_BAD_CONTEXT
306+
.. py:data:: RETURN_BAD_CONTEXT
307307
308308
The context has internal deficiencies
309309

310-
.. py:data:: GETDNS_RETURN_CONTEXT_UPDATE_FAIL
310+
.. py:data:: RETURN_CONTEXT_UPDATE_FAIL
311311
312312
Did not update the context
313313

314-
.. py:data:: GETDNS_RETURN_UNKNOWN_TRANSACTION
314+
.. py:data:: RETURN_UNKNOWN_TRANSACTION
315315
316316
An attempt was made to cancel a callback with a transaction_id that is not recognized
317317

318-
.. py:data:: GETDNS_RETURN_NO_SUCH_LIST_ITEM
318+
.. py:data:: RETURN_NO_SUCH_LIST_ITEM
319319
320320
A helper function for lists had an index argument that was too high.
321321

322-
.. py:data:: GETDNS_RETURN_NO_SUCH_DICT_NAME
322+
.. py:data:: RETURN_NO_SUCH_DICT_NAME
323323
324324
A helper function for dicts had a name argument that for a name that is not in the dict.
325325

326-
.. py:data:: GETDNS_RETURN_WRONG_TYPE_REQUESTED
326+
.. py:data:: RETURN_WRONG_TYPE_REQUESTED
327327
328328
A helper function was supposed to return a certain type for an item, but the wrong type was given.
329329

330-
.. py:data:: GETDNS_RETURN_NO_SUCH_EXTENSION
330+
.. py:data:: RETURN_NO_SUCH_EXTENSION
331331
332332
A name in the extensions dict is not a valid extension.
333333

334-
.. py:data:: GETDNS_RETURN_EXTENSION_MISFORMAT
334+
.. py:data:: RETURN_EXTENSION_MISFORMAT
335335
336336
One or more of the extensions have a bad format.
337337

338-
.. py:data:: GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED
338+
.. py:data:: RETURN_DNSSEC_WITH_STUB_DISALLOWED
339339
340340
A query was made with a context that is using stub resolution and a DNSSEC extension specified.
341341

342-
.. py:data:: GETDNS_RETURN_MEMORY_ERROR
342+
.. py:data:: RETURN_MEMORY_ERROR
343343
344344
Unable to allocate the memory required.
345345

346-
.. py:data:: GETDNS_RETURN_INVALID_PARAMETER
346+
.. py:data:: RETURN_INVALID_PARAMETER
347347
348348
A required parameter had an invalid value.

0 commit comments

Comments
 (0)