Commit Graph

36 Commits (3847373660d0cee49404fe8e5e7fb644581400cb)

Author SHA1 Message Date
Kimmo Vaisanen 236054175b Netsocket: Remove deprecated TCPServer
TCPSocket should be used instead.
2020-04-14 12:13:08 +03:00
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
Martin Kojtal eaac84be72
Merge pull request #12467 from kjbracey-arm/nsapics
Inline nsapi_create_stack(NetworkStack)
2020-03-03 14:13:28 +00:00
Kevin Bracey d8d35eda9f C++11-ify virtualisation in netsocket
Use `override` and `final` where appropriate, and eliminate unnecessary
`virtual`.

Some other C++11 simplifications.

Reduces code size.
2020-02-28 13:34:18 +02:00
Kevin Bracey f40c5616e1 Inline nsapi_create_stack(NetworkStack)
The rather fiddly `nsapi_create_stack` template + overloads used during
socket formation don't inline their core, which is the identity operation
for `NetworkStack *` itself. Make code generation easier by having that
core be inline.
2020-02-21 15:13:14 +02:00
Michal Paszta 458957d399 IPCore deprecated string-based API removal
String-based functions should be replaced with an explicit DNS hostname resolution and a SocketAddress-based API.
2020-02-06 11:27:49 +02:00
Tymoteusz Bloch 8b2f4c2e7e Getaddrinfo interface for multiple DNS adresses added.
New members are added to the network interface
-getaddrinfo
-getaddrinfo_async
gethostbyname is unchanged but gethostbyname_async  result param now contains results od DNS records found.
Test cases for sync/async added added to DNS test folder.
2019-12-16 13:59:46 +01:00
Michal Paszta caf01479ea Improve doxygen and unittest coverage for API
Mainly focusing on hardening the tests for return values.
2019-12-02 20:48:10 +02:00
Michal Paszta fd5b4b9119 Deprecate string-based APIs in IPCore
MBED_DEPRECATE macros is added to string-based APIs.
New, non-string-based APIs are added in their place.
Wiced binaries rebuilt
Any existing stubs or mocks are adjusted to compile and run with the newly added non-string based functions.
2019-11-22 11:31:12 +02:00
Martin Kojtal f27aec3377
Merge pull request #11279 from cy-jayasankar/pr/added-ipv6-link-local-address-api
Add API to get ipv6 link local address
2019-11-04 15:28:41 +01:00
Jayasankar Nara cb51fa57e2 Add API to get ipv6 link local address.
Protocols like mdns requires IPv6 link local address to be advertised in its
records (AAAA record). LWIP::Interface::bringup() API is creating IPv6 link
local address;But as of now there is no API exposed by mbed-os to get the
IPv6 link local address.

This new API is required to deliver mDNS library support on mbed-os for Cypress
platforms. Unit tested it by invoking get_ipv6_link_local_address with a simple
application.
2019-11-01 03:43:36 +05:30
Balaji 6905b1b547 Incorporate review comments from @kjbracey-arm 2019-10-25 10:51:50 -07:00
Balaji 5168bbdcd0 Add InternetDatagram Base Class 2019-10-25 10:48:13 -07:00
Balaji ab883350a0 Incorporate review comments from @kjbracey-arm 2019-10-25 10:48:12 -07:00
Balaji 0b5dea5f99 Changes to the PR 10978 (LWIP: Add RAWIPSocket support) 2019-10-25 10:48:12 -07:00
Tymoteusz Bloch 641189c357 Multihoming change parameter orded in gethostbyname 2019-02-20 14:37:33 +02:00
Tymoteusz Bloch 49141376ee Multihoming initial release
Added Multihoming feature to LWIP (ability to use more than one network interfaces) for increasing networking reliability.
This involves:

    LWIP interface
    LWIP IP routing
    DNS storage
    Sockets (bind to interface name possibility)
    possibility to add non default network interface
    cellular middleware modifications if cellular connection is used
2019-02-19 17:39:46 +02:00
Seppo Takalo bfd497fe26 Fix netsocket Doxygen group 2019-01-21 11:43:49 +02:00
paul-szczepanek-arm 4f2645b3fc incorrect doc was copy pasted
replaced with copydoc instead
2018-10-24 20:57:25 +01:00
paul-szczepanek-arm 3929f5630b missing doxy 2018-10-24 20:54:08 +01:00
paul-szczepanek-arm 5837e3771e return codes 2018-10-24 20:35:53 +01:00
Martin Kojtal b46aa6108d netsocket: astyle fix 2018-08-03 13:34:33 +01:00
Seppo Takalo cdbe43c0d5 Refactor Sockets by moving functions up into common base.
* Move IP Socket stuff to InternetSocket class which is inherited by TCP/UDP
* Implement sendto() and recvfrom() on TCP socket
* Implement connect() call on UDP
* Implement send() and recv() calls on UDP socket
2018-06-20 12:38:06 +03:00
Mika Leppänen c4424ff0a1 Corrected more defects
- Serialized the sending of multiple async DNS queries since limits on event
message box sizes
- Added timer function that supervises the total time used to make DNS query
and triggers socket timeouts
- Changed nsapi_error_t to new nsapi_value_or_error_t on interface headers
- Corrected wording of gethostbyname_async return values
- Clarified .json options
- Added a new data type for socket callback that can be used from interrupts
- Corrected variable limits to use INT32_MAX etc. defines
- Changed mallocs to new
- Optimized variable sizes on DNS_QUERY definition
2018-05-23 12:24:10 +03:00
Mika Leppänen 1c01f5dda4 Corrected defects
- Changed call_in/call methods of the stack to callback provided by the stack
- Specified what are limitations for operations that are made in callback
- Added pure virtual class DNS that defines DNS operations
- Added cancel operation and unique ID to DNS request used in cancel
- Added DNS configuration options to netsocket/mbed_lib.json for retries,
  response wait time and cache size
- Changed host name to use dynamic memory in DNS query list and cache,
  set maximum length for the name to 255 bytes.
- Added mutex to asynchronous DNS
- Reworked retries: there is now total retry count and a server specific count
- Ignores invalid incoming UDP socket messages (DNS header is not valid), and retries DNS query
- Reworked DNS module asynchronous operation functions
- Corrected other review issues (nothrow new, missing free, missing mutex unlock etc.)
2018-05-23 12:24:10 +03:00
Mika Leppänen b7e8400c2c Added non-blocking DNS functionality to network interface
- Added non-blocking DNS interface to network interface and
  network stack.
- Added caching of DNS replies.
- Added a network stack function to get DNS addresses from stack.
- Added call and call_in hooks to onboard network stack to
  allow calling functions from onboard stack context.
- Added support to call and call_in functions to LWIP and
  Nanostack.
- Disabled LWIP DNS translator with the exception of DNS
  address storage used in DNS address get.
2018-05-23 12:24:10 +03:00
Kevin Bracey 0386f73719 Networking update: general refactoring, unifying EMAC
Initial work by Bartek Szatkowski in https://github.com/ARMmbed/mbed-os/pull/4079,
reworked following review of https://github.com/ARMmbed/mbed-os/pull/5202 to
transform the entire system into C++, retaining the basic functionality.

Bartek's summary:

* Porting ethernet to EMAC
* Updating EMAC to enable multiple interfaces
* Untangling networking classes, making the abstractions a bit clearer to follow, etc
* General refactoring
* Removal of DEVICE_EMAC flag and introducing DEVICE_ETH and DEVICE_WIFI

Revisions since initial branch:

* Remove lwip depencies
* Correct doxygen warnings
* Remove emac_api.h, replace with C++ EMAC abstract class.
* Create OnboardNetworkInterface, and LWIP implementation.
* Mappings since #4079
     lwip-interface/nsapi_stack_lwip.c -> LWIPStack.cpp
     lwip-interface/ipstack_lwip.c -> LWIPInterface.cpp
     netsocket/mbed_ipstack.h -> OnboardNetworkStack.h
     hal/emac_api.h -> EMAC.h
* Reinstate use of EthInterface abstraction
* Correct and clarify HW address EMAC ops
* Restore MBED_MAC_ADDR implementation
* Integrate PPP support with LWIP::Interface.
* Convert K64F lwIP driver to K64F_EMAC.

To do:

* Convert emac_stack_mem.h to follow this pattern.
* Figure out DEVICE_ETH/EMAC
* Update all drivers to use EMAC
2018-05-22 11:44:45 +03:00
Brendan McDonnell c4f10aafee typos 2018-02-20 20:11:19 -05:00
Jimmy Brisson aabecf633b Remove doxygen warnings in nsapi 2017-06-05 17:32:46 -05:00
Hasnain Virk fcd55fe65b [ONME-2844] Avoid option level collisions
To allow a network stack to support both NSAPI and its own options, try to make
sure the NSAPI levels don't collide with level numbers likely to be used by
network stacks.

Distinguish between socket and stack options, and tighten up documentation. Add
IP MRU stack options as an example (implementation not immediately planned for
any stack, but could be useful).
2016-12-20 14:03:23 +02:00
Christopher Haster ba748ac1f8 nsapi - Added standardized return types for size and errors
nsapi_error_t         - enum of errors or 0 for NSAPI_ERROR_OK
nsapi_size_t          - unsigned size of data that could be sent
nsapi_size_or_error_t - either a non-negative size or negative error
2016-11-02 15:25:22 -05:00
Martin Kojtal ba47aa546b Merge pull request #2897 from geky/nsapi-consistent-unspec
nsapi - Standardize support of NSAPI_UNSPEC
2016-10-27 10:26:00 +02:00
Christopher Haster 1f4eb0aaa1 nsapi - Standardized support of NSAPI_UNSPEC
- Reordered nsapi_version_t to make defaule nsapi_addr_t NSAPI_UNSPEC
- Added support to NSAPI_UNSPEC in SocketAddress
2016-10-05 12:48:10 -05:00
Jimmy Brisson f1a78027d3 Add tags to our code 2016-10-04 15:02:44 -05:00
Christopher Haster c2d9fc29ff restructure - Fixed include paths damaged by the restructure 2016-09-30 19:18:09 -05:00
Christopher Haster ba99a1f31d restructure - Restructured features/net directory
features/net/network-socket -> features/netsocket
features/net/FEATURE_IPV4 -> features/FEATURE_LWIP
features/net/nanostack-binaries -> features/nanostack
features/net/FEATURE_NANOSTACK -> features/nanostack/FEATURE_NANOSTACK
2016-09-30 19:18:09 -05:00