net.h
Go to the documentation of this file.
1 /*
2  * net.h
3  *
4  * DNS Resolver definitions
5  *
6  * a Net::DNS like library for C
7  *
8  * (c) NLnet Labs, 2005-2006
9  *
10  * See the file LICENSE for the license
11  */
12 
13 #ifndef LDNS_NET_H
14 #define LDNS_NET_H
15 
16 #include <ldns/ldns.h>
17 #include <sys/socket.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #define LDNS_DEFAULT_TIMEOUT_SEC 5
24 #define LDNS_DEFAULT_TIMEOUT_USEC 0
25 
42 ldns_status ldns_udp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout, size_t *answersize);
43 
54 int ldns_udp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout);
55 
65 int ldns_tcp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout);
66 
78 ldns_status ldns_tcp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout, size_t *answersize);
79 
89 ldns_status ldns_send(ldns_pkt **pkt, ldns_resolver *r, const ldns_pkt *query_pkt);
90 
102 
110 int ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout);
111 
118 int ldns_udp_connect(const struct sockaddr_storage *to, struct timeval timeout);
119 
129 ssize_t ldns_tcp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen);
130 
140 ssize_t ldns_udp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen);
141 
151 uint8_t *ldns_tcp_read_wire_timeout(int sockfd, size_t *size, struct timeval timeout);
152 
162 uint8_t *ldns_tcp_read_wire(int sockfd, size_t *size);
163 
174 uint8_t *ldns_udp_read_wire(int sockfd, size_t *size, struct sockaddr_storage *fr, socklen_t *frlen);
175 
184 struct sockaddr_storage * ldns_rdf2native_sockaddr_storage(const ldns_rdf *rd, uint16_t port, size_t *size);
185 
192 ldns_rdf * ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *port);
193 
203 
204 #ifdef __cplusplus
205 }
206 #endif
207 
208 #endif /* LDNS_NET_H */