![]() |
ldns
1.9.0
|
Contains functions to send and receive packets over a network. More...
Go to the source code of this file.
Macros | |
| #define | LDNS_DEFAULT_TIMEOUT_SEC 5 |
| #define | LDNS_DEFAULT_TIMEOUT_USEC 0 |
Functions | |
| 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 response as a ldns_pkt. | |
| int | ldns_udp_bgsend2 (ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout) |
| Send an udp query and don't wait for an answer but return the socket. | |
| int | ldns_udp_bgsend (ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout) |
| Send an udp query and don't wait for an answer but return the socket This function has the flaw that it returns 0 on failure, but 0 could be a valid socket. | |
| int | ldns_tcp_bgsend2 (ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout) |
| Send an tcp query and don't wait for an answer but return the socket. | |
| int | ldns_tcp_bgsend (ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout) |
| Send an tcp query and don't wait for an answer but return the socket This function has the flaw that it returns 0 on failure, but 0 could be a valid socket. | |
| 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 response as a ldns_pkt. | |
| ldns_status | ldns_send (ldns_pkt **pkt, ldns_resolver *r, const ldns_pkt *query_pkt) |
| Sends ptk to the nameserver at the resolver object. | |
| 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. | |
| int | ldns_tcp_connect2 (const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout) |
| Create a tcp socket to the specified address. | |
| int | ldns_tcp_connect (const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout) |
| Create a tcp socket to the specified address This function has the flaw that it returns 0 on failure, but 0 could be a valid socket. | |
| int | ldns_udp_connect2 (const struct sockaddr_storage *to, struct timeval timeout) |
| Create a udp socket to the specified address. | |
| int | ldns_udp_connect (const struct sockaddr_storage *to, struct timeval timeout) |
| Create a udp socket to the specified address This function has the flaw that it returns 0 on failure, but 0 could be a valid socket. | |
| 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. | |
| 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. | |
| 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. | |
| uint8_t * | ldns_tcp_read_wire (int sockfd, size_t *size) |
| This routine may block. | |
| 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. | |
| 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. | |
| ldns_rdf * | ldns_sockaddr_storage2rdf (const struct sockaddr_storage *sock, uint16_t *port) |
| returns an rdf with the sockaddr info. | |
| ldns_status | ldns_axfr_start (ldns_resolver *resolver, const 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_next. | |
Contains functions to send and receive packets over a network.
Definition in file net.h.
| 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 response as a ldns_pkt.
| [in] | qbin | the ldns_buffer to be send |
| [in] | to | the ip addr to send to |
| [in] | tolen | length of the ip addr |
| [in] | timeout | the timeout value for the network |
| [out] | answersize | size of the packet |
| [out] | result | packet with the answer |
| int ldns_udp_bgsend2 | ( | ldns_buffer * | qbin, |
| const struct sockaddr_storage * | to, | ||
| socklen_t | tolen, | ||
| struct timeval | timeout ) |
Send an udp query and don't wait for an answer but return the socket.
| [in] | qbin | the ldns_buffer to be send |
| [in] | to | the ip addr to send to |
| [in] | tolen | length of the ip addr |
| [in] | timeout | unused, was the timeout value for the network |
| int ldns_udp_bgsend | ( | ldns_buffer * | qbin, |
| const struct sockaddr_storage * | to, | ||
| socklen_t | tolen, | ||
| struct timeval | timeout ) |
Send an udp query and don't wait for an answer but return the socket This function has the flaw that it returns 0 on failure, but 0 could be a valid socket.
Please use ldns_udp_bgsend2 instead of this function.
| [in] | qbin | the ldns_buffer to be send |
| [in] | to | the ip addr to send to |
| [in] | tolen | length of the ip addr |
| [in] | timeout | unused, was the timeout value for the network |
| int ldns_tcp_bgsend2 | ( | ldns_buffer * | qbin, |
| const struct sockaddr_storage * | to, | ||
| socklen_t | tolen, | ||
| struct timeval | timeout ) |
Send an tcp query and don't wait for an answer but return the socket.
| [in] | qbin | the ldns_buffer to be send |
| [in] | to | the ip addr to send to |
| [in] | tolen | length of the ip addr |
| [in] | timeout | the timeout value for the connect attempt |
| int ldns_tcp_bgsend | ( | ldns_buffer * | qbin, |
| const struct sockaddr_storage * | to, | ||
| socklen_t | tolen, | ||
| struct timeval | timeout ) |
Send an tcp query and don't wait for an answer but return the socket This function has the flaw that it returns 0 on failure, but 0 could be a valid socket.
Please use ldns_tcp_bgsend2 instead of this function.
| [in] | qbin | the ldns_buffer to be send |
| [in] | to | the ip addr to send to |
| [in] | tolen | length of the ip addr |
| [in] | timeout | the timeout value for the connect attempt |
| 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 response as a ldns_pkt.
| [out] | result | packet with the answer |
| [in] | qbin | the ldns_buffer to be send |
| [in] | to | the ip addr to send to |
| [in] | tolen | length of the ip addr |
| [in] | timeout | the timeout value for the network |
| [out] | answersize | size of the packet |
| ldns_status ldns_send | ( | ldns_pkt ** | pkt, |
| ldns_resolver * | r, | ||
| const ldns_pkt * | query_pkt ) |
Sends ptk to the nameserver at the resolver object.
Returns the data as a ldns_pkt
| [out] | pkt | packet received from the nameserver |
| [in] | r | the resolver to use |
| [in] | query_pkt | the query to send |
Definition at line 38 of file net.c.
References ldns_buffer_free(), ldns_buffer_new(), LDNS_MIN_BUFLEN, ldns_pkt2buffer_wire(), ldns_pkt_tsig(), ldns_rr_rdf(), ldns_send_buffer(), LDNS_STATUS_ERR, and LDNS_STATUS_OK.
| 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.
Returns the data as a ldns_pkt
| [out] | pkt | packet received from the nameserver |
| [in] | r | the resolver to use |
| [in] | qb | the buffer to send |
| [in] | tsig_mac | the tsig MAC to authenticate the response with (NULL to do no TSIG authentication) |
Definition at line 492 of file net.c.
References LDNS_FREE, ldns_pkt_set_answerfrom(), ldns_pkt_set_querytime(), ldns_pkt_set_size(), ldns_pkt_set_timestamp(), ldns_pkt_tsig_verify(), ldns_rdf2native_sockaddr_storage(), ldns_rdf_clone(), LDNS_RESOLV_INET, LDNS_RESOLV_INET6, LDNS_RESOLV_RTT_INF, ldns_resolver_fail(), ldns_resolver_ip6(), ldns_resolver_nameserver_count(), ldns_resolver_nameservers(), ldns_resolver_nameservers_randomize(), ldns_resolver_port(), ldns_resolver_random(), ldns_resolver_retrans(), ldns_resolver_retry(), ldns_resolver_rtt(), ldns_resolver_set_nameserver_rtt(), ldns_resolver_source(), ldns_resolver_timeout(), ldns_resolver_tsig_keydata(), ldns_resolver_tsig_keyname(), ldns_resolver_usevc(), LDNS_STATUS_CRYPTO_TSIG_BOGUS, LDNS_STATUS_ERR, LDNS_STATUS_OK, LDNS_STATUS_RES_NO_NS, and ldns_wire2pkt().
| int ldns_tcp_connect2 | ( | const struct sockaddr_storage * | to, |
| socklen_t | tolen, | ||
| struct timeval | timeout ) |
| int ldns_tcp_connect | ( | const struct sockaddr_storage * | to, |
| socklen_t | tolen, | ||
| struct timeval | timeout ) |
Create a tcp socket to the specified address This function has the flaw that it returns 0 on failure, but 0 could be a valid socket.
Please use ldns_tcp_connect2 instead of this function.
| [in] | to | ip and family |
| [in] | tolen | length of to |
| [in] | timeout | timeout for the connect attempt |
| int ldns_udp_connect2 | ( | const struct sockaddr_storage * | to, |
| struct timeval | timeout ) |
Create a udp socket to the specified address.
| [in] | to | ip and family |
| [in] | timeout | unused, was timeout for the socket |
| int ldns_udp_connect | ( | const struct sockaddr_storage * | to, |
| struct timeval | timeout ) |
Create a udp socket to the specified address This function has the flaw that it returns 0 on failure, but 0 could be a valid socket.
Please use ldns_udp_connect2 instead of this function.
| [in] | to | ip and family |
| [in] | timeout | unused, was timeout for the socket |
| 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.
Don't want for the answer
| [in] | qbin | the buffer to send |
| [in] | sockfd | the socket to use |
| [in] | to | which ip to send it |
| [in] | tolen | socketlen |
Definition at line 681 of file net.c.
References LDNS_FREE, and LDNS_XMALLOC.
| ssize_t ldns_udp_send_query | ( | ldns_buffer * | qbin, |
| int | sockfd, | ||
| const struct sockaddr_storage * | to, | ||
| socklen_t | tolen ) |
| uint8_t * ldns_tcp_read_wire_timeout | ( | int | sockfd, |
| size_t * | size, | ||