|
jabberd14 1.6.2
|
implements SRV DNS resolving More...
#include "jabberd.h"#include <netinet/in.h>#include <arpa/nameser.h>#include <resolv.h>#include "srv_resolv.h"Data Structures | |
| struct | __srv_list |
| representation of a SRV DNS record More... | |
Defines | |
| #define | BIND_8_COMPAT |
| #define | T_SRV 33 |
Typedefs | |
| typedef struct __srv_list * | srv_list |
| representation of a SRV DNS record | |
| typedef struct __srv_list | _srv_list |
Functions | |
| char * | srv_inet_ntoa (pool p, unsigned char *addrptr) |
| char * | srv_port2str (pool p, unsigned short port) |
| void | srv_xhash_join (pool p, xht ht, const char *key, char *value) |
| char * | srv_lookup (pool p, const char *service, const char *domain) |
implements SRV DNS resolving
This file implements resolving of services in the DNS using the protocol defined in RFC 2782.
| #define BIND_8_COMPAT |
| #define T_SRV 33 |
Referenced by srv_lookup().
| typedef struct __srv_list _srv_list |
| typedef struct __srv_list * srv_list |
representation of a SRV DNS record
This structure is used to build an ordered double linked list of SRV DNS records for a service on a domain
| char* srv_inet_ntoa | ( | pool | p, |
| unsigned char * | addrptr | ||
| ) |
convert an IPv4 (AF_INET) address to its textual representation using memory pools
| p | the pool to be used |
| addrptr | the address that should be printed |
References pstrdup().
Referenced by srv_lookup().
| char* srv_lookup | ( | pool | p, |
| const char * | service, | ||
| const char * | domain | ||
| ) |
do a DNS lookup
This function implements a SRV DNS lookup and falls back to normal AAAA/A resolution if no service has been given by the caller.
| p | memory pool to be used by this function |
| service | which service should be looked up (e.g. "_xmpp-server._tcp") |
| domain | which domain should be looked up |
References __srv_list::host, j_strlen(), __srv_list::last, log_debug2, LOGT_IO, __srv_list::next, pmalloco(), __srv_list::port, __srv_list::priority, pstrdup(), srv_inet_ntoa(), srv_port2str(), srv_xhash_join(), T_SRV, xhash_get(), xhash_new(), and ZONE.
Referenced by dnsrv_child_process_xstream_io().
| char* srv_port2str | ( | pool | p, |
| unsigned short | port | ||
| ) |
convert a (numerical) port number to a string using memory pools
| p | the pool to be used |
| port | the port that should be converted |
References pmalloco().
Referenced by srv_lookup().
put a value in an xhash and join it with the previous value if there has been already one in the hash
If there is no entry for this key, the function just enters the value. If there is already an entry for this key, the function will append a "," and the old value to the new value and insert it into the hash.
| p | memory pool to be used |
| ht | the hash table |
| key | the key in the hash |
| value | the value that should be inserted |
References pstrdup(), xhash_get(), and xhash_put().
Referenced by srv_lookup().
1.7.4