net.h File Reference

Go to the source code of this file.

Defines

#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 respons as a ldns_pkt.
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.
ldns_status ldns_send (ldns_pkt **pkt, ldns_resolver *r, ldns_pkt *query_pkt)
 Sends ptk to the nameserver at the resolver object.
int ldns_tcp_connect (const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout)
 Create a tcp 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.
int ldns_udp_server_connect (const struct sockaddr_storage *to, struct timeval timeout)
 Create a udp socket to the specified address and bind it too (making it a server 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 (int sockfd, size_t *size)
 Gives back a raw packet from the wire and reads the header data from the given socket.
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.


Define Documentation

#define LDNS_DEFAULT_TIMEOUT_SEC   5

Definition at line 23 of file net.h.

#define LDNS_DEFAULT_TIMEOUT_USEC   0

Definition at line 24 of file net.h.


Function Documentation

ldns_status ldns_send ( ldns_pkt **  pkt,
ldns_resolver r,
ldns_pkt query_pkt 
)

Sends ptk to the nameserver at the resolver object.

Returns the data as a ldns_pkt

Parameters:
[out] pkt packet received from the nameserver
[in] r the resolver to use
[in] query_pkt the query to send
Returns:
status

int ldns_tcp_connect ( const struct sockaddr_storage *  to,
socklen_t  tolen,
struct timeval  timeout 
)

Create a tcp socket to the specified address.

Parameters:
[in] to ip and family
[in] tolen length of to
[in] timeout timeout for the socket
Returns:
a socket descriptor

uint8_t* ldns_tcp_read_wire ( int  sockfd,
size_t *  size 
)

Gives back a raw packet from the wire and reads the header data from the given socket.

Allocates the data (of size size) itself, so don't forget to free

Parameters:
[in] sockfd the socket to read from
[out] size the number of bytes that are read
Returns:
the data read

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.

Parameters:
[in] qbin the ldns_buffer to be send
[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
Returns:
status

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

Parameters:
[in] qbin the buffer to send
[in] sockfd the socket to use
[in] to which ip to send it
[in] tolen socketlen
Returns:
number of bytes sent

int ldns_udp_connect ( const struct sockaddr_storage *  to,
struct timeval  timeout 
)

Create a udp socket to the specified address.

Parameters:
[in] to ip and family
[in] timeout timeout for the socket
Returns:
a socket descriptor

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.

Allocates the data (of size size) itself, so don't forget to free

Parameters:
[in] sockfd the socket to read from
[in] fr the address of the client (if applicable)
[in] *frlen the lenght of the client's addr (if applicable)
[out] size the number of bytes that are read
Returns:
the data read

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.

Parameters:
[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
Returns:
status

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.

Don;t want for the answer

Parameters:
[in] qbin the buffer to send
[in] sockfd the socket to use
[in] to which ip to send it
[in] tolen socketlen
Returns:
number of bytes sent

int ldns_udp_server_connect ( const struct sockaddr_storage *  to,
struct timeval  timeout 
)

Create a udp socket to the specified address and bind it too (making it a server socket).

Parameters:
[in] to ip and family
[in] timeout timeout for the socket
Returns:
a socket descriptor


Generated on Mon Sep 11 20:08:48 2006 for ldns by  doxygen 1.4.7