Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
904a5734
Commit
904a5734
authored
Mar 04, 1999
by
Bob Halley
Browse files
C++ compatibility
parent
e371b7a7
Changes
20
Hide whitespace changes
Inline
Side-by-side
bin/tests/wire_test.c
View file @
904a5734
...
...
@@ -158,7 +158,7 @@ static void
getquestions
(
isc_buffer_t
*
source
,
dns_namelist_t
*
section
,
unsigned
int
count
,
isc_buffer_t
*
target
)
{
unsigned
int
type
,
class
;
unsigned
int
type
,
rd
class
;
dns_name_t
*
name
,
*
curr
;
dns_rdatalist_t
*
rdatalist
;
isc_region_t
r
;
...
...
@@ -188,11 +188,11 @@ getquestions(isc_buffer_t *source, dns_namelist_t *section, unsigned int count,
if
(
name
!=
curr
)
ISC_LIST_APPEND
(
*
section
,
name
,
link
);
type
=
getshort
(
source
);
class
=
getshort
(
source
);
rd
class
=
getshort
(
source
);
for
(
rdatalist
=
ISC_LIST_HEAD
(
name
->
list
);
rdatalist
!=
NULL
;
rdatalist
=
ISC_LIST_NEXT
(
rdatalist
,
link
))
{
if
(
rdatalist
->
class
==
class
&&
if
(
rdatalist
->
rd
class
==
rd
class
&&
rdatalist
->
type
==
type
)
break
;
}
...
...
@@ -202,7 +202,7 @@ getquestions(isc_buffer_t *source, dns_namelist_t *section, unsigned int count,
exit
(
1
);
}
rdatalist
=
&
lists
[
rlcount
++
];
rdatalist
->
class
=
class
;
rdatalist
->
rd
class
=
rd
class
;
rdatalist
->
type
=
type
;
rdatalist
->
ttl
=
0
;
ISC_LIST_INIT
(
rdatalist
->
rdata
);
...
...
@@ -216,7 +216,7 @@ static void
getsection
(
isc_buffer_t
*
source
,
dns_namelist_t
*
section
,
unsigned
int
count
,
isc_buffer_t
*
target
)
{
unsigned
int
type
,
class
,
ttl
,
rdlength
;
unsigned
int
type
,
rd
class
,
ttl
,
rdlength
;
isc_region_t
r
;
dns_name_t
*
name
,
*
curr
;
dns_rdata_t
*
rdata
;
...
...
@@ -247,7 +247,7 @@ getsection(isc_buffer_t *source, dns_namelist_t *section, unsigned int count,
if
(
name
!=
curr
)
ISC_LIST_APPEND
(
*
section
,
name
,
link
);
type
=
getshort
(
source
);
class
=
getshort
(
source
);
rd
class
=
getshort
(
source
);
ttl
=
getshort
(
source
);
ttl
*=
65536
;
ttl
+=
getshort
(
source
);
...
...
@@ -264,7 +264,7 @@ getsection(isc_buffer_t *source, dns_namelist_t *section, unsigned int count,
}
rdata
=
&
rdatas
[
rdcount
++
];
dns_decompress_localinit
(
&
dctx
,
name
,
source
);
result
=
dns_rdata_fromwire
(
rdata
,
class
,
type
,
result
=
dns_rdata_fromwire
(
rdata
,
rd
class
,
type
,
source
,
&
dctx
,
ISC_FALSE
,
target
);
dns_decompress_localinvalidate
(
&
dctx
);
...
...
@@ -275,7 +275,7 @@ getsection(isc_buffer_t *source, dns_namelist_t *section, unsigned int count,
for
(
rdatalist
=
ISC_LIST_HEAD
(
name
->
list
);
rdatalist
!=
NULL
;
rdatalist
=
ISC_LIST_NEXT
(
rdatalist
,
link
))
{
if
(
rdatalist
->
class
==
class
&&
if
(
rdatalist
->
rd
class
==
rd
class
&&
rdatalist
->
type
==
type
)
break
;
}
...
...
@@ -285,7 +285,7 @@ getsection(isc_buffer_t *source, dns_namelist_t *section, unsigned int count,
exit
(
1
);
}
rdatalist
=
&
lists
[
rlcount
++
];
rdatalist
->
class
=
class
;
rdatalist
->
rd
class
=
rd
class
;
rdatalist
->
type
=
type
;
rdatalist
->
ttl
=
ttl
;
ISC_LIST_INIT
(
rdatalist
->
rdata
);
...
...
@@ -396,7 +396,7 @@ printquestions(dns_namelist_t *section) {
printf
(
"%.*s, class = "
,
(
int
)
target
.
used
,
(
char
*
)
target
.
base
);
isc_buffer_clear
(
&
target
);
result
=
dns_rdataclass_totext
(
rdatalist
->
class
,
result
=
dns_rdataclass_totext
(
rdatalist
->
rd
class
,
&
target
);
if
(
result
!=
DNS_R_SUCCESS
)
{
printf
(
"%s
\n
"
,
dns_result_totext
(
result
));
...
...
lib/dns/include/dns/callbacks.h
View file @
904a5734
...
...
@@ -23,8 +23,13 @@
***/
#include <stdio.h>
#include <isc/lang.h>
#include <dns/types.h>
#include <dns/result.h>
ISC_LANG_BEGINDECLS
/***
*** Types
...
...
@@ -60,4 +65,6 @@ void dns_rdatacallbacks_init(dns_rdatacallbacks_t *callbacks);
* 'callbacks' is a valid dns_rdatacallbacks_t,
*/
ISC_LANG_ENDDECLS
#endif
/* DNS_CALLBACKS_H */
lib/dns/include/dns/cert.h
View file @
904a5734
...
...
@@ -18,8 +18,12 @@
#ifndef DNS_CERT_H
#define DNS_CERT_H 1
#include <isc/lang.h>
#include <dns/types.h>
ISC_LANG_BEGINDECLS
dns_result_t
dns_cert_fromtext
(
dns_cert_t
*
certp
,
isc_textregion_t
*
source
);
/*
* Convert the text 'source' refers to into a certificate type.
...
...
@@ -52,4 +56,6 @@ dns_result_t dns_cert_totext(dns_cert_t cert, isc_buffer_t *target);
* DNS_R_NOSPACE target buffer is too small
*/
ISC_LANG_ENDDECLS
#endif
/* DNS_CERT_H */
lib/dns/include/dns/compress.h
View file @
904a5734
...
...
@@ -19,10 +19,13 @@
#define DNS_COMPRESS_H 1
#include <isc/mem.h>
#include <isc/lang.h>
#include <dns/types.h>
#include <dns/rbt.h>
ISC_LANG_BEGINDECLS
#define DNS_COMPRESS_NONE 0x00
/* no compression */
#define DNS_COMPRESS_GLOBAL14 0x01
/* "normal" compression. */
#define DNS_COMPRESS_GLOBAL16 0x02
/* 16-bit global comp. */
...
...
@@ -311,4 +314,6 @@ dns_decompress_strict(dns_decompress_t *dctx);
* 'dctx' to be initalised
*/
ISC_LANG_ENDDECLS
#endif
/* DNS_COMPRESS_H */
lib/dns/include/dns/master.h
View file @
904a5734
...
...
@@ -22,6 +22,7 @@
*** Imports
***/
#include <isc/lang.h>
#include <isc/mem.h>
#include <isc/lex.h>
...
...
@@ -31,6 +32,8 @@
#include <dns/rdataset.h>
#include <dns/callbacks.h>
ISC_LANG_BEGINDECLS
/***
*** Function
***/
...
...
@@ -78,4 +81,6 @@ dns_result_t dns_master_load(char *master_file,
* Any error code from callbacks->commit().
*/
ISC_LANG_ENDDECLS
#endif
/* DNS_MASTER_H */
lib/dns/include/dns/name.h
View file @
904a5734
...
...
@@ -74,10 +74,12 @@
#include <isc/boolean.h>
#include <isc/buffer.h>
#include <isc/lang.h>
#include <dns/types.h>
#include <dns/result.h>
ISC_LANG_BEGINDECLS
/*****
***** Labels
...
...
@@ -680,4 +682,6 @@ dns_result_t dns_name_concatenate(dns_name_t *prefix, dns_name_t *suffix,
* DNS_R_NOSPACE
*/
ISC_LANG_ENDDECLS
#endif
/* DNS_NAME_H */
lib/dns/include/dns/rbt.h
View file @
904a5734
...
...
@@ -17,12 +17,16 @@
#ifndef DNS_RBT_H
#define DNS_RBT_H 1
#include <isc/lang.h>
#include <isc/result.h>
#include <isc/mem.h>
#include <dns/types.h>
#include <dns/name.h>
ISC_LANG_BEGINDECLS
/*
* This is the structure that is used for each node in the red/black
* tree of trees. NOTE WELL: the implementation manages this as a variable
...
...
@@ -162,4 +166,6 @@ dns_result_t dns_rbt_create(isc_mem_t *mctx, void (*deleter)(void *, void *),
void
*
arg
,
dns_rbt_t
**
rbtp
);
void
dns_rbt_destroy
(
dns_rbt_t
**
rbtp
);
ISC_LANG_ENDDECLS
#endif
lib/dns/include/dns/rcode.h
View file @
904a5734
...
...
@@ -18,8 +18,12 @@
#ifndef DNS_RCODE_H
#define DNS_RCODE_H 1
#include <isc/lang.h>
#include <dns/types.h>
ISC_LANG_BEGINDECLS
dns_result_t
dns_rcode_fromtext
(
dns_rcode_t
*
rcodep
,
isc_textregion_t
*
source
);
/*
* Convert the text 'source' refers to into a DNS error value.
...
...
@@ -52,4 +56,6 @@ dns_result_t dns_rcode_totext(dns_rcode_t rcode, isc_buffer_t *target);
* DNS_R_NOSPACE target buffer is too small
*/
ISC_LANG_ENDDECLS
#endif
/* DNS_RCODE_H */
lib/dns/include/dns/rdata.h
View file @
904a5734
...
...
@@ -91,6 +91,7 @@
*** Imports
***/
#include <isc/lang.h>
#include <isc/lex.h>
#include <dns/types.h>
...
...
@@ -98,6 +99,8 @@
#include <dns/callbacks.h>
#include <dns/compress.h>
ISC_LANG_BEGINDECLS
/*****
***** RData
*****
...
...
@@ -373,4 +376,6 @@ dns_result_t dns_rdata_tostruct(dns_rdata_t *rdata, void *target);
* Success
*/
ISC_LANG_ENDDECLS
#endif
/* DNS_RDATA_H */
lib/dns/include/dns/rdataclass.h
View file @
904a5734
...
...
@@ -18,8 +18,12 @@
#ifndef DNS_RDATACLASS_H
#define DNS_RDATACLASS_H 1
#include <isc/lang.h>
#include <dns/types.h>
ISC_LANG_BEGINDECLS
dns_result_t
dns_rdataclass_fromtext
(
dns_rdataclass_t
*
classp
,
isc_textregion_t
*
source
);
/*
...
...
@@ -55,4 +59,6 @@ dns_result_t dns_rdataclass_totext(dns_rdataclass_t class,
* DNS_R_NOSPACE target buffer is too small
*/
ISC_LANG_ENDDECLS
#endif
/* DNS_RDATACLASS_H */
lib/dns/include/dns/rdatalist.h
View file @
904a5734
...
...
@@ -43,14 +43,18 @@
* None.
*/
#include <isc/lang.h>
#include <dns/types.h>
#include <dns/result.h>
ISC_LANG_BEGINDECLS
/*
* Clients may use this type directly.
*/
struct
dns_rdatalist
{
dns_rdataclass_t
class
;
dns_rdataclass_t
rd
class
;
dns_rdatatype_t
type
;
dns_ttl_t
ttl
;
ISC_LIST
(
dns_rdata_t
)
rdata
;
...
...
@@ -83,4 +87,6 @@ dns_rdatalist_tordataset(dns_rdatalist_t *rdatalist,
* DNS_R_SUCCESS
*/
ISC_LANG_ENDDECLS
#endif
/* DNS_RDATALIST_H */
lib/dns/include/dns/rdataset.h
View file @
904a5734
...
...
@@ -52,10 +52,13 @@
#include <isc/boolean.h>
#include <isc/buffer.h>
#include <isc/lang.h>
#include <dns/types.h>
#include <dns/result.h>
ISC_LANG_BEGINDECLS
typedef
struct
dns_rdatasetmethods
{
dns_result_t
(
*
disassociate
)(
dns_rdataset_t
*
rdataset
);
dns_result_t
(
*
first
)(
dns_rdataset_t
*
rdataset
);
...
...
@@ -84,7 +87,7 @@ struct dns_rdataset {
* Leaning towards the latter, since they are not frequently required
* once you have the rdataset.
*/
dns_rdataclass_t
class
;
dns_rdataclass_t
rd
class
;
dns_rdatatype_t
type
;
dns_ttl_t
ttl
;
/*
...
...
@@ -241,4 +244,6 @@ dns_rdataset_towire(dns_rdataset_t *rdataset,
* dns_name_towire().
*/
ISC_LANG_ENDDECLS
#endif
/* DNS_RDATASET_H */
lib/dns/include/dns/rdataslab.h
View file @
904a5734
...
...
@@ -48,10 +48,13 @@
***/
#include <isc/region.h>
#include <isc/lang.h>
#include <dns/types.h>
#include <dns/rdataset.h>
ISC_LANG_BEGINDECLS
/***
*** Functions
***/
...
...
@@ -89,4 +92,6 @@ dns_rdataslab_size(unsigned char *slab, unsigned int reservelen);
* The number of bytes in the slab, including the reservelen.
*/
ISC_LANG_ENDDECLS
#endif
/* DNS_RDATADLAB_H */
lib/dns/include/dns/rdatatype.h
View file @
904a5734
...
...
@@ -18,8 +18,12 @@
#ifndef DNS_RDATATYPE_H
#define DNS_RDATATYPE_H 1
#include <isc/lang.h>
#include <dns/types.h>
ISC_LANG_BEGINDECLS
dns_result_t
dns_rdatatype_fromtext
(
dns_rdatatype_t
*
typep
,
isc_textregion_t
*
source
);
/*
...
...
@@ -55,4 +59,6 @@ dns_result_t dns_rdatatype_totext(dns_rdatatype_t type,
* DNS_R_NOSPACE target buffer is too small
*/
ISC_LANG_ENDDECLS
#endif
/* DNS_RDATATYPE_H */
lib/dns/include/dns/result.h
View file @
904a5734
...
...
@@ -18,6 +18,10 @@
#ifndef DNS_RESULT_H
#define DNS_RESULT_H 1
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
typedef
unsigned
int
dns_result_t
;
#define DNS_R_SUCCESS 0
...
...
@@ -58,4 +62,6 @@ typedef unsigned int dns_result_t;
char
*
dns_result_totext
(
dns_result_t
);
ISC_LANG_ENDDECLS
#endif
/* DNS_RESULT_H */
lib/dns/include/dns/secalg.h
View file @
904a5734
...
...
@@ -18,8 +18,12 @@
#ifndef DNS_SECALG_H
#define DNS_SECALG_H 1
#include <isc/lang.h>
#include <dns/types.h>
ISC_LANG_BEGINDECLS
dns_result_t
dns_secalg_fromtext
(
dns_secalg_t
*
secalgp
,
isc_textregion_t
*
source
);
/*
...
...
@@ -54,4 +58,6 @@ dns_result_t dns_secalg_totext(dns_secalg_t secalg, isc_buffer_t *target);
* DNS_R_NOSPACE target buffer is too small
*/
ISC_LANG_ENDDECLS
#endif
/* DNS_SECALG_H */
lib/dns/include/dns/types.h
View file @
904a5734
...
...
@@ -26,10 +26,13 @@
* include the appropriate .h file too.
*/
#include <isc/lang.h>
#include <isc/region.h>
#include <isc/int.h>
#include <isc/list.h>
ISC_LANG_BEGINDECLS
typedef
isc_region_t
dns_label_t
;
typedef
struct
dns_name
dns_name_t
;
typedef
ISC_LIST
(
dns_name_t
)
dns_namelist_t
;
...
...
@@ -75,14 +78,14 @@ enum {
dns_rdatatype_none
=
0
,
TYPEENUM
dns_rdatatype_any
=
255
}
;
};
#include <dns/enumclass.h>
enum
{
CLASSENUM
dns_rdataclass_none
=
0
/* dns_rdataclass_any = 255 TSIG is class ANY specific */
}
;
};
enum
{
/* standard rcodes */
...
...
@@ -104,4 +107,6 @@ enum {
dns_rcode_badmode
=
19
};
ISC_LANG_ENDDECLS
#endif
/* DNS_TYPES_H */
lib/dns/master.c
View file @
904a5734
...
...
@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: master.c,v 1.1
1
1999/0
2/10 05:25:36 marka
Exp $ */
/* $Id: master.c,v 1.1
2
1999/0
3/04 02:47:18 halley
Exp $ */
#include <config.h>
...
...
@@ -91,7 +91,7 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
dns_rdataclass_t
zclass
,
int
*
soacount
,
int
*
nscount
,
dns_rdatacallbacks_t
*
callbacks
,
isc_mem_t
*
mctx
)
{
dns_rdataclass_t
class
;
dns_rdataclass_t
rd
class
;
dns_rdatatype_t
type
;
isc_uint32_t
ttl
=
0
;
isc_uint32_t
default_ttl
=
0
;
...
...
@@ -376,7 +376,7 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
}
type
=
0
;
class
=
0
;
rd
class
=
0
;
GETTOKEN
(
lex
,
ISC_LEXOPT_NUMBER
,
&
token
,
ISC_FALSE
);
...
...
@@ -409,7 +409,8 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
goto
cleanup
;
}
if
(
dns_rdataclass_fromtext
(
&
class
,
&
token
.
value
.
as_textregion
)
if
(
dns_rdataclass_fromtext
(
&
rdclass
,
&
token
.
value
.
as_textregion
)
==
DNS_R_SUCCESS
)
GETTOKEN
(
lex
,
0
,
&
token
,
ISC_FALSE
);
...
...
@@ -425,7 +426,7 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
if
(
result
!=
DNS_R_SUCCESS
)
goto
cleanup
;
if
(
class
!=
0
&&
class
!=
zclass
)
{
if
(
rd
class
!=
0
&&
rd
class
!=
zclass
)
{
char
buf1
[
32
];
char
buf2
[
32
];
unsigned
int
len1
,
len2
;
...
...
@@ -434,7 +435,7 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
isc_buffer_init
(
&
buffer
,
buf1
,
sizeof
buf1
,
ISC_BUFFERTYPE_TEXT
);
result
=
dns_rdataclass_totext
(
class
,
&
buffer
);
result
=
dns_rdataclass_totext
(
rd
class
,
&
buffer
);
if
(
result
!=
DNS_R_SUCCESS
)
{
UNEXPECTED_ERROR
(
__FILE__
,
__LINE__
,
"dns_rdataclass_totext() failed: %s"
,
...
...
@@ -446,7 +447,7 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
len1
=
region
.
length
;
isc_buffer_init
(
&
buffer
,
buf2
,
sizeof
buf2
,
ISC_BUFFERTYPE_TEXT
);
result
=
dns_rdataclass_totext
(
class
,
&
buffer
);
result
=
dns_rdataclass_totext
(
rd
class
,
&
buffer
);
if
(
result
!=
DNS_R_SUCCESS
)
{
UNEXPECTED_ERROR
(
__FILE__
,
__LINE__
,
"dns_rdataclass_totext() failed: %s"
,
...
...
@@ -506,7 +507,7 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
}
this
=
&
rdatalist
[
rdlcount
++
];
this
->
type
=
type
;
this
->
class
=
zclass
;
this
->
rd
class
=
zclass
;
this
->
ttl
=
ttl
;
ISC_LIST_INIT
(
this
->
rdata
);
ISC_LINK_INIT
(
this
,
link
);
...
...
@@ -534,7 +535,7 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
rdata_size
+=
512
;
rdata
=
new_rdata
;
}
result
=
dns_rdata_fromtext
(
&
rdata
[
rdcount
],
class
,
type
,
result
=
dns_rdata_fromtext
(
&
rdata
[
rdcount
],
rd
class
,
type
,
lex
,
&
origin_name
,
ISC_FALSE
,
&
target
,
callbacks
);
if
(
result
!=
DNS_R_SUCCESS
)
...
...
lib/dns/rdatalist.c
View file @
904a5734
...
...
@@ -48,7 +48,7 @@ dns_rdatalist_tordataset(dns_rdatalist_t *rdatalist,
REQUIRE
(
rdataset
->
methods
==
NULL
);
rdataset
->
methods
=
&
methods
;
rdataset
->
class
=
rdatalist
->
class
;
rdataset
->
rd
class
=
rdatalist
->
rd
class
;
rdataset
->
type
=
rdatalist
->
type
;
rdataset
->
ttl
=
rdatalist
->
ttl
;
rdataset
->
private1
=
rdatalist
;
...
...
lib/dns/rdataset.c
View file @
904a5734
...
...
@@ -40,7 +40,7 @@ dns_rdataset_init(dns_rdataset_t *rdataset) {
rdataset
->
magic
=
DNS_RDATASET_MAGIC
;
rdataset
->
methods
=
NULL
;
ISC_LINK_INIT
(
rdataset
,
link
);
rdataset
->
class
=
0
;
rdataset
->
rd
class
=
0
;
rdataset
->
type
=
0
;
rdataset
->
ttl
=
0
;
rdataset
->
private1
=
NULL
;
...
...
@@ -62,7 +62,7 @@ dns_rdataset_invalidate(dns_rdataset_t *rdataset) {
rdataset
->
magic
=
0
;
ISC_LINK_INIT
(
rdataset
,
link
);
rdataset
->
class
=
0
;
rdataset
->
rd
class
=
0
;
rdataset
->
type
=
0
;
rdataset
->
ttl
=
0
;
rdataset
->
private1
=
NULL
;
...
...
@@ -84,7 +84,7 @@ dns_rdataset_disassociate(dns_rdataset_t *rdataset) {
(
rdataset
->
methods
->
disassociate
)(
rdataset
);
rdataset
->
methods
=
NULL
;
ISC_LINK_INIT
(
rdataset
,
link
);
rdataset
->
class
=
0
;
rdataset
->
rd
class
=
0
;
rdataset
->
type
=
0
;
rdataset
->
ttl
=
0
;
rdataset
->
private1
=
NULL
;
...
...
@@ -212,7 +212,7 @@ dns_rdataset_totext(dns_rdataset_t *rdataset,
return
(
DNS_R_NOSPACE
);
memcpy
(
r
.
base
,
ttl
,
length
);
isc_buffer_add
(
target
,
length
);
result
=
dns_rdataclass_totext
(
rdataset
->
class
,
target
);
result
=
dns_rdataclass_totext
(
rdataset
->
rd
class
,
target
);
if
(
result
!=
DNS_R_SUCCESS
)
return
(
result
);
isc_buffer_available
(
target
,
&
r
);
...
...
@@ -312,7 +312,7 @@ dns_rdataset_towire(dns_rdataset_t *rdataset,
return
(
DNS_R_NOSPACE
);
}
isc_buffer_putuint16
(
target
,
rdataset
->
type
);
isc_buffer_putuint16
(
target
,
rdataset
->
class
);
isc_buffer_putuint16
(
target
,
rdataset
->
rd
class
);
isc_buffer_putuint32
(
target
,
rdataset
->
ttl
);
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment