mbed-os/UNITTESTS/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
..
CellularNonIPSocket C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
DTLSSocket Remove internal usage of deprecated APIs in IPCore 2019-11-27 20:02:20 +02:00
DTLSSocketWrapper Allow MBED_ASSERT to throw errors in unittests, so we can verify it. 2019-11-22 13:10:46 +02:00
EthernetInterface Merge pull request #12027 from michalpasztamobica/dns_module_test 2019-12-16 09:49:16 +01:00
InternetSocket Getaddrinfo interface for multiple DNS adresses added. 2019-12-16 13:59:46 +01:00
NetworkInterface Improve doxygen and unittest coverage for API 2019-12-02 20:48:10 +02:00
NetworkStack Getaddrinfo interface for multiple DNS adresses added. 2019-12-16 13:59:46 +01:00
PPPInterface C++11-ify virtualisation in netsocket 2020-02-28 13:34:18 +02:00
SocketAddress Astyle fixes 2019-10-14 14:22:31 +03:00
TCPServer Allow MBED_ASSERT to throw errors in unittests, so we can verify it. 2019-11-22 13:10:46 +02:00
TCPSocket Improve nsapi_create_stack 2020-03-05 16:45:36 +02:00
TLSSocket unittest: fix missing licenses + spdx 2020-02-21 07:01:00 +00:00
TLSSocketWrapper unittest: fix missing licenses + spdx 2020-02-21 07:01:00 +00:00
UDPSocket Remove internal usage of deprecated APIs in IPCore 2019-11-27 20:02:20 +02:00
WiFiAccessPoint Improve doxygen and unittest coverage for API 2019-12-02 20:48:10 +02:00