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

#include <INET.hh>

Collaboration diagram for INET:
Collaboration graph

Classes

struct  addr_t
 
class  Server
 

Static Public Member Functions

static bool is_illegal (uint8_t addr[IP_MAX], uint16_t port)
 
static int aton (const char *addr, uint8_t ip[IP_MAX], bool progmem=false)
 
static int aton_P (const char *addr, uint8_t ip[IP_MAX])
 
static int nametopath (const char *hostname, char *path, bool progmem=false)
 
static int nametopath_P (const char *hostname, char *path)
 
static void print_path (IOStream &outs, const char *path)
 
static void print_mac (IOStream &outs, const uint8_t mac[MAC_MAX])
 
static void print_addr (IOStream &outs, const uint8_t addr[IP_MAX], uint16_t port=0)
 
static uint16_t checksum (const void *buf, size_t count)
 

Static Public Attributes

static const uint8_t PATH_MAX = 64
 
static const uint8_t MAC_MAX = 6
 
static const uint8_t IP_MAX = 4
 

Detailed Description

Internet message passing support functions.

Definition at line 65 of file INET.hh.

Member Function Documentation

int INET::aton ( const char *  addr,
uint8_t  ip[IP_MAX],
bool  progmem = false 
)
static

Convert an address string in dot notation to binary form. Returns zero if successful otherwise negative error code.

Parameters
[in]addraddress string.
[in,out]ipnetwork address.
[in]progmemaddress string in program memory flag.
Returns
zero if successful otherwise negative error code.

Definition at line 42 of file INET.cpp.

static int INET::aton_P ( const char *  addr,
uint8_t  ip[IP_MAX] 
)
inlinestatic

Convert an address string in dot notation to binary form. Returns zero if successful otherwise negative error code.

Parameters
[in]addraddress string in program memory.
[in,out]ipnetwork address.
Returns
zero if successful otherwise negative error code.

Definition at line 110 of file INET.hh.

uint16_t INET::checksum ( const void *  buf,
size_t  count 
)
static

Calculate Internet Checksum for given buffer with given number of bytes. The buffer should contain data in network order (big-endian). Return check sum.

Parameters
[in]bufpointer to buffer.
[in]countnumber of bytes.
Returns
checksum.

Definition at line 128 of file INET.cpp.

bool INET::is_illegal ( uint8_t  addr[IP_MAX],
uint16_t  port 
)
static

Check if the given address is illegal (0.0.0.0/255.255.255.255:0).

Returns
true if illegal otherwise false.

Definition at line 25 of file INET.cpp.

int INET::nametopath ( const char *  hostname,
char *  path,
bool  progmem = false 
)
static

Convert an address string in dot notation to a request path. The given path buffer must be able to hold at least PATH_MAX characters. Returns length of path is successful otherwise negative error code.

Parameters
[in]hostnameaddress string.
[in,out]pathgenerated path from hostname.
[in]progmemhostname address string in program memory flag.
Returns
length of path if successful otherwise negative error code.

Definition at line 63 of file INET.cpp.

static int INET::nametopath_P ( const char *  hostname,
char *  path 
)
inlinestatic

Convert an address string in dot notation to a request path. The given path buffer must be able to hold at least PATH_MAX characters. Returns length of path is successful otherwise negative error code.

Parameters
[in]hostnameaddress string in program memory.
[in,out]pathgenerated path from hostname.
Returns
length of path if successful otherwise negative error code.

Definition at line 139 of file INET.hh.

void INET::print_addr ( IOStream outs,
const uint8_t  addr[IP_MAX],
uint16_t  port = 0 
)
static

Print network address and port in extended dot notation to given output stream.

Parameters
[in]outsoutput stream.
[in]addrnetwork address to print.
[in]port.

Definition at line 119 of file INET.cpp.

void INET::print_mac ( IOStream outs,
const uint8_t  mac[MAC_MAX] 
)
static

Print machine network address hex-colon notation to given output stream.

Parameters
[in]outsoutput stream.
[in]macmachine address to print.

Definition at line 111 of file INET.cpp.

void INET::print_path ( IOStream outs,
const char *  path 
)
static

Print path in dot notation to given output stream.

Parameters
[in]outsoutput stream.
[in]pathto print.

Definition at line 92 of file INET.cpp.

Member Data Documentation

const uint8_t INET::IP_MAX = 4
static

Definition at line 69 of file INET.hh.

const uint8_t INET::MAC_MAX = 6
static

Definition at line 68 of file INET.hh.

const uint8_t INET::PATH_MAX = 64
static

Definition at line 67 of file INET.hh.


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