Releases: ssilverman/QNEthernet
Releases · ssilverman/QNEthernet
0.22.0
Added
EthernetClass::setDHCPEnabled(flag)
enables or disables the DHCP client. May be called either before or after Ethernet has started.EthernetClass::isDHCPEnabled()
returns whether the DHCP client is enabled. Valid whether Ethernet has been started or not.- New
LinkWatcher
example. - Added support for building for unsupported boards via a new bare lwIP driver.
Changed
- Limit the number of times
enet_proc_input()
can loop to twice the ring size. - Limit UDP output size to the maximum possible (65535 - 28(total header)).
- It's now possible to know when adding or removing a MAC address filter failed.
- Make it possible to disable and exclude DHCP, DNS, IGMP, TCP, and UDP.
- Changed
EthernetClass::setMACAddress(mac)
to use the built-in MAC address if the given array is NULL. - Changed
EthernetClass::begin(mac)
to wait for an IP address. The default is a 60-second timeout. There's also a new, optional,timeout
parameter for specifying that timeout. This change makes the API match the Arduino Ethernet API. - Renamed
enet_getmac(mac)
toenet_get_mac(mac)
. - Better NULL argument checking.
- Simplified
ServerWithListeners
example. - Changed
enet_init(...)
to return abool
for detecting init. failure.
Fixed
- Fixed how
EthernetClient
functions work when there's a pending connect triggered byconnectNoWait()
. - Fixed how raw frame size limits are checked. Padding is already handled by the MAC.
- Fixed compilation if
LWIP_IGMP
is disabled, including makingLWIP_MDNS_RESPONDER
dependent onLWIP_IGMP
(in addition toLWIP_UDP
). - Improved
trng_is_started()
by adding an additional check for the "OK to stop" bit. It now works at system startup if the clock is already running.
0.21.0
Added
- Added
EthernetClass::linkIsCrossover()
for checking if a crossover cable is detected. - Added entropy-based random number functions,
entropy_random()
andentropy_random_range(range)
. The second uses an unbiased algorithm.
Changed
- Renamed TRNG tests to test_entropy.
- Added calling file, line, and function information to
LWIP_ASSERT_CORE_LOCKED()
. - Un-deprecated
EthernetClass::MACAddress(mac)
andsetDnsServerIP(ip)
. - Optimized byte-swapping by using GCC built-ins.
Fixed
- Reset the PHY in a much more conservative way. Hopefully this helps with restarting Ethernet causing packets to not be received.
- Fixed dhcp struct assignment to be done each time the netif is added. This addresses
netif_add()
clearing all the client data. - Fixed
LWIP_PLATFORM_ASSERT()
to flush stdout's underlyingPrint
object. This ensures all output for an assertion failure gets sent out before the call toabort()
. - Fixed the link status values changing after setting the link up.
0.20.0
Added
- Added
EthernetFrameClass::size()
, for parity withEthernetUDP
. - Added internal entropy functions to remove the Entropy library dependency.
- New
QNETHERNET_ENABLE_CUSTOM_WRITE
macro for enabling the inclusion of the expandedstdio
output behaviour. - Added a bunch of unit tests. These use the Unity test framework from within PlatformIO.
- Added sections to the README that describe how to configure compiler options for both the Arduino IDE and PlatformIO.
- Added an
AltcpTemplate
example. - Added a
BroadcastChat
example that implements a simple chat over UDP.
Changed
- Updated
StdioPrint
adapter to use errors better.errno
is set for the "write error" value and the stdio error state is cleared appropriately when the functions detect that "write error" is back to zero. - Changed default
stdio
output behaviour to use the new system default. (This exists as of Teensyduino 1.58-beta4.) See:QNETHERNET_ENABLE_CUSTOM_WRITE
. - Added a timeout parameter to the callback version of
DNSClient::getHostByName()
. This helps prevent any references from going out of scope before the callback is called. - Changed
EthernetUDP::send()
functions back to returning a Boolean value. - There's now
Print
objects for each ofstdout
andstderr
:stdoutPrint
andstderrPrint
. - Improved
RawFrameMonitor
andSNTPClient
examples. - Changed "tcp" calls to "altcp" calls so that it's easier to add things like TLS and proxy support. There's accompanying
qnethernet_get_allocator(...)
andqnethernet_free_allocator(...)
functions that need to be defined by the application code if theLWIP_ALTCP
option is enabled.
Removed
QNETHERNET_WEAK_WRITE
macro in favour of the new way to enable the library's internal_write()
definition. See:QNETHERNET_ENABLE_CUSTOM_WRITE
.- Removed sending a DHCP INFORM message when setting a static IP. It seemed to interfere with any first subsequent DHCP requests.
Fixed
- Fixed
EthernetClass::end()
to callclearEvent()
before detaching the event responder. - Fixed DNS client to be aware of lookup failures.
- Added set-no-address and link-down calls to
EthernetClass::end()
before bringing the interface down. This ensures all the callbacks are called. - Fixed
EthernetUDP::parsePacket()
to also callEthernet.loop()
when there's no packet available. - Increased PHY reset pulse and reset-to-MDIO times. Hopefully this fixes slow traffic after restarting the system via
Ethernet.end()
.
0.19.0
Added
- Added
Ethernet.loop()
calls to theEthernetClient::write()
functions when the send buffer is full. - Added Ethernet hardware detection to support (well, "non-support") the Teensy 4.1 NE.
Changed
- Updated lwipopts.h to examine
LWIP_MDNS_RESPONDER
when setting certain values. Ethernet.loop()
calls are now attached/detached to/from yield inEthernet.begin(...)
/end()
.- Improved pin configurations and comments.
- Disabled
LWIP_STATS
option by default. Saves a little memory. - Updated Arduino Ethernet API links in keywords.txt.
- Only add 1 to
MEMP_NUM_SYS_TIMEOUT
option for mDNS instead of 3. - Updated examples to use both address and link state on network changes. This accommodates when a static IP is used.
- Changed UDP and TCP PCB creation to use an appropriate
ip_addr_t
type instead of the unspecified default. - Changed CRC-32 function for multicast lookup to not use a lookup table. This saves 1KiB of flash but makes the calculation about 4.7x slower but still in the microsecond range (~0.090µs -> ~0.42µs).
- Moved
EthernetClass
,EthernetFrameClass
, andMDNSClass
constructors and destructors toFLASHMEM
(where possible). This saves a little RAM1 space. - Moved lwIP's memory pools into 4-byte aligned
DMAMEM
(RAM2). This saves a lot of RAM1 space, about 27KiB with the current configuration. - Changed the promiscuous mode macro name from
QNETHERNET_PROMISCUOUS_MODE
toQNETHERNET_ENABLE_PROMISCUOUS_MODE
. - Changed all the DHCP timeouts in the examples to 15 seconds.
- Changed
EthernetUDP::send()
functions to return an lwIP error code instead of a 1-or-0 Boolean value. Zero (ERR_OK
) means no error. This makes it easier to diagnose any problems.
Fixed
- Reverted how interrupts were being cleared to use assignment instead of OR'ing the bits. This seemed to fix an apparent freeze. (See this issue: #26)
- Fixed a signedness comparison warning in
OSCPrinter
example. - Addressed "extra" (
-Wextra
) and pedantic (-Wpedantic
) warnings.
0.18.0
Added
- Added a "Notes on ordering and timing" section to the README.
- Added a README section that discusses
EthernetClient::connect()
and its return values. - Added non-blocking TCP connection functions,
connectNoWait()
, that are equivalent to theconnect()
functions but don't wait for the connection to complete. - Added
EthernetUDP::beginWithReuse()
andbeginMulticastWithReuse()
functions to replace the corresponding begin-with-reuse-parameter versions. - Added printing the link speed and duplex in the IPerfServer example.
- Added an "Asynchronous use is not supported" section to the README.
- New
EthernetClass::onInterfaceStatus(callback)
andinterfaceStatus()
functions for tracking the network interface status. - Added a check to ensure lwIP isn't called from an interrupt context.
Changed
- Wrapped
LWIP_MDNS_RESPONDER
option inlwipopts.h
with#ifndef
and added it to the README. - Made
EthernetClass::loop()
non-static. - Changed serial output in examples to use CRLF line endings.
- Changed
EthernetClient::connect()
internals to callclose()
instead ofstop()
so that any cleanup doesn't block. - Updated
EthernetClient::connect()
to return some of the error codes defined at Ethernet - client.connect(). - Changed
EthernetServer::begin()
-with-Boolean-reuse-parameters to be namedbeginWithReuse()
. This avoids too many overloads with mysterious Boolean arguments. - Changed
EthernetServer::operator bool()
to beconst
. - Changed
EthernetServer::end()
to returnvoid
instead ofbool
. - Changed
MDNSClass::begin(hostname)
andDNSClient::getHostByName()
to treat a NULL hostname as an error; they now explicitly return false in this case. - Changed
MDNSClass::end()
to returnvoid
instead ofbool
. - Changed examples that use
unsigned char
to useuint8_t
in appropriate places. EthernetUDP::begin
functions now callstop()
if the socket is listening and the parameters have changed.MDNSClass::begin(hostname)
now callsend()
if the responder is running and the hostname changed.- Changed both
EthernetServer
andEthernetUDP
to disallow copying but allow moving. - Changed raw frame support to be excluded by default. This changed the
QNETHERNET_DISABLE_RAW_FRAME_SUPPORT
macro toQNETHERNET_ENABLE_RAW_FRAME_SUPPORT
. - Changed
tcp_pcb
member accesses to use appropriate TCP API function calls. This fixes use of the altcp API.
Removed
EthernetServer
andEthernetUDP
begin functions that take a Booleanreuse
parameter.
Fixed
EthernetUDP::begin
functions now callstop()
if there was a bind error.- Fixed
EthernetClient::setNoDelay(flag)
to actually use theflag
argument. The function was always setting the TCP flag, regardless of the value of the argument. - Fixed printing unknown netif name characters in some debug messages.
- Fixed
EthernetClient::connect()
andclose()
operations to check the internal connection object for NULL acrossyield()
calls. - Fixed
lwip_strerr()
buffer size to include the potential sign. - Don't close the TCP pcb on error since it's already been freed.
0.17.0
Added
- The library now, by default, puts the RX and TX buffers in RAM2 (DMAMEM). This behaviour can be overridden by defining the new
QNETHERNET_BUFFERS_IN_RAM1
macro. - Added separate
stderr
output support with the newstderrPrint
variable. If set to NULL,stderr
defaults to the usualstdPrint
. - Added
MDNSClass::operator bool()
for determining whether mDNS has been started. - Added
MDNSClass::restart()
for when a cable has been disconnected for a while and then reconnected. - Added
EthernetFrameClass::setReceiveQueueSize(size)
for setting the receive queue size. This replaces theQNETHERNET_FRAME_QUEUE_SIZE
macro. - Added a way to disable raw frame support: define the new
QNETHERNET_DISABLE_RAW_FRAME_SUPPORT
macro. - Added a "Complete list of features" section to the README.
- Added
MDNSClass::hostname()
for returning the hostname of the responder, if running. - Added
EthernetUDP::operator bool()
. - Added an already-started check to
MDNSClass
. - New section in the README: "
operator bool()
andexplicit
". It addresses problems that may arise withexplicit operator bool()
. - Added
EthernetClient::connectionId()
for identifying connections across possibly multipleEthernetClient
objects. - Added
EthernetClass::isDHCPActive()
.
Changed
- Improved error code messages in
lwip_strerr(err)
. This is used whenLWIP_DEBUG
is defined. - Now shutting down mDNS too in
EthernetClass::end()
. - Now using overloads instead of default arguments in
EthernetClass
andEthernetUDP
. - Changed
EthernetClass
andMDNSClass
String
functions to takeconst char *
instead. - Made all
operator bool()
functionsexplicit
.
See: https://en.cppreference.com/w/cpp/language/implicit_conversion#The_safe_bool_problem MDNSClass::removeService()
now returnsfalse
instead oftrue
if mDNS has not been started.- Enable definition of certain macros in
lwipopts.h
from the command line. - Changed API uses of
unsigned char
touint8_t
, for consistency.
Removed
- Removed the
QNETHERNET_FRAME_QUEUE_SIZE
macro and replaced it withEthernetFrame.setReceiveQueueSize(size)
.
Fixed
- Disallow
stdin
in_write()
.
0.16.0
Added
EthernetUDP::size()
: Returns the total size of the received packet data.- Added an optional "dns" parameter to the three-parameter Ethernet.begin() that defaults to unset. This ensures that the DNS server IP is set before the address-changed callback is called.
- Added configurable packet buffering to UDP reception with the new
EthernetUDP(queueSize)
constructor. The default and minimum queue size is 1. - Added configurable frame buffering to raw frame reception with the new
QNETHERNET_FRAME_QUEUE_SIZE
macro. Its default is 1. - Added a new "Configuration macros" section to the README that summarizes all the configuration macros.
Changed
- Changed
EthernetUDP::parsePacket()
to return zero for empty packets and -1 if nothing is available.
0.15.0
Added
- Added a way to enable promiscuous mode: define the
QNETHERNET_PROMISCUOUS_MODE
macro. - Added a way to remove all the mDNS code: set
LWIP_MDNS_RESPONDER
to0
inlwipopts.h
. - Added support for ".local" name lookups.
- Added the ability, in the mDNS client, to specify a service name that's different from the host name.
- Added
EthernetClient::abort()
for killing connections without going through the TCP close process. - New sections in the README:
- "How to change the number of sockets", and
- "On connections that hang around after cable disconnect".
- An
EthernetServer
instance can now be created without setting the port. There are two newbegin()
functions for setting the port:begin(port)
begin(port, reuse)
Changed
- Moved CRC-32 lookup table to PROGMEM.
- Changed in
EthernetServer
:port()
returns anint32_t
instead of auint16_t
so that -1 can represent an unset port; non-negative values are still 16-bit quantitiesbegin(reuse)
now returns abool
instead ofvoid
, indicating success- The
EthernetServer
destructor now callsend()
Removed
- Removed some unneeded network interfaces:
- IEEE 802.1D MAC Bridge
- 6LowPAN
- PPP
- SLIP
- ZigBee Encapsulation Protocol
- Removed HTTPD options from
lwipopts.h
.
0.14.0
Added
- Added a
util::StdioPrint
class, aPrint
decorator for stdio output files. It routesPrint
functions to a specificFILE*
. This exists mainly to make it easy to usePrintable
objects without needing a prior call tofflush()
. - Added
MDNSClass::maxServices()
. - Added
operator==()
andoperator!=()
operators forconst IPAddress
. They are in the usual namespace. These allow==
to be used withconst IPAddress
values without having to useconst_cast
, and also introduce the completely missing!=
operator. - Added a way to declare the
_write()
function as weak via a newQNETHERNET_WEAK_WRITE
macro. Defining this macro will cause the function to be declared as weak. - Implemented
EthernetFrameClass::availableForWrite()
. - Added size limiting to
EthernetFrameClass
write functions. - New
EthernetClass::waitForLink(timeout)
function that waits for a link to be detected. - Added a way to allow or disallow receiving frames addressed to specific MAC addresses:
EthernetClass::setMACAddressAllowed(mac, flag)
Changed
- Updated
SNTPClient
example to useEthernetUDP::send()
instead ofbeginPacket()
/write()
/endPacket()
. - Updated
PixelPusherServer
example to use the frame average for the update period. - Implemented
EthernetHardwareStatus
enum for the deprecatedEthernet.hardwareStatus()
function. This replaces the zero return value with the new non-zeroEthernetOtherHardware
. - Cleaned up how internal IP addresses are used.
- Changed
_write()
(stdio) to do nothing if the requested length is zero because that's whatfwrite()
is specified to do. - Updated examples to use new
operator!=()
forIPAddress
. - Moved lwIP's heap to RAM2 (DMAMEM).
- Updated
EthernetFrame
-related documentation to explain that the API doesn't receive any known Ethernet frame types, including IPv4, ARP, and IPv6 (if enabled). - Clarified in the examples that
Ethernet.macAddress()
retrieves, not sets. - Changed
EthernetClass::setMACAddress(mac)
parameter toconst
. - Moved CRC-32 lookup table to RAM2 (DMAMEM).
- Made const those functions which could be made const.
- Updated examples and README to consider listeners and their relationship with a static IP and link detection.
Fixed
- Fixed
EthernetUDP::send()
function to take the host and port as arguments, per its description. There's now two of them: one that takes anIPAddress
and another that takes achar *
hostname. - Fixed
enet_output_frame()
to correctly returnfalse
if Ethernet is not initialized. - Fixed not being able to set the DNS server IP before starting Ethernet.
- Fixed raw frame API to consider any padding bytes.
0.13.0
Added
EthernetFrame
convenience functions that also write the header:beginFrame(dstAddr, srcAddr, typeOrLen)
beginVLANFrame(dstAddr, srcAddr, vlanInfo, typeOrLen)
qindesign::network::util
Print utility functions. Thebreakf
function parameter is used as the stopping condition inwriteFully()
.writeFully(Print &, buf, size, breakf = nullptr)
writeMagic(Print &, mac, breakf = nullptr)
enet_deinit()
now gracefully stops any transmission in progress before shutting down Ethernet.EthernetClass
functions:linkIsFullDuplex()
: Returns whether the link is full duplex (true
) or half duplex (false
).broadcastIP()
: Returns the broadcast IP address associated with the current local IP and subnet mask.
- Functions that return a pointer to the received data:
EthernetUDP::data()
EthernetFrame::data()
DNSClient::getServer(index)
function for retrieving a specific DNS server address.EthernetUDP::localPort()
: Returns the port to which the socket is bound.- Three new examples:
IPerfServer
OSCPrinter
PixelPusherServer
Changed
- The
EthernetClient::writeFully()
functions were changed to return the number of bytes actually written. These can break early if the connection was closed while attempting to send the bytes. - Changed
EthernetClient::writeFully()
functions to use the newwriteFully()
Print utility function. - Changed the
Ethernet
object to be a reference to a singleton. This matches how theEthernetFrame
object works. - Changed the
read(buf, len)
functions to allow a NULL buffer so that the caller can skip data without having to read into a buffer. - Moved internal classes and structs into an "internal" namespace to avoid any potential contflicts with user declarations.
Removed
- Removed IEEE 1588 initialization and timer read.
Fixed
- Fixed
EthernetClient::availableForWrite()
to re-check the state after the call toEthernetClass::loop()
.