#include <W5100.hh>
|
| Driver () |
|
virtual int | available () |
|
virtual int | room () |
|
virtual int | read (void *buf, size_t size) |
|
virtual int | flush () |
|
virtual int | open (Protocol proto, uint16_t port, uint8_t flag) |
|
virtual int | close () |
|
virtual int | listen () |
|
virtual int | accept () |
|
virtual int | connect (uint8_t addr[4], uint16_t port) |
|
virtual int | connect (const char *hostname, uint16_t port) |
|
virtual int | is_connected () |
|
virtual int | disconnect () |
|
virtual int | datagram (uint8_t addr[4], uint16_t port) |
|
virtual int | recv (void *buf, size_t len) |
|
virtual int | recv (void *buf, size_t len, uint8_t src[4], uint16_t &port) |
|
void | src (INET::addr_t &addr) const |
|
Protocol | proto () const |
|
uint16_t | port () const |
|
virtual int | write (const void *buf, size_t size) |
|
virtual int | write (const iovec_t *vec) |
|
virtual int | write_P (const void *buf, size_t size) |
|
virtual int | getchar () |
|
virtual int | read (iovec_t *vec) |
|
int | send (const void *buf, size_t len) |
|
int | send (const void *buf, size_t len, uint8_t dest[4], uint16_t port) |
|
int | send_P (const void *buf, size_t len) |
|
int | send_P (const void *buf, size_t len, uint8_t dest[4], uint16_t port) |
|
void | non_blocking () |
|
void | blocking () |
|
bool | is_blocking () const |
|
void | eol (Mode mode) |
|
Mode | eol () const |
|
virtual int | putchar (char c) |
|
virtual int | puts (const char *s) |
|
virtual int | puts (str_P s) |
|
virtual int | peekchar () |
|
virtual int | peekchar (char c) |
|
virtual char * | gets (char *s, size_t count) |
|
virtual void | empty () |
|
|
int | dev_read (void *buf, size_t len) |
|
int | dev_write (const void *buf, size_t len, bool progmem) |
|
void | dev_flush () |
|
void | dev_setup () |
|
virtual int | write (const void *buf, size_t size, bool progmem) |
|
virtual int | send (const void *buf, size_t len, bool progmem) |
|
virtual int | send (const void *buf, size_t len, uint8_t dest[4], uint16_t port, bool progmem) |
|
W5100 Single-Chip Internet-enable 10/100 Ethernet Controller Driver. Implements the Cosa/Socket interface.
Definition at line 332 of file W5100.hh.
Socket type.
Enumerator |
---|
TCP |
|
UDP |
|
IPRAW |
|
MACRAW |
|
PPPoE |
|
Definition at line 37 of file Socket.hh.
W5100::Driver::Driver |
( |
| ) |
|
|
inline |
Default constructor.
Definition at line 336 of file W5100.hh.
virtual int W5100::Driver::accept |
( |
| ) |
|
|
virtual |
Check for incoming requests from clients. Return zero if the socket has accepted a request and a connection is established, otherwise a negative error code; -3 listening or connection in progress, -2 illegal protocol, -1 illegal state (socket is closed).
- Returns
- zero if successful otherwise negative error code.
Implements Socket.
virtual int W5100::Driver::available |
( |
| ) |
|
|
virtual |
Number of bytes available in receiver buffer.
- Returns
- bytes.
Reimplemented from IOStream::Device.
void IOStream::Device::blocking |
( |
| ) |
|
|
inlineinherited |
virtual int W5100::Driver::close |
( |
| ) |
|
|
virtual |
Close the socket. Returns zero if successful otherwise negative error code; -2 already closed.
- Parameters
-
[in] | proto | protocol. |
[in] | port | source port. |
[in] | flag | socket options. |
- Returns
- zero if successful otherwise negative error code.
Implements Socket.
virtual int W5100::Driver::connect |
( |
uint8_t |
addr[4], |
|
|
uint16_t |
port |
|
) |
| |
|
virtual |
Connect the socket to the given address and port; client mode. Returns a zero if successful otherwise a negative error code; -2 illegal protocol, -1 address/port not valid.
- Parameters
-
[in] | addr | destination address. |
[in] | port | destination port. |
- Returns
- zero if successful otherwise negative error code.
Implements Socket.
virtual int W5100::Driver::connect |
( |
const char * |
hostname, |
|
|
uint16_t |
port |
|
) |
| |
|
virtual |
Connect the socket to the given hostname and port; client mode. Returns zero if connection established otherwise negative error code.
- Parameters
-
[in] | hostname | string. |
[in] | port | destination port. |
- Returns
- zero if successful otherwise negative error code.
Implements Socket.
virtual int W5100::Driver::datagram |
( |
uint8_t |
addr[4], |
|
|
uint16_t |
port |
|
) |
| |
|
virtual |
Start the construction of a datagram to the given address and port. Checks that the socket is connection-less (UDP). Returns zero or negative error code.
- Parameters
-
[in] | addr | destination address. |
[in] | port | destination port. |
- Returns
- zero if successful otherwise negative error code.
Implements Socket.
void W5100::Driver::dev_flush |
( |
| ) |
|
|
protected |
Flush any waiting data in the socket receiver buffer.
int W5100::Driver::dev_read |
( |
void * |
buf, |
|
|
size_t |
len |
|
) |
| |
|
protected |
Read data from the socket receiver buffer to the given buffer with the given maximum size.
- Parameters
-
[in] | buf | pointer to buffer for data. |
[in] | len | maximum number of bytes in buffer. |
- Returns
- number of bytes read if successful otherwise negative error code.
void W5100::Driver::dev_setup |
( |
| ) |
|
|
protected |
Wait for given maximum message size in internal transmit buffer. Setup transmitter offset and initiate length for new message construction.
int W5100::Driver::dev_write |
( |
const void * |
buf, |
|
|
size_t |
len, |
|
|
bool |
progmem |
|
) |
| |
|
protected |
Write data to the socket transmitter buffer from the given buffer with the given number of bytes.
- Parameters
-
[in] | buf | pointer to buffer with data. |
[in] | len | number of bytes in buffer. |
[in] | progmem | program memory pointer flag. |
- Returns
- number of bytes written if successful otherwise negative error code.
virtual int W5100::Driver::disconnect |
( |
| ) |
|
|
virtual |
Disconnect socket from server. Returns zero if successful otherwise a negative error code; -2 illegal protocol.
- Returns
- zero if successful otherwise negative error code.
Implements Socket.
void IOStream::Device::empty |
( |
| ) |
|
|
virtualinherited |
void IOStream::Device::eol |
( |
Mode |
mode | ) |
|
|
inlineinherited |
Set end of line mode.
- Parameters
-
Definition at line 103 of file IOStream.hh.
Mode IOStream::Device::eol |
( |
| ) |
const |
|
inlineinherited |
Get end of line mode.
- Returns
- mode.
Definition at line 112 of file IOStream.hh.
virtual int W5100::Driver::flush |
( |
| ) |
|
|
virtual |
Flush internal device buffers. Wait for device to become idle.
- Returns
- zero(0) or negative error code.
Reimplemented from IOStream::Device.
virtual int Socket::getchar |
( |
| ) |
|
|
inlinevirtualinherited |
char * IOStream::Device::gets |
( |
char * |
s, |
|
|
size_t |
count |
|
) |
| |
|
virtualinherited |
Read string terminated by new-line or until size into given string buffer. Returns pointer to string or NULL if empty line.
- Parameters
-
[in] | s | string buffer to read into. |
[in] | count | max number of bytes to read. |
- Returns
- string pointer or NULL.
Definition at line 118 of file IOStream_Device.cpp.
bool IOStream::Device::is_blocking |
( |
| ) |
const |
|
inlineinherited |
Is blocking mode?
- Returns
- bool.
Definition at line 94 of file IOStream.hh.
virtual int W5100::Driver::is_connected |
( |
| ) |
|
|
virtual |
Returns positive integer if a connection is established, zero is not yet established, otherwise a negative error code.
- Returns
- positive integer connected, zero if not otherwise negative error code.
Implements Socket.
virtual int W5100::Driver::listen |
( |
| ) |
|
|
virtual |
Mark socket for incoming requests; server mode. Returns zero if successful otherwise negative error code; -2 illegal protocol, -1 failed to mark socket for listen (socket is closed).
- Returns
- zero if successful otherwise negative error code.
Implements Socket.
void IOStream::Device::non_blocking |
( |
| ) |
|
|
inlineinherited |
Set non-blocking mode.
Definition at line 77 of file IOStream.hh.
virtual int W5100::Driver::open |
( |
Protocol |
proto, |
|
|
uint16_t |
port, |
|
|
uint8_t |
flag |
|
) |
| |
|
virtual |
Initiate socket to the given protocol and possible port. Returns zero if successful otherwise negative error code; -2 already open, -1 failed to open socket.
- Parameters
-
[in] | proto | protocol. |
[in] | port | source port. |
[in] | flag | socket options. |
- Returns
- zero if successful otherwise negative error code.
Implements Socket.
int IOStream::Device::peekchar |
( |
| ) |
|
|
virtualinherited |
int IOStream::Device::peekchar |
( |
char |
c | ) |
|
|
virtualinherited |
Peek for the given character in device buffer. Return number of characters or EOF(-1).
- Parameters
-
[in] | c | character to peek for. |
- Returns
- available or EOF(-1).
Reimplemented in Soft::UART, UART, and IOBuffer< SIZE >.
Definition at line 105 of file IOStream_Device.cpp.
uint16_t Socket::port |
( |
| ) |
const |
|
inlineinherited |
Get socket port.
- Returns
- port.
Definition at line 78 of file Socket.hh.
Get socket protocol.
- Returns
- protocol.
Definition at line 69 of file Socket.hh.
int IOStream::Device::putchar |
( |
char |
c | ) |
|
|
virtualinherited |
Write character to device.
- Parameters
-
- Returns
- character written or EOF(-1).
Reimplemented in FAT16::File, HD44780, ST7565, PCD8544, MAX72XX, VLCD, UART, Textbox, IOBuffer< SIZE >, RS485, WIO, and Soft::UAT.
Definition at line 36 of file IOStream_Device.cpp.
int IOStream::Device::puts |
( |
const char * |
s | ) |
|
|
virtualinherited |
Write null terminated string to device. Terminating null is not written.
- Parameters
-
- Returns
- zero(0) or negative error code.
Definition at line 43 of file IOStream_Device.cpp.
int IOStream::Device::puts |
( |
str_P |
s | ) |
|
|
virtualinherited |
Write null terminated string from program memory to device. Terminating null is not written.
- Parameters
-
[in] | s | string in program memory to write. |
- Returns
- zero(0) or negative error code.
Definition at line 54 of file IOStream_Device.cpp.
int IOStream::Device::read |
( |
iovec_t * |
vec | ) |
|
|
virtualinherited |
Read data to given buffers in null terminated io vector.
- Parameters
-
[in] | vec | io vector with buffers to read into. |
- Returns
- number of bytes read or EOF(-1).
Definition at line 157 of file IOStream_Device.cpp.
virtual int W5100::Driver::read |
( |
void * |
buf, |
|
|
size_t |
size |
|
) |
| |
|
virtual |
Read data to given buffer with given size from device.
- Parameters
-
[in] | buf | buffer to read into. |
[in] | size | number of bytes to read. |
- Returns
- number of bytes read or EOF(-1).
Reimplemented from Socket.
virtual int W5100::Driver::recv |
( |
void * |
buf, |
|
|
size_t |
len |
|
) |
| |
|
virtual |
Receive data from connection-oriented socket. The data is stored in given buffer with given maximum number of bytes. Return number of bytes or negative error code; -3 socket not established, -2 illegal protocol.
- Parameters
-
[in] | buf | buffer pointer. |
[in] | len | number of bytes in buffer. |
- Returns
- number of bytes sent if successful otherwise negative error code.
Implements Socket.
virtual int W5100::Driver::recv |
( |
void * |
buf, |
|
|
size_t |
len, |
|
|
uint8_t |
src[4], |
|
|
uint16_t & |
port |
|
) |
| |
|
virtual |
Receive datagram on connectionless socket into given buffer with given maximum size. Returns zero(0) if successful with information in Datagram otherwise negative error code; -2 illegal protocol.
- Parameters
-
[in] | buf | buffer pointer. |
[in] | len | number of bytes in buffer. |
[in] | src | source address. |
[in] | port | source port. |
- Returns
- number of bytes received if successful otherwise negative error code.
Implements Socket.
virtual int W5100::Driver::room |
( |
| ) |
|
|
virtual |
Number of bytes room in transmitter buffer.
- Returns
- bytes.
Reimplemented from IOStream::Device.
int Socket::send |
( |
const void * |
buf, |
|
|
size_t |
len |
|
) |
| |
|
inlineinherited |
Send given data in buffer on connection-oriented socket. Return number of bytes or negative error code.
- Parameters
-
[in] | buf | buffer pointer. |
[in] | len | number of bytes in buffer. |
- Returns
- number of bytes sent if successful otherwise negative error code.
Definition at line 222 of file Socket.hh.
int Socket::send |
( |
const void * |
buf, |
|
|
size_t |
len, |
|
|
uint8_t |
dest[4], |
|
|
uint16_t |
port |
|
) |
| |
|
inlineinherited |
Send given data in buffer on connectionless socket as a datagram to given destination address (dest:port). Return number of bytes sent or negative error code.
- Parameters
-
[in] | buf | buffer pointer. |
[in] | len | number of bytes in buffer. |
[in] | dest | destination address. |
[in] | port | destination port. |
- Returns
- number of bytes sent if successful otherwise negative error code.
Definition at line 264 of file Socket.hh.
virtual int W5100::Driver::send |
( |
const void * |
buf, |
|
|
size_t |
len, |
|
|
bool |
progmem |
|
) |
| |
|
protectedvirtual |
Send given data in buffer on connection-oriented socket. Boolean flag progmem defined if the buffer is in program memory. Return number of bytes or negative error code; -4 socket closed by peer, -3 connection not estabilished, -2 illegal protocol.
- Parameters
-
[in] | buf | buffer pointer. |
[in] | len | number of bytes in buffer. |
[in] | progmem | program memory pointer flag. |
- Returns
- number of bytes sent if successful otherwise negative error code.
Implements Socket.
virtual int W5100::Driver::send |
( |
const void * |
buf, |
|
|
size_t |
len, |
|
|
uint8_t |
dest[4], |
|
|
uint16_t |
port, |
|
|
bool |
progmem |
|
) |
| |
|
protectedvirtual |
Send given data on connectionless socket as a datagram to given destination address (dest:port). Return number of bytes sent or negative error code; -2 illegal protocol, -1 illegal destination address or port.
- Parameters
-
[in] | buf | buffer pointer. |
[in] | len | number of bytes in buffer. |
[in] | dest | destination address. |
[in] | port | destination port. |
[in] | progmem | program memory pointer flag. |
- Returns
- number of bytes sent if successful otherwise negative error code.
Implements Socket.
int Socket::send_P |
( |
const void * |
buf, |
|
|
size_t |
len |
|
) |
| |
|
inlineinherited |
Send given data in program memory buffer on connection-oriented socket. Return number of bytes or negative error code.
- Parameters
-
[in] | buf | program memory pointer. |
[in] | len | number of bytes in buffer. |
- Returns
- number of bytes sent if successful otherwise negative error code.
Definition at line 236 of file Socket.hh.
int Socket::send_P |
( |
const void * |
buf, |
|
|
size_t |
len, |
|
|
uint8_t |
dest[4], |
|
|
uint16_t |
port |
|
) |
| |
|
inlineinherited |
Send given data in program memory buffer on connectionless socket as a datagram to given destination address (dest:port). Return number of bytes sent or negative error code.
- Parameters
-
[in] | buf | buffer pointer. |
[in] | len | number of bytes in buffer. |
[in] | dest | destination address. |
[in] | port | destination port. |
- Returns
- number of bytes sent if successful otherwise negative error code.
Definition at line 281 of file Socket.hh.
Get source machine address, network address and port.
- Parameters
-
[out] | addr | network address. |
Definition at line 60 of file Socket.hh.
virtual int Socket::write |
( |
const void * |
buf, |
|
|
size_t |
size |
|
) |
| |
|
inlinevirtualinherited |
Write data from buffer with given size to device.
- Parameters
-
[in] | buf | buffer to write. |
[in] | size | number of bytes to write. |
- Returns
- number of bytes written or EOF(-1).
Reimplemented from IOStream::Device.
Reimplemented in CC3000::Driver.
Definition at line 93 of file Socket.hh.
int IOStream::Device::write |
( |
const iovec_t * |
vec | ) |
|
|
virtualinherited |
Write data from buffers in null terminated io vector.
- Parameters
-
[in] | vec | io vector with buffers to write. |
- Returns
- number of bytes written or EOF(-1).
Definition at line 87 of file IOStream_Device.cpp.
virtual int W5100::Driver::write |
( |
const void * |
buf, |
|
|
size_t |
size, |
|
|
bool |
progmem |
|
) |
| |
|
protectedvirtual |
Write data from buffer with given size to device. Boolean flag progmem defined if the buffer is in program memory. Return number of bytes or negative error code.
- Parameters
-
[in] | buf | buffer to write. |
[in] | size | number of bytes to write. |
[in] | progmem | program memory pointer flag. |
- Returns
- number of bytes written or EOF(-1).
Reimplemented from Socket.
virtual int Socket::write_P |
( |
const void * |
buf, |
|
|
size_t |
size |
|
) |
| |
|
inlinevirtualinherited |
Write data from buffer in program memory with given size to device.
- Parameters
-
[in] | buf | buffer to write. |
[in] | size | number of bytes to write. |
- Returns
- number of bytes written or EOF(-1).
Reimplemented from IOStream::Device.
Reimplemented in CC3000::Driver.
Definition at line 105 of file Socket.hh.
const uint16_t Socket::DYNAMIC_PORT = 49152 |
|
staticinherited |
First dynamic, private or ephemeral port number.
Definition at line 34 of file Socket.hh.
bool IOStream::Device::m_blocking |
|
protectedinherited |
W5100* W5100::Driver::m_dev |
|
protected |
Pointer to device context.
Definition at line 500 of file W5100.hh.
Mode IOStream::Device::m_eol |
|
protectedinherited |
uint16_t W5100::Driver::m_rx_buf |
|
protected |
Pointer to socket receiver buffer.
Definition at line 512 of file W5100.hh.
Source address; MAC, IP and port.
Definition at line 302 of file Socket.hh.
Pointer to socket registers; symbolic address calculation.
Definition at line 497 of file W5100.hh.
uint16_t W5100::Driver::m_tx_buf |
|
protected |
Pointer to socket transmitter buffer.
Definition at line 503 of file W5100.hh.
uint16_t W5100::Driver::m_tx_len |
|
protected |
Length of message in socket transmitter buffer.
Definition at line 509 of file W5100.hh.
uint16_t W5100::Driver::m_tx_offset |
|
protected |
Offset in socket transmitter buffer.
Definition at line 506 of file W5100.hh.
The documentation for this class was generated from the following file: