Releases: ssilverman/QNEthernet
Releases · ssilverman/QNEthernet
0.29.1
Fixed
- Fixed being able to process more than one incoming frame in a row in the driver.
0.29.0
Added
- Added protected access to the internal
std::FILE*
stream in theStdioPrint
utility class. - Added more unit tests:
- test_ethernet:
- test_server_zero_port
- test_server_accept
- test_server_construct_int_port
- test_ethernet:
- Added
printf
format string checking forPrint
-derived classes. As of this writing, Teensyduino (1.59) and other platforms don't do compiler checking forPrint::printf
. - Added more support for
errno
. Appropriate functions will set this after encountering an error. - Added tests for the Arduino-API
begin(...)
functions. - Added a way to utilize an externally-defined driver.
- Added
driver_is_mac_settable()
to the driver API. This checks if the MAC address can be set.
Changed
- Updated and improved PixelPusherServer example.
- Call
qnethernet_hal_get_system_mac_address(mac)
in the unsupported driver'sdriver_get_system_mac(mac)
implementation. This enables MAC address retrieval for more platforms when communication isn't needed; Teensy 4.0, for example. - Turned the internal MAC address into an optional and simplified the
Ethernet
constructor. This change should make it easier to initialze a MAC address from a custom driver. - Changed Arduino-API non-DHCP
begin(...)
functions to returnbool
. - Improved driver logic so that lwIP options can be included in the driver headers.
- Improved
OSCPrinter
example to use the UDP data directly. - Renamed
driver_set_mac_address_allowed()
todriver_set_incoming_mac_address_allowed()
. - Changed
driver_proc_input(netif)
to return apbuf*
.
Fixed
- Fixed
EthernetServer::port()
to return the system-chosen port if a zero value was specified. - Fixed
EthernetUDP::stop()
to leave any multicast group joined when starting to listen on a multicast address. - Fixed MAC address restore if an Arduino-API non-DHCP
begin(...)
call fails. - Fixed
EthernetClient::read()
andpeek()
to return -1 instead of 0 when there's no internal state. - Properly initializing multicast filtering so that it happens before
igmp_start()
, which sets up the all-systems group.
0.28.0
Added
- Added raw frame loopback support and a
QNETHERNET_ENABLE_RAW_FRAME_LOOPBACK
macro to enable. - Added a fourth step to the MbedTLSDemo example instructions: modify the config.
- New
EthernetFrameClass
functions:destinationMAC()
,sourceMAC()
,etherTypeOrLength()
, andpayload()
. - Consolidated all the hardware abstraction layer (HAL) functions into one place:
qnethernet_hal.cpp
. - New
NullPrint
andPrintDecorator
utility classes in theqindesign::network::util
namespace. - Added
driver_is_link_state_detectable()
function to the driver. This is for detecting whether the hardware is able to read the link state. - Added
EthernetClass::isLinkStateDetectable()
to detect whether the driver is capable of detecting link state. - Added
setOutgoingDiffServ(ds)
andoutgoingDiffServ()
functions for modifying and accessing the differentiated services (DiffServ) field, respectively, in the outgoing IP header, toEthernetClient
andEthernetUDP
. - Added
EthernetUDP::receivedDiffServ()
for retrieving the DiffServ value of the last received packet. - Added
EthernetFrameClass::clear()
for clearing the outgoing and incoming buffers.
Changed
- Updated the Mbed TLS version in the README and comments to 2.28.8 (was 2.28.6).
- Updated
mbedtls_hardware_poll()
in MbedTLSDemo example for other platforms. - Renamed
QNETHERNET_ENABLE_CUSTOM_WRITE
toQNETHERNET_CUSTOM_WRITE
. - Improved the PixelPusherServer example.
- The address-changed callback is now called for independent IP address, netmask, and gateway changes.
- Improved link function documentation for
linkStatus()
,linkState()
, andisLinkStateDetectable()
. - Updated
EthernetClient::setNoDelay(flag)
to return whether successful. - Add another 2 to
MEMP_NUM_SYS_TIMEOUT
option for mDNS, for a total of an additional 8. Timeout exhaustion was still observed with 6. Why 8 and not 7: - Updated
EthernetClient::connect()
to return a Boolean value. (The function signatures don't change; they still return anint
.) This matches the new definition at Ethernet - client.connect(). - Changed
EthernetClient::connectNoWait()
return types tobool
.
Fixed
- Improved marking of unused parameters.
- Fixed up use of
__has_include()
, per: __has_include (The C Preprocessor) - In mDNS, ensure there's at least an empty TXT record, otherwise the SRV record doesn't appear.
- Make the alternative
yield()
implementationextern "C"
. - Fixed
EthernetUDP
data copy for zero-length outgoing packets.pbuf_take()
considers NULL data an error, so only copy the data if the packet's size is not zero.
0.27.0
Added
- New
QNETHERNET_FLUSH_AFTER_WRITE
configuration macro for flushing after every call toEthernetClient::write()
. This may reduce TCP efficiency. - Added a W5500 driver.
- Added a new
EthernetHardwareStatus::EthernetTeensy41
enum value. - New
QNETHERNET_DEFAULT_HOSTNAME
option.
Changed
- Made it easier to add other low-level drivers.
- Redesigned the driver interface.
- Un-deprecated
EthernetClass::begin(mac, timeout)
andbegin(mac, ip, dns, gateway, subnet)
. - Un-deprecated
EthernetClass::init(sspin)
and added a driver function for setting the chip select pin. The type ofsspin
was also changed toint
. - Removed dependency on
elapsedMillis
. This might help with compiling for other platforms. - Made the library easier to compile for other platforms.
- Replaced all
#define
guards with#pragma once
. - All
QNETHERNET_*
configuration macros can now be defined in a newqnethernet_opts.h
file in addition to the project build. - Removed test dependencies on Teensy-specific things.
- Renamed t41 driver source files to use teensy41 in the name instead.
- Changed return type of
EthernetUDP::beginWithReuse()
andbeginMulticastWithReuse()
tobool
. - Using better randomness for
LWIP_RAND()
. - Changed attributes to use the C++ style.
- Changed the default hostname to "qnethernet-lwip".
- Renamed
enet_get_mac(mac)
toenet_get_system_mac(mac)
.
Fixed
- Added missing
hostByName
to keywords.txt. - Fixed
enet_output_frame()
to return false if there's no output buffer. - Fixed
EthernetClient::write(buf, size)
to re-check the state after a call toloop()
. - Fixed
util::writeMagic()
mac
parameter to beconst
. - Fixed
test_ethernet
'stearDown()
to remove listeners before callingEthernet.end()
. This ensures no out-of-scope variables are accessed. - Updated
StdioPrint
to not useerrno
because stdio doesn't set this.
0.26.0
Added
- Added
EthernetClient::localIP()
. - Added
EthernetClass::hostByName(hostname, ip)
convenience function. - Added
EthernetClass::setDNSServerIP(index, ip)
anddnsServerIP(index)
. - Added some support for Mbed TLS v2.x.x. There's four new adapter functions for assisting integration (see src/altcp_tls_adapter.cpp), included if the
QNETHERNET_ALTCP_TLS_ADAPTER
option is set:qnethernet_altcp_is_tls
qnethernet_altcp_tls_client_cert
qnethernet_altcp_tls_server_cert_count
qnethernet_altcp_tls_server_cert
- Added MbedTLSDemo example.
- Added printing the message size in LengthWidthServer example.
- Added
QNETHERNET_ENABLE_ALTCP_DEFAULT_FUNCTIONS
-gated default implementations of the altcp interface functions. - Added
EthernetClass::macAddress()
for returning a pointer to the current MAC address.
Changed
- Updated lwIP to the latest master (5e3268cf).
- Made the driver non-blocking:
- TX: if there's no available buffer descriptors (returns ERR_WOULDBLOCK)
- Link checks via MDIO
- Updated the tests:
- Added a 10s connection timeout to
test_client_addr_info()
- Added SNTP retries to
test_udp()
- Updated and added some messages
- Added a 10s connection timeout to
- Made
MDNSClass::Service::operator==()
const
. - Completely revamped PHY and pin initialization.
- Gated PHY and Ethernet shutdown in
EthernetClass::end()
with a macro; the default behaviour is to not execute these blocks. This and the previous are part of the quest to figure out why performance drops off a cliff when Ethernet is restarted via first callingend()
. - Changed return type of
qnethernet_get_allocator
tobool
. - Renamed
qnethernet_get_allocator
andqnethernet_free_allocator
toqnetheret_altcp_get_allocator
andqnethernet_altcp_free_allocator
, respectively. - Changed
qnethernet_get_allocator
andqnethernet_free_allocator
allocator
parameter to be a reference. - Renamed
QNETHERNET_MEMORY_IN_RAM1
toQNETHERNET_LWIP_MEMORY_IN_RAM1
. - Updated the AltcpTemplate example.
- Fixed
IPAddress
-related build problems with the new Teensyduino 1.54-beta4. - Updated the RawFrameMonitor example with information about how to disable DHCP.
- Disabled waiting in
EthernetClient::close()
for altcp clients because it's not defined. - Changed configuration macro checks to use value instead of definedness.
Fixed
- Fixed a
printf
conversion specifier in the RandomNumbers example. This was causing a compile warning. - Fixed location of STATIC_INIT_DECL() for
RandomDevice
by putting it into the header. It needs to be in a place where users of the class see it. - Fixed
EthernetClass::setMACAddress()
for when the interface is up.
0.25.0
Added
- New "Heap memory use" section in the README that discusses memory allocation functions.
- New RandomNumbers example.
- Added a README subsection that talks about the
RandomDevice
class. - Added
RandomDevice::instance()
. - Added
EthernetClient::status()
for getting the TCP connection state.
Changed
- Enabled the
MEM_LIBC_MALLOC
option by default to make use of the system-defined malloc functions instead of the lwIP-defined ones. - Moved around where the netif gets its address set.
- Changed the license to "AGPL-3.0-or-later".
- Made
RandomDevice
constructor and destructor private. - Improved unit tests.
- Updated lwIP to v2.2.0.
Removed
- Removed the
extern qindesign::security::RandomDevice randomDevice
instance from QNEthernet.h because the way to access the device now is via itsinstance()
function (the constructor is also private now). (It had been added in v0.23.0.)
Fixed
- Fixed
enet_init()
to always initialize the internal MAC address on first init. - Fixed execution error when running main.cpp (
MAIN_TEST_PROGRAM
macro defined) by removingbuild_type = debug
from platformio.ini. - Fixed static initialization order for
Ethernet
,EthernetFrame
, andMDNS
singletons by using the Nifty Counter idiom.
0.24.0
Added
- The new
QNETHERNET_MEMORY_IN_RAM1
configuration macro indicates that lwIP-declared memory should go into RAM1. - New
EthernetFrameClass::receiveQueueSize()
function. - New
EthernetUDP::receiveQueueSize()
andsetReceiveQueueSize(size)
functions. - Enabled external definition of macros
LWIP_NETIF_LOOPBACK
andLWIP_LOOPBACK_MAX_PBUFS
. - Sprinkled some more
Ethernet.loop()
calls where pcb and pbuf allocations fail. - Added
EthernetClass::setLinkState(flag)
for manually setting the link state when a link is needed, such as when using the loopback feature. Network operations will usually fail unless there's a link. - Added more unit tests:
- test_ethernet:
- test_setLinkState
- test_udp_receive_queueing
- test_udp_receive_timestamp
- test_udp_state
- test_client_connectNoWait
- test_client_timeout
- test_client_state
- test_server_state
- test_other_state
- test_entropy:
- test_randomDevice
- test_ethernet:
- Added commented-out
LWIP_STATS_LARGE
option to lwipopts.h.
Changed
- Changed memory declaration macro,
LWIP_DECLARE_MEMORY_ALIGNED()
, to use theMEM_ALIGNMENT
value. - Now calling
shrink_to_fit()
on the UDP and Ethernet frame queues when changing their size. - Add 6 to
MEMP_NUM_SYS_TIMEOUT
option for mDNS instead of 5. Timeout exhaustion was still observed with 5. - There's now a single lwip_driver.h header for interfacing with the stack.
- Changed all
EthernetClass::begin(mac, ...)
functions to be consistent. If the MAC address is NULL then the MAC will be set to the internal one. Also, if starting Ethernet fails, the MAC address will not be changed. - Improved Ethernet tests to do proper object destruction when tests fail. The Unity test framework makes use of longjmp for failing tests, and that doesn't work well with object destructors.
- Unit test updates.
- Made single-argument
EthernetClass
andEthernetClient
constructors explicit.
Fixed
- Now using the correct name when adding an mDNS service.
- Pre-reserving memory for raw frames and UDP packets prematurely exhausts the heap when a larger number of them are reserved in the queue. These buffers are no longer reserved; they only grow appropriately when data comes in.
- Fixed closing
EthernetClient
s to remove the connection state if not already connected. Restarting anEthernetClient
via one of theconnectXXX()
functions callsclose()
first. If there was no connection, then closing never removed the internal connection object, causing a leak. - Fixed
Ethernet.loop()
to also poll the netif if loopback is enabled. This allows loopback to work. EthernetServer::end()
now sets the port to -1.
0.23.0
Added
- Added
qindesign::security::RandomDevice
, a class that conforms to the UniformRandomBitGenerator C++ named requirement. This makes it a little easier to generate platform-independent entropy. EthernetUDP::receivedTimestamp()
for retrieving a packet's approximate arrival time.- Added a "
writeFully()
with more break conditions" subsection to the README. EthernetFrame::receivedTimestamp()
for retrieving a frame's approximate arrival time.EthernetClient::connectionTimeout()
for getting the current timeout value.
Changed
- Changed
EthernetUDP::localPort()
to beconst
. - Changed
entropy_random_range()
to return zero ifEAGAIN
. - Changed
entropy_random_range()
to use Daniel Lemire's nearly-divisionless algorithm. - Updated lwIP to v2.2.0-rc1.
- Made
StdioPrint
single-argument constructorexplicit
. - Updated
EthernetClass::linkStatus()
to returnEthernetLinkStatus::Unknown
if the hardware hasn't yet been probed. - Updated
AltcpTemplate
example to print proxy information. - Updated
EthernetUDP::availableForWrite()
to return the amount remaining before hitting the maximum possible payload size. - Add 5 to
MEMP_NUM_SYS_TIMEOUT
option for mDNS instead of 1.
Removed
- Removed TTL concept from
MDNSClass
. This enables it to compile with the latest lwIP.
Fixed
- Fixed
SNTP_SET_SYSTEM_TIME_US(sec, us)
definition to set the RTC directly becausesettimeofday()
doesn't exist here. - Fixed
AltcpTemplate
example so that it compiles whenLWIP_ALTCP
isn't set.
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.