Skip to content

Releases: ssilverman/QNEthernet

0.22.0

25 Jun 19:25
Compare
Choose a tag to compare
0.22.0 Pre-release
Pre-release

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) to enet_get_mac(mac).
  • Better NULL argument checking.
  • Simplified ServerWithListeners example.
  • Changed enet_init(...) to return a bool for detecting init. failure.

Fixed

  • Fixed how EthernetClient functions work when there's a pending connect triggered by connectNoWait().
  • Fixed how raw frame size limits are checked. Padding is already handled by the MAC.
  • Fixed compilation if LWIP_IGMP is disabled, including making LWIP_MDNS_RESPONDER dependent on LWIP_IGMP (in addition to LWIP_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

16 May 01:29
Compare
Choose a tag to compare
0.21.0 Pre-release
Pre-release

Added

  • Added EthernetClass::linkIsCrossover() for checking if a crossover cable is detected.
  • Added entropy-based random number functions, entropy_random() and entropy_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) and setDnsServerIP(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 underlying Print object. This ensures all output for an assertion failure gets sent out before the call to abort().
  • Fixed the link status values changing after setting the link up.

0.20.0

10 Apr 08:23
Compare
Choose a tag to compare
0.20.0 Pre-release
Pre-release

Added

  • Added EthernetFrameClass::size(), for parity with EthernetUDP.
  • Added internal entropy functions to remove the Entropy library dependency.
  • New QNETHERNET_ENABLE_CUSTOM_WRITE macro for enabling the inclusion of the expanded stdio 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 of stdout and stderr: stdoutPrint and stderrPrint.
  • Improved RawFrameMonitor and SNTPClient 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(...) and qnethernet_free_allocator(...) functions that need to be defined by the application code if the LWIP_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 call clearEvent() 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 call Ethernet.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

20 Mar 03:49
Compare
Choose a tag to compare
0.19.0 Pre-release
Pre-release

Added

  • Added Ethernet.loop() calls to the EthernetClient::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 in Ethernet.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, and MDNSClass constructors and destructors to FLASHMEM (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 to QNETHERNET_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

11 Feb 00:23
Compare
Choose a tag to compare
0.18.0 Pre-release
Pre-release

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 the connect() functions but don't wait for the connection to complete.
  • Added EthernetUDP::beginWithReuse() and beginMulticastWithReuse() 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) and interfaceStatus() 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 in lwipopts.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 call close() instead of stop() 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 named beginWithReuse(). This avoids too many overloads with mysterious Boolean arguments.
  • Changed EthernetServer::operator bool() to be const.
  • Changed EthernetServer::end() to return void instead of bool.
  • Changed MDNSClass::begin(hostname) and DNSClient::getHostByName() to treat a NULL hostname as an error; they now explicitly return false in this case.
  • Changed MDNSClass::end() to return void instead of bool.
  • Changed examples that use unsigned char to use uint8_t in appropriate places.
  • EthernetUDP::begin functions now call stop() if the socket is listening and the parameters have changed.
  • MDNSClass::begin(hostname) now calls end() if the responder is running and the hostname changed.
  • Changed both EthernetServer and EthernetUDP to disallow copying but allow moving.
  • Changed raw frame support to be excluded by default. This changed the QNETHERNET_DISABLE_RAW_FRAME_SUPPORT macro to QNETHERNET_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 and EthernetUDP begin functions that take a Boolean reuse parameter.

Fixed

  • EthernetUDP::begin functions now call stop() if there was a bind error.
  • Fixed EthernetClient::setNoDelay(flag) to actually use the flag 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() and close() operations to check the internal connection object for NULL across yield() 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

06 Dec 06:12
Compare
Choose a tag to compare
0.17.0 Pre-release
Pre-release

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 new stderrPrint variable. If set to NULL, stderr defaults to the usual stdPrint.
  • 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 the QNETHERNET_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() and explicit". It addresses problems that may arise with explicit operator bool().
  • Added EthernetClient::connectionId() for identifying connections across possibly multiple EthernetClient objects.
  • Added EthernetClass::isDHCPActive().

Changed

  • Improved error code messages in lwip_strerr(err). This is used when LWIP_DEBUG is defined.
  • Now shutting down mDNS too in EthernetClass::end().
  • Now using overloads instead of default arguments in EthernetClass and EthernetUDP.
  • Changed EthernetClass and MDNSClass String functions to take const char * instead.
  • Made all operator bool() functions explicit.
    See: https://en.cppreference.com/w/cpp/language/implicit_conversion#The_safe_bool_problem
  • MDNSClass::removeService() now returns false instead of true if mDNS has not been started.
  • Enable definition of certain macros in lwipopts.h from the command line.
  • Changed API uses of unsigned char to uint8_t, for consistency.

Removed

  • Removed the QNETHERNET_FRAME_QUEUE_SIZE macro and replaced it with EthernetFrame.setReceiveQueueSize(size).

Fixed

  • Disallow stdin in _write().

0.16.0

31 Oct 02:23
Compare
Choose a tag to compare
0.16.0 Pre-release
Pre-release

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

23 Jul 22:23
Compare
Choose a tag to compare
0.15.0 Pre-release
Pre-release

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 to 0 in lwipopts.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 new begin() functions for setting the port:
    • begin(port)
    • begin(port, reuse)

Changed

  • Moved CRC-32 lookup table to PROGMEM.
  • Changed in EthernetServer:
    • port() returns an int32_t instead of a uint16_t so that -1 can represent an unset port; non-negative values are still 16-bit quantities
    • begin(reuse) now returns a bool instead of void, indicating success
    • The EthernetServer destructor now calls end()

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

07 Apr 20:44
Compare
Choose a tag to compare
0.14.0 Pre-release
Pre-release

Added

  • Added a util::StdioPrint class, a Print decorator for stdio output files. It routes Print functions to a specific FILE*. This exists mainly to make it easy to use Printable objects without needing a prior call to fflush().
  • Added MDNSClass::maxServices().
  • Added operator==() and operator!=() operators for const IPAddress. They are in the usual namespace. These allow == to be used with const IPAddress values without having to use const_cast, and also introduce the completely missing != operator.
  • Added a way to declare the _write() function as weak via a new QNETHERNET_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 use EthernetUDP::send() instead of beginPacket()/write()/endPacket().
  • Updated PixelPusherServer example to use the frame average for the update period.
  • Implemented EthernetHardwareStatus enum for the deprecated Ethernet.hardwareStatus() function. This replaces the zero return value with the new non-zero EthernetOtherHardware.
  • Cleaned up how internal IP addresses are used.
  • Changed _write() (stdio) to do nothing if the requested length is zero because that's what fwrite() is specified to do.
  • Updated examples to use new operator!=() for IPAddress.
  • 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 to const.
  • 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 an IPAddress and another that takes a char * hostname.
  • Fixed enet_output_frame() to correctly return false 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

30 Jan 08:53
Compare
Choose a tag to compare
0.13.0 Pre-release
Pre-release

Added

  • EthernetFrame convenience functions that also write the header:
    • beginFrame(dstAddr, srcAddr, typeOrLen)
    • beginVLANFrame(dstAddr, srcAddr, vlanInfo, typeOrLen)
  • qindesign::network::util Print utility functions. The breakf function parameter is used as the stopping condition in writeFully().
    • 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:
    1. IPerfServer
    2. OSCPrinter
    3. 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 new writeFully() Print utility function.
  • Changed the Ethernet object to be a reference to a singleton. This matches how the EthernetFrame 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 to EthernetClass::loop().