Commit 29cba46f authored by Pekka Pessi's avatar Pekka Pessi

Updated sresolv documentation.

darcs-hash:20060428081222-65a35-fece6fe3c9c823cb01ac74f44fb4e62681a57cce.gz
parent e2cc706d
......@@ -35,6 +35,7 @@ ALIASES = \
"RFC1123=<a href=\"http://www.faqs.org/rfcs/rfc1123.html\">RFC 1123</a>" \
"RFC1321=<a href=\"http://www.faqs.org/rfcs/rfc1321.html\">RFC 1321</a>" \
"RFC1864=<a href=\"http://www.faqs.org/rfcs/rfc1864.html\">RFC 1864</a>" \
"RFC1886=<a href=\"http://www.faqs.org/rfcs/rfc1886.html\">RFC 1886</a>" \
"RFC1890=<a href=\"http://www.faqs.org/rfcs/rfc1890.html\">RFC 1890</a>" \
"RFC1891=<a href=\"http://www.faqs.org/rfcs/rfc1891.html\">RFC 1891</a>" \
"RFC2000=<a href=\"http://www.faqs.org/rfcs/rfc2000.html\">RFC 2000</a>" \
......
......@@ -62,10 +62,13 @@ enum {
#define SRES_CACHE_TIMER_INTERVAL (SRES_CACHE_TIMER_INTERVAL)
};
/** Create a resolver cache object. */
sres_cache_t *sres_cache_new(int n);
/** Increase reference count on a resolver cache object. */
sres_cache_t *sres_cache_ref(sres_cache_t *);
/** Decrease the reference count on a resolver cache object. */
void sres_cache_unref(sres_cache_t *);
/** Get a list of matching records from cache. */
......
......@@ -44,22 +44,6 @@
extern "C" {
#endif
#ifndef SRES_RECORD_T
#define SRES_RECORD_T
/** Type representing any DNS record. */
typedef union sres_record sres_record_t;
#endif
typedef struct sres_generic sres_generic_t;
typedef struct sres_soa_record sres_soa_record_t;
typedef struct sres_a_record sres_a_record_t;
typedef struct sres_a6_record sres_a6_record_t;
typedef struct sres_aaaa_record sres_aaaa_record_t;
typedef struct sres_cname_record sres_cname_record_t;
typedef struct sres_ptr_record sres_ptr_record_t;
typedef struct sres_srv_record sres_srv_record_t;
typedef struct sres_naptr_record sres_naptr_record_t;
/** Common part of all DNS records. */
typedef struct sres_common
{
......@@ -82,111 +66,121 @@ enum {
SRES_NAME_ERR = 3, /**< No domain name. */
SRES_UNIMPL_ERR = 4, /**< Not implemented. */
SRES_AUTH_ERR = 5, /**< Refused */
/* */
/* Errors generated by sresolv */
SRES_TIMEOUT_ERR = 16, /**< Timeout occurred */
SRES_RECORD_ERR = 17 /**< Name has no given record type */
};
/** Start-of-authority record (RFC 1035). */
struct sres_soa_record
/** Start of a zone of authority record (@RFC1035). */
typedef struct sres_soa_record
{
sres_common_t soa_record[1];
char *soa_mname;
char *soa_rname;
uint32_t soa_serial;
uint32_t soa_refresh;
uint32_t soa_retry;
uint32_t soa_expire;
uint32_t soa_minimum;
};
/** Generic record. */
struct sres_generic
sres_common_t soa_record[1]; /**< Common part of DNS records. */
char *soa_mname; /**< Primary name server */
char *soa_rname; /**< Person responsible for domain */
uint32_t soa_serial; /**< Version number */
uint32_t soa_refresh; /**< Refresh intercal */
uint32_t soa_retry; /**< Interval between refres retries */
uint32_t soa_expire; /**< Upper limit on zone expiration time */
uint32_t soa_minimum; /**< Minimum TTL for any record in zone */
} sres_soa_record_t;
/** Generic DNS record. */
typedef struct sres_generic
{
sres_common_t g_record[1];
uint8_t g_data[128];
};
sres_common_t g_record[1]; /**< Common part of DNS records. */
uint8_t g_data[128]; /**< Record data */
} sres_generic_t;
/** Address record (RFC 1035). */
struct sres_a_record
/** Address record (@RFC1035). */
typedef struct sres_a_record
{
sres_common_t a_record[1];
struct in_addr a_addr;
};
sres_common_t a_record[1]; /**< Common part of DNS records. */
struct in_addr a_addr; /**< IP4 address */
} sres_a_record_t;
/** IPv6 address used by sresolv library */
/** IPv6 address used by sresolv library.
*
* @sa #sres_aaaa_record, #sres_a6_record
*/
typedef struct
{
uint8_t u6_addr[16];
} sres_in6_addr_t;
uint8_t u6_addr[16]; /**< 16 byte array */
} sres_in6_t;
/** Address record for IPv6 (RFC 2874, deprecated). */
struct sres_a6_record
/** Aggregated address record for IPv6 (@RFC2874, deprecated). */
typedef struct sres_a6_record
{
sres_common_t a6_record[1];
uint8_t a6_prelen;
uint8_t a6_pad[3];
sres_in6_addr_t a6_suffix;
char *a6_prename;
};
/** Address record for IPv6 (RFC 1886). */
struct sres_aaaa_record
sres_common_t a6_record[1]; /**< Common part of DNS records. */
uint8_t a6_prelen; /**< Prefix length */
uint8_t a6_pad[3]; /**< */
sres_in6_t a6_suffix; /**< Address suffix */
char *a6_prename; /**< Prefix name */
} sres_a6_record_t;
/** Address record for IPv6 (@RFC1886). */
typedef struct sres_aaaa_record
{
sres_common_t aaaa_record[1];
sres_in6_addr_t aaaa_addr;
};
sres_common_t aaaa_record[1]; /**< Common part of DNS records. */
sres_in6_t aaaa_addr; /**< IP6 address */
} sres_aaaa_record_t;
/** Canonic name record (RFC 1035). */
struct sres_cname_record
/** Canonic name record (@RFC1035). */
typedef struct sres_cname_record
{
sres_common_t cname_record[1];
char *cn_cname;
};
sres_common_t cn_record[1]; /**< Common part of DNS records. */
char *cn_cname; /**< */
} sres_cname_record_t;
/** Pointer record (RFC 1035). */
struct sres_ptr_record
/** Pointer record (@RFC1035). */
typedef struct sres_ptr_record
{
sres_common_t ptr_record[1];
char *ptr_domain;
};
sres_common_t ptr_record[1]; /**< Common part of DNS records. */
char *ptr_domain; /**< Domain */
} sres_ptr_record_t;
/** Service location record (RFC 2782). */
struct sres_srv_record
/** Service location record (@RFC2782). */
typedef struct sres_srv_record
{
sres_common_t srv_record[1];
uint16_t srv_priority;
uint16_t srv_weight;
uint16_t srv_port;
uint16_t srv_pad;
char *srv_target;
};
/** Naming authority pointer record (RFC2915). */
struct sres_naptr_record
sres_common_t srv_record[1]; /**< Common part of DNS records. */
uint16_t srv_priority; /**< Priority */
uint16_t srv_weight; /**< Weight */
uint16_t srv_port; /**< Service port on the target host. */
uint16_t srv_pad;
char *srv_target; /**< Domain name of the target host. */
} sres_srv_record_t;
/** Naming authority pointer record (@RFC2915). */
typedef struct sres_naptr_record
{
sres_common_t na_record[1];
uint16_t na_order;
uint16_t na_prefer;
char *na_flags;
char *na_services;
char *na_regexp;
char *na_replace;
};
sres_common_t na_record[1]; /**< Common part of DNS records. */
uint16_t na_order; /**< Processing order for NAPTR records. */
uint16_t na_prefer; /**< Preference */
char *na_flags; /**< Flags for interpretation and rewriting */
char *na_services; /**< Services available. */
char *na_regexp; /**< Substitution expression. */
char *na_replace; /**< Replacement. */
} sres_naptr_record_t;
#ifndef SRES_RECORD_T
#define SRES_RECORD_T
/** Type representing any DNS record. */
typedef union sres_record sres_record_t;
#endif
/** Union of different DNS records */
union sres_record
{
sres_common_t sr_record[1];
sres_generic_t sr_generic[1];
sres_soa_record_t sr_soa[1];
sres_a_record_t sr_a[1];
sres_cname_record_t sr_cname[1];
sres_ptr_record_t sr_ptr[1];
sres_a6_record_t sr_a6[1];
sres_aaaa_record_t sr_aaaa[1];
sres_srv_record_t sr_srv[1];
sres_naptr_record_t sr_naptr[1];
sres_common_t sr_record[1]; /**< Common part of all DNS records */
sres_generic_t sr_generic[1]; /**< Generic (unparsed) DNS record */
sres_soa_record_t sr_soa[1]; /**< SOA (start-of-authority) record */
sres_a_record_t sr_a[1]; /**< A (address) record */
sres_cname_record_t sr_cname[1]; /**< CNAME (canonic name) record */
sres_ptr_record_t sr_ptr[1]; /**< PTR (pointer) record */
sres_a6_record_t sr_a6[1]; /**< A6 (IP6 address) record */
sres_aaaa_record_t sr_aaaa[1]; /**< AAAA (IP6 address) record */
sres_srv_record_t sr_srv[1]; /**< SRV record */
sres_naptr_record_t sr_naptr[1]; /**< NAPTR record */
};
/** Record classes */
......@@ -245,6 +239,7 @@ enum {
sres_qtype_any = 255 /**< Wildcard match. */
};
/** Compare two records. */
int sres_record_compare(sres_record_t const *, sres_record_t const *);
#ifdef __cplusplus
......
......@@ -167,7 +167,7 @@ struct sres_resolver_s {
sres_server_t **res_servers;
};
/* Parsed configuration. @internal */
struct sres_config {
su_home_t c_home[1];
......@@ -175,16 +175,16 @@ struct sres_config {
time_t c_modified;
char const *c_filename;
/** domain and search */
/* domain and search */
char const *c_search[1 + SRES_MAX_SEARCH + 1];
/** nameserver */
/* nameserver */
struct sres_nameserver {
struct sockaddr_storage ns_addr[1];
ssize_t ns_addrlen;
} *c_nameservers[SRES_MAX_NAMESERVERS + 1];
/** sortlist */
/* sortlist */
struct sres_sortlist {
struct sockaddr_storage addr[1];
ssize_t addrlen;
......@@ -193,7 +193,7 @@ struct sres_config {
uint16_t c_port; /**< Server port to use */
/** options */
/* options */
struct sres_options {
uint16_t timeout;
uint16_t attempts;
......@@ -2824,7 +2824,7 @@ sres_init_rr_cname(sres_resolver_t *res,
sres_cname_record_t *rr,
sres_message_t *m)
{
assert(rr->cname_record->r_size == sizeof(sres_cname_record_t));
assert(rr->cn_record->r_size == sizeof(sres_cname_record_t));
sres_get_domain(res, &rr->cn_cname, m);
}
......
......@@ -147,11 +147,13 @@ sres_cache_t *sres_cache_new(int n)
return cache;
}
/** Increase reference count on a resolver cache object. */
sres_cache_t *sres_cache_ref(sres_cache_t *cache)
{
return su_home_ref(cache->cache_home);
}
/** Decrease the reference count on a resolver cache object. */
void sres_cache_unref(sres_cache_t *cache)
{
su_home_unref(cache->cache_home);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment