* the java.nio.Buffer interface.
*/
-#ifndef _LDNS_BUFFER_H_
-#define _LDNS_BUFFER_H_
+#ifndef LDNS_BUFFER_H
+#define LDNS_BUFFER_H
#include <assert.h>
#include <stdarg.h>
*/
void *ldns_buffer_export(ldns_buffer *buffer);
-#endif /* _LDNS_BUFFER_H_ */
+#endif /* LDNS_BUFFER_H */
* See the file LICENSE for the license
*/
-#ifndef _LDNS_COMMON_H
-#define _LDNS_COMMON_H
+#ifndef LDNS_COMMON_H
+#define LDNS_COMMON_H
#if !defined(__cplusplus) && !defined(__bool_true_false_are_defined)
#define ATTR_UNUSED(x) x
#endif /* !HAVE_ATTR_UNUSED */
-#endif /* !_LDNS_COMMON_H */
+#endif /* LDNS_COMMON_H */
* See the file LICENSE for the license
*/
-#ifndef _LDNS_DNAME_H
-#define _LDNS_DNAME_H
+#ifndef LDNS_DNAME_H
+#define LDNS_DNAME_H
#include <ldns/common.h>
#include <ldns/rdata.h>
*/
ldns_rdf * ldns_dname_label(const ldns_rdf *rdf, uint8_t labelpos);
-#endif /* !_LDNS_DNAME_H */
+#endif /* LDNS_DNAME_H */
* A bunch of defines that are used in the DNS.
*/
-#ifndef _LDNS_DNS_H_
-#define _LDNS_DNS_H_
+#ifndef LDNS_DNS_H
+#define LDNS_DNS_H
#include <stdio.h>
extern ldns_lookup_table ldns_opcodes[];
extern ldns_lookup_table ldns_edns_flags[];
-#endif /* _LDNS_DNS_H_ */
+#endif /* LDNS_DNS_H */
* A bunch of defines that are used in the DNS
*/
-#ifndef _LDNS_DNSSEC_H_
-#define _LDNS_DNSSEC_H_
+#ifndef LDNS_DNSSEC_H
+#define LDNS_DNSSEC_H
#ifdef HAVE_SSL
#include <openssl/ssl.h>
ldns_rdf *ldns_sign_public_dsa(ldns_buffer *to_sign, DSA *key);
ldns_rdf *ldns_sign_public_rsamd5(ldns_buffer *to_sign, RSA *key);
ldns_rdf *ldns_sign_public_rsasha1(ldns_buffer *to_sign, RSA *key);
-ldns_rdf *ldns_sign_public_dsa(ldns_buffer *to_sign, DSA *key);
#endif /* HAVE_SSL */
/**
*/
ldns_status ldns_init_random(FILE *fd, uint16_t bytes);
-#endif /* _LDNS_DNSSEC_H_ */
+#endif /* LDNS_DNSSEC_H */
* See the file LICENSE for the license
*/
-#ifndef _LDNS_ERROR_H
-#define _LDNS_ERROR_H
+#ifndef LDNS_ERROR_H
+#define LDNS_ERROR_H
#include <ldns/util.h>
*/
const char *ldns_get_errorstr_by_id(ldns_status err);
-#endif /* _LDNS_ERROR_H */
+#endif /* LDNS_ERROR_H */
* See the file LICENSE for the license
*/
-#ifndef _LDNS_HIGHER_H
-#define _LDNS_HIGHER_H
+#ifndef LDNS_HIGHER_H
+#define LDNS_HIGHER_H
#include <ldns/resolver.h>
#include <ldns/rdata.h>
*/
void ldns_print_rr_rdf(FILE *fp, ldns_rr *r, int rdfnum, ...);
-#endif /* _LDNS_HIGHER_H */
+#endif /* LDNS_HIGHER_H */
* See the file LICENSE for the license
*/
-#ifndef _LDNS_HOST2STR_H
-#define _LDNS_HOST2STR_H
+#ifndef LDNS_HOST2STR_H
+#define LDNS_HOST2STR_H
#include <ldns/common.h>
#include <ldns/error.h>
ldns_status ldns_rdf2buffer_str_dname(ldns_buffer *output, ldns_rdf *dname);
-#endif
+#endif /* LDNS_HOST2STR_H */
* See the file LICENSE for the license
*/
-#ifndef _LDNS_HOST2WIRE_H
-#define _LDNS_HOST2WIRE_H
+#ifndef LDNS_HOST2WIRE_H
+#define LDNS_HOST2WIRE_H
#include <ldns/common.h>
#include <ldns/error.h>
*/
ldns_status ldns_pkt2wire(uint8_t **dest, const ldns_pkt *p, size_t *size);
-#endif
+#endif /* LDNS_HOST2WIRE_H */
* See the file LICENSE for the license
*/
-#ifndef _LDNS_KEYS_H
-#define _LDNS_KEYS_H
+#ifndef LDNS_KEYS_H
+#define LDNS_KEYS_H
#ifdef HAVE_SSL
#include <openssl/ssl.h>
*/
void ldns_key_list_free(ldns_key_list *key_list);
-#endif /* _LDNS_KEYS_H */
+#endif /* LDNS_KEYS_H */
* See the file LICENSE for the license
*/
-#ifndef _LDNS_NET_H
-#define _LDNS_NET_H
+#ifndef LDNS_NET_H
+#define LDNS_NET_H
#include <ldns/packet.h>
#include <ldns/buffer.h>
*/
ldns_status ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class c);
-#endif /* !_LDNS_NET_H */
+#endif /* LDNS_NET_H */
* See the file LICENSE for the license
*/
-#ifndef _LDNS_PACKET_H
-#define _LDNS_PACKET_H
+#ifndef LDNS_PACKET_H
+#define LDNS_PACKET_H
#define LDNS_MAX_PACKETLEN 65535
bool ldns_pkt_insert_rr(ldns_pkt *p, ldns_rr *rr, uint16_t n);
-#endif /* !_LDNS_PACKET_H */
+#endif /* LDNS_PACKET_H */
* See the file LICENSE for the license
*/
-#ifndef _LDNS_PARSE_H_
-#define _LDNS_PARSE_H_
+#ifndef LDNS_PARSE_H
+#define LDNS_PARSE_H
#include <ldns/common.h>
#include <ldns/buffer.h>
*/
void ldns_fskipcs_l(FILE *fp, const char *s, int *line_nr);
-#endif /* _LDNS_PARSE_H */
+#endif /* LDNS_PARSE_H */
* See the file LICENSE for the license
*/
-#ifndef _LDNS_RDATA_H
-#define _LDNS_RDATA_H
+#ifndef LDNS_RDATA_H
+#define LDNS_RDATA_H
#include <ldns/common.h>
#include <ldns/error.h>
*/
int ldns_rdf_compare(const ldns_rdf *rd1, const ldns_rdf *rd2);
-#endif /* !_LDNS_RDATA_H */
+#endif /* LDNS_RDATA_H */
* See the file LICENSE for the license
*/
-#ifndef _LDNS_RESOLVER_H
-#define _LDNS_RESOLVER_H
+#ifndef LDNS_RESOLVER_H
+#define LDNS_RESOLVER_H
#include <ldns/error.h>
#include <ldns/common.h>
*/
ldns_resolver * ldns_update_resolver_new(const char *fqdn, const char *zone, ldns_rr_class clas, ldns_tsig_credentials *tsig_cred, ldns_rdf **zone_rdf);
-#endif /* !_LDNS_RESOLVER_H */
+#endif /* LDNS_RESOLVER_H */
* See the file LICENSE for the license
*/
-#ifndef _LDNS_RR_H
-#define _LDNS_RR_H
+#ifndef LDNS_RR_H
+#define LDNS_RR_H
#include <ldns/common.h>
#include <ldns/rdata.h>
/* TODO document or delete it */
bool ldns_rr_list_insert_rr(ldns_rr_list *rr_list, ldns_rr *r, size_t count);
-#endif /* _LDNS_RR_H */
+#endif /* LDNS_RR_H */
*
* See the file LICENSE for the license
*/
-#ifndef _LDNS_RR_FUNCTIONS_H
-#define _LDNS_RR_FUNCTIONS_H
+#ifndef LDNS_RR_FUNCTIONS_H
+#define LDNS_RR_FUNCTIONS_H
/* set rdf's at a specific offset
*/
uint16_t ldns_rr_dnskey_key_size(ldns_rr *key);
-#endif /* _LDNS_RR_FUNCTIONS_H */
+#endif /* LDNS_RR_FUNCTIONS_H */
* See the file LICENSE for the license
*/
-#ifndef _LDNS_2HOST_H
-#define _LDNS_2HOST_H
+#ifndef LDNS_2HOST_H
+#define LDNS_2HOST_H
#include <ldns/common.h>
#include <ldns/error.h>
*/
ldns_status ldns_str2rdf_dname(ldns_rdf **rd, const char *str);
-#endif /* _LDNS_2HOST_H */
+#endif /* LDNS_2HOST_H */
* See LICENSE for the license.
*/
-#ifndef _LDNS_TSIG_H_
-#define _LDNS_TSIG_H_
+#ifndef LDNS_TSIG_H
+#define LDNS_TSIG_H
-typedef struct _ldns_tsig_credentials
+typedef struct ldns_tsig_credentials_struct
{
char *algorithm;
char *keyname;
*/
ldns_status ldns_pkt_tsig_sign(ldns_pkt *pkt, const char *key_name, const char *key_data, uint16_t fudge, const char *algorithm_name, ldns_rdf *query_mac);
-#endif /* _LDNS_TSIG_H_ */
+#endif /* LDNS_TSIG_H */
* See LICENSE for the license.
*/
-#ifndef _LDNS_UPDATE_H
-#define _LDNS_UPDATE_H
+#ifndef LDNS_UPDATE_H
+#define LDNS_UPDATE_H
#include <ldns/resolver.h>
ldns_status ldns_update_soa_zone_mname(const char *fqdn, ldns_resolver *r, ldns_rr_class class, ldns_rdf **zone_rdf, ldns_rdf **mname_rdf);
-#endif /* !_LDNS_UPDATE_H */
+#endif /* LDNS_UPDATE_H */
*/
-#ifndef _LDNS_WIRE2HOST_H
-#define _LDNS_WIRE2HOST_H
+#ifndef LDNS_WIRE2HOST_H
+#define LDNS_WIRE2HOST_H
#include <ldns/rdata.h>
#include <ldns/common.h>
*/
ldns_status ldns_wire2rr(ldns_rr **rr, const uint8_t *wire, size_t max, size_t *pos, ldns_pkt_section section);
-#endif /* _LDNS_WIRE2HOST_H */
+#endif /* LDNS_WIRE2HOST_H */
* See the file LICENSE for the license
*/
-#ifndef _LDNS_ZONE_H
-#define _LDNS_ZONE_H
+#ifndef LDNS_ZONE_H
+#define LDNS_ZONE_H
#include <ldns/common.h>
#include <ldns/rdata.h>
/* write */
void
-ldns_rdf_set_size(ldns_rdf *rd, size_t s)
+ldns_rdf_set_size(ldns_rdf *rd, size_t size)
{
assert(rd != NULL);
- rd->_size = s;
+ rd->_size = size;
}
void
-ldns_rdf_set_type(ldns_rdf *rd, ldns_rdf_type t)
+ldns_rdf_set_type(ldns_rdf *rd, ldns_rdf_type type)
{
assert(rd != NULL);
- rd->_type = t;
+ rd->_type = type;
}
void
-ldns_rdf_set_data(ldns_rdf *rd, void *d)
+ldns_rdf_set_data(ldns_rdf *rd, void *data)
{
/* only copy the pointer */
assert(rd != NULL);
- rd->_data = d;
+ rd->_data = data;
}
/* for types that allow it, return
}
ldns_rdf *
-ldns_rdf_new(ldns_rdf_type t, size_t s, void *d)
+ldns_rdf_new(ldns_rdf_type type, size_t size, void *data)
{
ldns_rdf *rd;
rd = LDNS_MALLOC(ldns_rdf);
if (!rd) {
return NULL;
}
- ldns_rdf_set_size(rd, s);
- ldns_rdf_set_type(rd, t);
- ldns_rdf_set_data(rd, d);
+ ldns_rdf_set_size(rd, size);
+ ldns_rdf_set_type(rd, type);
+ ldns_rdf_set_data(rd, data);
return rd;
}
}
ldns_rdf *
-ldns_rdf_clone(const ldns_rdf *r)
+ldns_rdf_clone(const ldns_rdf *rd)
{
- assert(r != NULL);
+ assert(rd != NULL);
return (ldns_rdf_new_frm_data(
- ldns_rdf_get_type(r),
- ldns_rdf_size(r),
- ldns_rdf_data(r)));
+ ldns_rdf_get_type(rd),
+ ldns_rdf_size(rd),
+ ldns_rdf_data(rd)));
}
void
ldns_rdf *
ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str)
{
- ldns_rdf *rdf;
+ ldns_rdf *rdf=0;
ldns_status status;
switch (type) {
}
ldns_rdf *
-ldns_rdf_address_reverse(ldns_rdf *rdf)
+ldns_rdf_address_reverse(ldns_rdf *rd)
{
uint8_t buf_4[LDNS_IP4ADDRLEN];
uint8_t buf_6[LDNS_IP6ADDRLEN * 2];
char *char_dname;
int nbit;
- if (ldns_rdf_get_type(rdf) != LDNS_RDF_TYPE_A &&
- ldns_rdf_get_type(rdf) != LDNS_RDF_TYPE_AAAA) {
+ if (ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_A &&
+ ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_AAAA) {
return NULL;
}
in_addr = NULL;
ret_dname = NULL;
- switch(ldns_rdf_get_type(rdf)) {
+ switch(ldns_rdf_get_type(rd)) {
case LDNS_RDF_TYPE_A:
/* the length of the buffer is 4 */
- buf_4[3] = ldns_rdf_data(rdf)[0];
- buf_4[2] = ldns_rdf_data(rdf)[1];
- buf_4[1] = ldns_rdf_data(rdf)[2];
- buf_4[0] = ldns_rdf_data(rdf)[3];
+ buf_4[3] = ldns_rdf_data(rd)[0];
+ buf_4[2] = ldns_rdf_data(rd)[1];
+ buf_4[1] = ldns_rdf_data(rd)[2];
+ buf_4[0] = ldns_rdf_data(rd)[3];
in_addr = ldns_dname_new_frm_str("in-addr.arpa.");
if (!in_addr) {
return NULL;
/* calculate nibble */
nnibble = ( ((unsigned int) nbit) & 0x04) >> 2;
/* extract nibble */
- nibble = (ldns_rdf_data(rdf)[octet] & ( 0xf << (4 * (1 - nnibble)) ) ) >> ( 4 * (1 - nnibble));
+ nibble = (ldns_rdf_data(rd)[octet] & ( 0xf << (4 * (1 - nnibble)) ) ) >> ( 4 * (1 - nnibble));
buf_6[(LDNS_IP6ADDRLEN * 2 - 1) -
(octet * 2 + nnibble)] = (uint8_t)ldns_int_to_hexdigit((int)nibble);
}