Skip to content

Commit 5eacedf

Browse files
committed
Conditionalized in features new in 0.5.0
1 parent 4b93c4c commit 5eacedf

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

context.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ context_set_tls_authentication(getdns_context *context, PyObject *py_value)
492492
}
493493

494494

495+
#if GETDNS_NUMERIC_VERSION > 0x00050000
495496
int
496497
context_set_tls_query_padding_blocksize(getdns_context *context, PyObject *py_value)
497498
{
@@ -521,8 +522,9 @@ context_set_tls_query_padding_blocksize(getdns_context *context, PyObject *py_va
521522
}
522523
return 0;
523524
}
525+
#endif
524526

525-
527+
#if GETDNS_NUMERIC_VERSION > 0x00050000
526528
int
527529
context_set_edns_client_subnet_private(getdns_context *context, PyObject *py_value)
528530
{
@@ -556,7 +558,7 @@ context_set_edns_client_subnet_private(getdns_context *context, PyObject *py_val
556558
}
557559
return 0;
558560
}
559-
561+
#endif
560562

561563
int
562564
context_set_edns_version(getdns_context *context, PyObject *py_value)
@@ -1055,6 +1057,7 @@ context_getattro(PyObject *self, PyObject *nameobj)
10551057
return PyInt_FromLong(limit_outstanding_queries);
10561058
#endif
10571059
}
1060+
#if GETDNS_NUMERIC_VERSION > 0x00050000
10581061
if (!strncmp(attrname, "tls_query_padding_blocksize", strlen("tls_query_padding_blocksize"))) {
10591062
uint16_t tls_query_padding_blocksize;
10601063
if ((ret = getdns_context_get_tls_query_padding_blocksize(context, &tls_query_padding_blocksize)) !=
@@ -1068,6 +1071,8 @@ context_getattro(PyObject *self, PyObject *nameobj)
10681071
return PyInt_FromLong((long)tls_query_padding_blocksize);
10691072
#endif
10701073
}
1074+
#endif
1075+
#if GETDNS_NUMERIC_VERSION > 0x00050000
10711076
if (!strncmp(attrname, "edns_client_subnet_private", strlen("edns_client_subnet_private"))) {
10721077
uint8_t edns_client_subnet_private;
10731078
if ((ret = getdns_context_get_edns_client_subnet_private(context, &edns_client_subnet_private)) !=
@@ -1081,6 +1086,8 @@ context_getattro(PyObject *self, PyObject *nameobj)
10811086
return PyInt_FromLong((long)edns_client_subnet_private);
10821087
#endif
10831088
}
1089+
#endif
1090+
#if GETDNS_NUMERIC_VERSION > 0x00050000
10841091
if (!strncmp(attrname, "tls_authentication", strlen("tls_authentication"))) {
10851092
getdns_tls_authentication_t value;
10861093
if ((ret = getdns_context_get_tls_authentication(context, &value)) !=
@@ -1094,6 +1101,7 @@ context_getattro(PyObject *self, PyObject *nameobj)
10941101
return PyInt_FromLong((long)value);
10951102
#endif
10961103
}
1104+
#endif
10971105
if (!strncmp(attrname, "follow_redirects", strlen("follow_redirects"))) {
10981106
uint32_t follow_redirects;
10991107
if ((ret = getdns_dict_get_int(all_context, "follow_redirects",
@@ -1232,7 +1240,9 @@ struct setter_table setters[] = {
12321240
{ "dnssec_allowed_skew", context_set_dnssec_allowed_skew },
12331241
{ "dns_root_servers", context_set_dns_root_servers },
12341242
{ "dns_transport_list", context_set_dns_transport_list },
1243+
#if GETDNS_NUMERIC_VERSION > 0x00050000
12351244
{ "edns_client_subnet_private", context_set_edns_client_subnet_private },
1245+
#endif
12361246
{ "edns_do_bit", context_set_edns_do_bit },
12371247
{ "edns_extended_rcode", context_set_edns_extended_rcode },
12381248
{ "edns_maximum_udp_payload_size", context_set_edns_maximum_udp_payload_size },
@@ -1245,7 +1255,9 @@ struct setter_table setters[] = {
12451255
{ "suffix", context_set_suffix },
12461256
{ "timeout", context_set_timeout },
12471257
{ "tls_authentication", context_set_tls_authentication },
1258+
#if GETDNS_NUMERIC_VERSION > 0x00050000
12481259
{ "tls_query_padding_blocksize", context_set_tls_query_padding_blocksize },
1260+
#endif
12491261
{ "upstream_recursive_servers", context_set_upstream_recursive_servers },
12501262
};
12511263

getdns.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,12 @@ PyMemberDef Context_members[] = {
214214
{"idle_timeout", T_INT, offsetof(getdns_ContextObject, idle_timeout), 0, "TCP idle timeout" },
215215
{"tls_authentication", T_INT, offsetof(getdns_ContextObject, tls_authentication), 0,
216216
"TLS authentication basis" },
217+
#if GETDNS_NUMERIC_VERSION > 0x00050000
217218
{"tls_query_padding_blocksize", T_INT, offsetof(getdns_ContextObject, tls_query_padding_blocksize),
218219
0, "padding blocksize" },
219220
{ "edns_client_subnet_private", T_INT, offsetof(getdns_ContextObject, edns_client_subnet_private), 0,
220221
"ask upstreams not to reveal query's originating network" },
222+
#endif
221223
{ NULL }
222224
};
223225

pygetdns.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ typedef struct {
9797
char *implementation_string;
9898
char *version_string;
9999
uint16_t tls_authentication;
100+
#if GETDNS_NUMERIC_VERSION > 0x00050000
100101
uint16_t tls_query_padding_blocksize;
101102
uint8_t edns_client_subnet_private;
103+
#endif
102104
} getdns_ContextObject;
103105

104106
struct setter_table { /* we're now using bsearch to find */

0 commit comments

Comments
 (0)