Free (GPLv2) TCP/IP stack developed by TASS Belgium
Dependents: lpc1768-picotcp-demo ZeroMQ_PicoTCP_Publisher_demo TCPSocket_HelloWorld_PicoTCP Pico_TCP_UDP_Test ... more
EthernetInterface Class Reference
Interface using Ethernet to connect to an IP-based network. More...
#include <EthernetInterface.h>
Static Public Member Functions | |
static int | init () |
Initialize the interface with DHCP. | |
static int | init (const char *ip, const char *mask, const char *gateway) |
Initialize the interface with a static IP address. | |
static int | connect (unsigned int timeout_ms=15000) |
Connect Bring the interface up, start DHCP if needed. | |
static int | disconnect () |
Disconnect Bring the interface down. | |
static char * | getMACAddress () |
Get the MAC address of your Ethernet interface. | |
static char * | getIPAddress () |
Get the IP address of your Ethernet interface. | |
static int | registerLinkStatus (void(*cb)(uint32_t linkStatus)) |
Register a callback to tell the status of the link. | |
static int | setDnsServer (const char *ip) |
Set/Add an ip address of a DNS server. | |
static int | createIpFilter (char *ipAddress, char *netmask, int port, filter_type filter) |
Creates a custom rule for dropping packets. |
Detailed Description
Interface using Ethernet to connect to an IP-based network.
Definition at line 57 of file EthernetInterface.h.
Member Function Documentation
int connect | ( | unsigned int | timeout_ms = 15000 ) |
[static] |
Connect Bring the interface up, start DHCP if needed.
- Parameters:
-
timeout_ms timeout in ms (default: (10)s).
- Returns:
- 0 on success, a negative number on failure
Definition at line 181 of file EthernetInterface.cpp.
int createIpFilter | ( | char * | ipAddress, |
char * | netmask, | ||
int | port, | ||
filter_type | filter | ||
) | [static] |
Creates a custom rule for dropping packets.
If an incoming packet is destined for our stack and an input filter that matches input_src & filter_mask == filter_src & filter_mask and the ports are the same, port = 0 means any port and also filters icmp. the packet will be dropped. The same thing for an output filter. If we try to send a packet and output_dst & filter_mask == filter_dst & filter_mask and the ports are the same, the packet will be dropped. return > 0 if success, the number is the filter identifier and it will be used later to destroy the filter. return < 0 error.
Definition at line 233 of file EthernetInterface.cpp.
int disconnect | ( | ) | [static] |
Disconnect Bring the interface down.
- Returns:
- 0 on success, a negative number on failure
Definition at line 198 of file EthernetInterface.cpp.
char * getIPAddress | ( | ) | [static] |
Get the IP address of your Ethernet interface.
- Returns:
- a pointer to a string containing the IP address
Definition at line 210 of file EthernetInterface.cpp.
char * getMACAddress | ( | ) | [static] |
Get the MAC address of your Ethernet interface.
- Returns:
- a pointer to a string containing the MAC address
Definition at line 206 of file EthernetInterface.cpp.
int init | ( | const char * | ip, |
const char * | mask, | ||
const char * | gateway | ||
) | [static] |
Initialize the interface with a static IP address.
Initialize the interface and configure it with the following static configuration (no connection at this point).
- Parameters:
-
ip the IP address to use mask the IP address mask gateway the gateway to use
- Returns:
- 0 on success, a negative number on failure
Definition at line 155 of file EthernetInterface.cpp.
int init | ( | ) | [static] |
Initialize the interface with DHCP.
Initialize the interface and configure it to use DHCP (no connection at this point).
- Returns:
- 0 on success, a negative number on failure
Definition at line 147 of file EthernetInterface.cpp.
int registerLinkStatus | ( | void(*)(uint32_t linkStatus) | cb ) | [static] |
Register a callback to tell the status of the link.
- Returns:
- 0 if callback was registered.
Definition at line 222 of file EthernetInterface.cpp.
int setDnsServer | ( | const char * | ip ) | [static] |
Set/Add an ip address of a DNS server.
- Returns:
- 0 on success, a negative number on failure
Definition at line 228 of file EthernetInterface.cpp.
Generated on Tue Jul 12 2022 15:59:22 by 1.7.2