mbed-os/features/netsocket
Kevin Bracey 70a6701006 Improve nsapi_create_stack
Use tag dispatch to better handle both NetworkInterface and NetworkStack
pointers.

The previous design was intended to avoid ambiguities when presented
with a scenario like

    class MyDevice : public NetworkInterface, public NetworkStack {
    };

    TCPSocket(&MyDevice);
    // Need NetworkStack *: use NetworkInterface::get_stack or
    // cast to NetworkStack?

But the previous solution didn't actually work as intended. The overload
pair

    nsapi_create_stack(NetworkStack *);
    // versus
    template <class IF>
    nsapi_create_stack(IF *);

would only select the first form if passed an exact match -
`NetworkStack *`. If passed a derived class pointer, like `MyDevice *`,
it would select the template.

This meant that an ambiguity for MyDevice was at least avoided, but
in the wrong direction, potentially increasing code size.

But in other cases, the system just didn't work at all - you couldn't
pass a `MyStack *` pointer, unless you cast it to `NetworkStack *`.
Quite a few bits of test code do this.

Add a small bit of tag dispatch to prioritise the cast whenever the
supplied pointer is convertible to `NetworkStack *`.
2020-03-05 16:45:36 +02:00
..
emac-drivers STM32 EMAC : add PHY ID information 2020-03-02 16:21:35 +01:00
ppp C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
CellularInterface.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
CellularNonIPSocket.cpp C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
CellularNonIPSocket.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
ControlPlane_netif.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
DNS.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
DTLSSocket.cpp IPCore deprecated string-based API removal 2020-02-06 11:27:49 +02:00
DTLSSocket.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
DTLSSocketWrapper.cpp C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
DTLSSocketWrapper.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
EMAC.h Edit EMAC.h 2018-10-29 15:14:07 -05:00
EMACInterface.cpp C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
EMACInterface.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
EMACMemoryManager.h L3IP Interface Implementation 2018-12-20 15:23:43 +01:00
EthInterface.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
EthernetInterface.cpp Add NetworkInterface::get_default_instance() 2018-05-23 12:25:17 +03:00
EthernetInterface.h doxygen fixes 2018-10-24 20:24:33 +01:00
ICMPSocket.cpp C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
ICMPSocket.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
InternetDatagramSocket.cpp IPCore deprecated string-based API removal 2020-02-06 11:27:49 +02:00
InternetDatagramSocket.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
InternetSocket.cpp C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
InternetSocket.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
L3IP.h Deprecate string-based APIs in IPCore 2019-11-22 11:31:12 +02:00
L3IPInterface.cpp Fix L3IPInterface to use SocketAddress class for addresses 2020-03-03 12:13:51 +02:00
L3IPInterface.h Fix L3IPInterface to use SocketAddress class for addresses 2020-03-03 12:13:51 +02:00
MeshInterface.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
NetStackMemoryManager.cpp L3IP Interface Implementation 2018-12-20 15:23:43 +01:00
NetStackMemoryManager.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
NetworkInterface.cpp IPCore deprecated string-based API removal 2020-02-06 11:27:49 +02:00
NetworkInterface.h Improve nsapi_create_stack 2020-03-05 16:45:36 +02:00
NetworkInterfaceDefaults.cpp CellularBase -> CellularInterface tidy 2019-03-20 10:12:14 +02:00
NetworkStack.cpp Merge pull request #12467 from kjbracey-arm/nsapics 2020-03-03 14:13:28 +00:00
NetworkStack.h Improve nsapi_create_stack 2020-03-05 16:45:36 +02:00
OnboardNetworkStack.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
PPP.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
PPPInterface.cpp C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
PPPInterface.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
Socket.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
SocketAddress.cpp ONME-4433 SocketAddress::operator== should also check port 2019-12-16 15:38:49 +01:00
SocketAddress.h Improve doxygen and unittest coverage for API 2019-12-02 20:48:10 +02:00
SocketStats.cpp Move socket-stats-enable to socket-stats-enabled. 2019-03-01 13:31:33 -06:00
SocketStats.h Update recently added previous macro name uses in tests 2019-03-01 13:53:47 -06:00
TCPServer.cpp C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
TCPServer.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
TCPSocket.cpp C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
TCPSocket.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
TLSSocket.cpp C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
TLSSocket.h TLSSocket: Remove deprecated connect 2020-03-03 12:08:32 +02:00
TLSSocketWrapper.cpp C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
TLSSocketWrapper.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
UDPSocket.cpp Incorporate review comments from @kjbracey-arm 2019-10-25 10:51:50 -07:00
UDPSocket.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
WiFiAccessPoint.cpp C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
WiFiAccessPoint.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
WiFiInterface.h C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
mbed_lib.json Getaddrinfo interface for multiple DNS adresses added. 2019-12-16 13:59:46 +01:00
nsapi.h Remove CellularBase and AT_CellularBase 2019-12-09 15:25:22 +02:00
nsapi_dns.cpp Getaddrinfo interface for multiple DNS adresses added. 2019-12-16 13:59:46 +01:00
nsapi_dns.h Improve doxygen and unittest coverage for API 2019-12-02 20:48:10 +02:00
nsapi_ppp.h Turn NULLs into nullptr 2020-01-09 14:52:54 +02:00
nsapi_types.h Incorporate review comments from @kjbracey-arm 2019-10-25 10:51:50 -07:00