COSA
An Object-Oriented Platform for Arduino Programming
DNS Class Reference

#include <DNS.hh>

Collaboration diagram for DNS:
Collaboration graph

Public Member Functions

 DNS ()
 
 DNS (Socket *sock, uint8_t server[4])
 
 ~DNS ()
 
bool begin (Socket *sock, uint8_t server[4])
 
bool end ()
 
int gethostbyname (const char *hostname, uint8_t ip[4])
 
int gethostbyname_P (str_P hostname, uint8_t ip[4])
 

Static Public Attributes

static const uint16_t PORT = 53
 

Detailed Description

Domain Name Server request handler. Allows mapping from symbolic human readable names in dot notation to network addresses.

Definition at line 31 of file DNS.hh.

Constructor & Destructor Documentation

DNS::DNS ( )
inline

Construct DNS request handler. Use begin() to initiate the handler and end() to terminate.

Definition at line 40 of file DNS.hh.

DNS::DNS ( Socket sock,
uint8_t  server[4] 
)
inline

Construct DNS request handler and initiate with given UDP socket and server address. The destructor will automaically close the socket.

Parameters
[in]socksocket.
[in]servernetwork address.

Definition at line 48 of file DNS.hh.

DNS::~DNS ( )
inline

Destruct the DNS request handler; close the socket.

Definition at line 56 of file DNS.hh.

Member Function Documentation

bool DNS::begin ( Socket sock,
uint8_t  server[4] 
)

Initiate the DNS request handler with given UDP socket and server address. The destructor will automaically close the socket. Returns true if successful otherwise false.

Parameters
[in]socksocket.
[in]servernetwork address.

Definition at line 26 of file DNS.cpp.

bool DNS::end ( )

Terminate the DNS request handler and close the socket. Returns true if successful otherwise false.

Definition at line 34 of file DNS.cpp.

int DNS::gethostbyname ( const char *  hostname,
uint8_t  ip[4] 
)
inline

Lookup the given hostname and return the network address. Returns zero if successful otherwise negative error code.

Parameters
[in]hostnameto lookup.
[in]ipnetwork address.
Returns
zero if successful otherwise negative error code.

Definition at line 83 of file DNS.hh.

int DNS::gethostbyname_P ( str_P  hostname,
uint8_t  ip[4] 
)
inline

Lookup the given hostname and return the network address. Returns zero if successful otherwise negative error code.

Parameters
[in]hostnameto lookup (in program memory).
[in]ipnetwork address.
Returns
zero if successful otherwise negative error code.

Definition at line 96 of file DNS.hh.

Member Data Documentation

const uint16_t DNS::PORT = 53
static

DNS standard port number.

Definition at line 34 of file DNS.hh.


The documentation for this class was generated from the following files: