ldns documentation

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

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
53 int ldns_udp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout);
54
64 int ldns_tcp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout);
65
77 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);
78
88 ldns_status ldns_send(ldns_pkt **pkt, ldns_resolver *r, const ldns_pkt *query_pkt);
89
100 ldns_status ldns_send_buffer(ldns_pkt **pkt, ldns_resolver *r, ldns_buffer *qb, ldns_rdf *tsig_mac);
101
109 int ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout);
110
117 int ldns_udp_connect(const struct sockaddr_storage *to, struct timeval timeout);
118
128 ssize_t ldns_tcp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen);
129
139 ssize_t ldns_udp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen);
140
150 uint8_t *ldns_tcp_read_wire_timeout(int sockfd, size_t *size, struct timeval timeout);
151
161 uint8_t *ldns_tcp_read_wire(int sockfd, size_t *size);
162
173 uint8_t *ldns_udp_read_wire(int sockfd, size_t *size, struct sockaddr_storage *fr, socklen_t *frlen);
174
183 struct sockaddr_storage * ldns_rdf2native_sockaddr_storage(const ldns_rdf *rd, uint16_t port, size_t *size);
184
191 ldns_rdf * ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *port);
192
201 ldns_status ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class c);
202
203 #ifdef __cplusplus
204 }
205 #endif
206
207 #endif /* LDNS_NET_H */
ldns_struct_buffer
implementation of buffers to ease operations
Definition: buffer.h:50
ldns_tcp_bgsend
int ldns_tcp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout)
Send an tcp query and don&#39;t wait for an answer but return the socket.
Definition: net.c:300
ldns_send_buffer
ldns_status ldns_send_buffer(ldns_pkt **pkt, ldns_resolver *r, ldns_buffer *qb, ldns_rdf *tsig_mac)
Sends and ldns_buffer (presumably containing a packet to the nameserver at the resolver object...
Definition: net.c:464
ldns_axfr_start
ldns_status ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class c)
Prepares the resolver for an axfr query The query is sent and the answers can be read with ldns_axfr_...
Definition: net.c:865
ldns_struct_resolver
DNS stub resolver structure.
Definition: resolver.h:59
ldns_rr_class
enum ldns_enum_rr_class ldns_rr_class
Definition: rr.h:64
ldns_send
ldns_status ldns_send(ldns_pkt **pkt, ldns_resolver *r, const ldns_pkt *query_pkt)
Sends ptk to the nameserver at the resolver object.
Definition: net.c:35
ldns_tcp_send_query
ssize_t ldns_tcp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen)
send a query via tcp to a server.
Definition: net.c:648
ldns_tcp_read_wire_timeout
uint8_t * ldns_tcp_read_wire_timeout(int sockfd, size_t *size, struct timeval timeout)
Gives back a raw packet from the wire and reads the header data from the given socket.
Definition: net.c:721
ldns.h
Including this file will include all ldns files, and define some lookup tables.
ldns_udp_connect
int ldns_udp_connect(const struct sockaddr_storage *to, struct timeval timeout)
Create a udp socket to the specified address.
ldns_udp_bgsend
int ldns_udp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout)
Send an udp query and don&#39;t wait for an answer but return the socket.
Definition: net.c:401
ldns_struct_pkt
DNS packet.
Definition: packet.h:233
ldns_tcp_connect
int ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout)
Create a tcp socket to the specified address.
Definition: net.c:267
ldns_rdf2native_sockaddr_storage
struct sockaddr_storage * ldns_rdf2native_sockaddr_storage(const ldns_rdf *rd, uint16_t port, size_t *size)
returns the native sockaddr representation from the rdf.
Definition: net.c:101
ldns_status
enum ldns_enum_status ldns_status
Definition: error.h:131
ldns_sockaddr_storage2rdf
ldns_rdf * ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *port)
returns an rdf with the sockaddr info.
Definition: net.c:830
ldns_struct_rdf
Resource record data field.
Definition: rdata.h:166
ldns_udp_send_query
ssize_t ldns_udp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen)
send a query via udp to a server.
Definition: net.c:673
ldns_tcp_send
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)
Sends a buffer to an ip using tcp and return the respons as a ldns_pkt.
Definition: net.c:348
ldns_udp_send
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)
Sends a buffer to an ip using udp and return the respons as a ldns_pkt.
Definition: net.c:455
ldns_udp_read_wire
uint8_t * ldns_udp_read_wire(int sockfd, size_t *size, struct sockaddr_storage *fr, socklen_t *frlen)
Gives back a raw packet from the wire and reads the header data from the given socket.
Definition: net.c:691
ldns_tcp_read_wire
uint8_t * ldns_tcp_read_wire(int sockfd, size_t *size)
This routine may block.
Definition: net.c:780