Commit Graph

609 Commits (4b3cddff2a66d5b13ad861e8782d1d630c2479c1)

Author SHA1 Message Date
Nir Sonnenschein 8c2ad14ace
Merge pull request #9568 from ARMmbed/feature-cellular-refactor
Merge feature cellular refactor
2019-02-07 18:17:32 +02:00
Michal Paszta 9db97247a2 TLSSocket returns WOULD_BLOCK error instead of ALREADY
In case mbedtls fails to execute handshake advertising
MBEDTLS_ERR_SSL_WANT_READ or MBEDTLS_ERR_SSL_WANT_WRITE,
TLSSocketWrapper::continue_handshake returns NSAPI_ERROR_WOULD_BLOCK.
2019-02-07 10:33:37 +02:00
Seppo Takalo 2744200cb7 Add NetworkInterface::attach() back, as it might be referred from binaries 2019-02-01 16:02:45 +02:00
Seppo Takalo 06aea98f99 Call "new" instead of no-throw version and the MBED_ERROR.
Standard new operator already calls MBED_ERROR in failure.
2019-01-31 15:21:12 +02:00
Seppo Takalo 9c98d1572b Allow multiple network status listeners
Allow more than one callback to be register to NetworkInterfaces.
This introduces new APIs:
void NetworkInterface::add_event_listener(...);
void NetworkInterface::remove_event_listener(...);

Which internally calls interfaces attach() functions.
2019-01-31 15:04:24 +02:00
Ari Parkkila 47a8f24b1e Cellular: Fix astyle 2019-01-31 04:15:01 -08:00
Martin Kojtal a12ab30f98
Merge pull request #9414 from SeppoTakalo/ONME-4013
Clarify asynchronous Networkinterface::connect() and disconnect() API
2019-01-31 11:30:29 +01:00
Cruz Monrreal f5730a91b2
Merge pull request #9474 from VeijoPesonen/fix-newlines_at_end-of-files
Fix newlines at end of files
2019-01-28 10:33:37 -06:00
Ari Parkkila 52ee61e1ae Fix NetworkInterface::set_default_parameters binary compatibility 2019-01-28 03:27:10 -08:00
Jan Jongboom ca987568d8
TCPSocket.cpp setting socket should terminate with semicolon 2019-01-24 14:25:34 -08:00
Veijo Pesonen a6d4c6b609 L3IPInterface: make inheriting virtual explicit 2019-01-23 17:04:42 +02:00
Veijo Pesonen 9f3830aa72 Adds newlines to avoid compiler warnings 2019-01-23 16:43:32 +02:00
Michal Paszta 2cda5d28b8 Documentation of TLSSocket behavior on AUTH_FAILURE 2019-01-22 12:40:42 +01:00
Ari Parkkila 59972b6659 Cellular: Remove netsocket/generic_modem_driver 2019-01-22 02:24:45 -08:00
Mirela Chirica 55b54f7c97 Cellular: Added API for setting default parameters to a network interface 2019-01-22 02:24:45 -08:00
Mirela Chirica ba3727b4e8 Cellular: Unit tests for Non-IP socket 2019-01-22 02:24:45 -08:00
Mirela Chirica d301e13610 Cellular: Non-IP socket and PDP context for EPS control plane data delivery 2019-01-22 02:24:44 -08:00
Martin Kojtal 31579fe4bb
Merge pull request #9328 from SeppoTakalo/ip-core-doxygen
Doxygen fixes for IP networking area
2019-01-22 10:48:10 +01:00
Seppo Takalo 58c2760e3f Fix spelling mistakes 2019-01-21 11:54:49 +02:00
Seppo Takalo 6f15b04655 Fix review findings. 2019-01-21 11:45:13 +02:00
Mel Weed 0f0469d03d editorial changes 2019-01-21 11:45:13 +02:00
Mel Weed b79b608362 mbed-tls/TLS to Mbed TLS 2019-01-21 11:45:13 +02:00
Mel Weed 40418d8ff9 grammatical corrections 2019-01-21 11:45:13 +02:00
Mel Weed ea296afec2 editorial changes, punctuation 2019-01-21 11:45:13 +02:00
Kari Haapalehto fcd497303d Review changes 2019-01-21 11:45:12 +02:00
Mel Weed f7e48f1385 typo fixes, future->present 2019-01-21 11:45:12 +02:00
Mel Weed c454ba9f60 removing 'easy to use' 2019-01-21 11:45:12 +02:00
Kari Haapalehto cabf597ab0 Hide protected start_handshake 2019-01-21 11:45:12 +02:00
Jarno Lamsa 981bfa139e SocketAddress doxygen cleanup 2019-01-21 11:45:12 +02:00
Jarno Lamsa 8f5e003a1e WifiInterface doxygen cleanup 2019-01-21 11:45:12 +02:00
Seppo Takalo 501f5ae32c Add more documentation to Socket classes. 2019-01-21 11:45:12 +02:00
Seppo Takalo db67332496 Fix DNS grouping 2019-01-21 11:45:12 +02:00
Seppo Takalo 706af114e3 Remove extra @param values 2019-01-21 11:45:12 +02:00
Kari Haapalehto 5fa13e43d1 Doxygen corrections to DTLSSocket.h, TLSSocket.h, TLSSocketWrapper.h
and DTLSSocketWrapper.h
2019-01-21 11:45:12 +02:00
Seppo Takalo 249fa7fd6f Create new netinterface Doxygen group 2019-01-21 11:43:49 +02:00
Seppo Takalo 0619b90997 Fix NetworkInterface grouping 2019-01-21 11:43:49 +02:00
Kari Haapalehto 0fbdb692e9 Doxygen corrections to:
- DTLSSocket.h
- TLSSocket.h
- TLSSocketWrapper.h
2019-01-21 11:43:49 +02:00
Seppo Takalo bfd497fe26 Fix netsocket Doxygen group 2019-01-21 11:43:49 +02:00
Kevin Bracey ab037c6f69 InternetSocket: better protect _callback
sigio callbacks can be triggered from interrupt, so changing _callback
needs critical section protection, not just a mutex.
2019-01-18 15:37:11 +02:00
Kevin Bracey 0f6a4cd0bd InternetSocket: Use atomics, not volatile
Use a better tool for the job.
2019-01-18 15:37:11 +02:00
Seppo Takalo 6c5b845517 Clarify asyncronous Networkinterface::connect() and disconnect() API
This is slight API change, as a new return code is introduced.
Intention is to properly support asyncronous drivers that might
not be able to get new operation into execution, therefore they
need to return BUSY.
2019-01-18 15:36:23 +02:00
Cruz Monrreal 92a5f2f8f2
Merge pull request #9337 from tymoteuszblochmobica/removecellular
unittest: remove cellular driver L3IP stub
2019-01-16 22:06:27 -06:00
Tymoteusz Bloch 18967a88f3 Removed cellular driver L3IP stub 2019-01-14 12:08:41 +01:00
kegilbert 70b9b753db Add doxygen spellcheck jobs to Travis
Currently tests
    - drivers
    - platform
    - rtos
    - events
    - features/netsocket
2019-01-11 10:22:15 -06:00
c_jin be65ebd038 add SPDX indentifier, modify 450zi.icf file and static definition in us_ticker.c 2019-01-09 19:03:33 +08:00
c_jin 5a1108e742 Add GD32_F450ZI as new target 2019-01-09 19:03:33 +08:00
Cruz Monrreal 54f759176b
Merge pull request #9210 from AnttiKauppila/mbed_h_fix
mbed.h includes removed
2019-01-04 10:27:30 -06:00
Seppo Takalo 50eb243762 Don't consume 36 kB just for Ethernet buffers.
Kintis EMAC is consuming 16 rinbuffers for input, and 8 buffers for output.
This is over-use because input packets are immediately allocated from
heap when passed to LwIP. Therefore the number can be creatly reduced.
2019-01-02 19:05:16 +02:00
Antti Kauppila 02b0f79e15 mbed.h includes removed 2018-12-28 14:36:10 +02:00
Tymoteusz Bloch fc88922845 L3IP Interface Implementation
LWIP L3IP interface initial implementatioon
2018-12-20 15:23:43 +01:00
Martin Kojtal 06748af2f8
Merge pull request #9079 from kegilbert/TCPSocket-accept-statelog
Add socket stat logging state change update
2018-12-18 08:06:05 +00:00
kegilbert ee3945dfa3 Add socket stat logging state change update
TCPServer was deprecated and the accept call was added to TCPSocket. Add state change update to that call
2018-12-13 14:50:56 -06:00
Martin Kojtal c387fec36b
Merge pull request #8725 from ChazJin/master
Add support for GD32F307VG
2018-12-12 14:42:20 +01:00
deepikabhavnani c272377a81 Make sure no memory overhead if statistics are disabled 2018-11-26 09:42:45 -06:00
deepikabhavnani fa6b3d2783 Corrected TCPServer reporting as per review comments 2018-11-26 09:42:45 -06:00
deepikabhavnani 068f2d14c0 Resolve IAR build issue
IAR not able to assign default zero value in array and complaints of
internal error as below:

[ERROR] Internal error: [Front end]: assertion failed at:
"..\..\Translator\compiler_core\src\parser\edg\decl_inits.c", line 2031
2018-11-26 09:42:45 -06:00
Amanda Butler 81fc940a8e Edit SocketStats.h
Edit file.
2018-11-26 09:42:45 -06:00
deepikabhavnani 117eb0bc87 Add socketstats stub functions for unittest and addressed reviews 2018-11-26 09:42:50 -06:00
Deepika f6c1a40b29 Add config options for socket statistics
1. MBED_CONF_NSAPI_SOCKET_STATS_ENABLE to enable the statistics
2. MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT max sockets statistics cached
2018-11-26 09:42:45 -06:00
Deepika a851df66e3 Code/bug after testing
1. Fixing astyle and docs
2. Extra mutex lock was removed
3. Bytes are updated when send/recv > 0 and not in case of -ve error
4. Review comments
5. Guard statistics implementation in test with MBED_NW_STATS_ENABLED
2018-11-26 09:42:45 -06:00
Deepika 09b4bc07ce This is the initial version of stats implementation in network layer.
SocketStats Class is added to collect and provide the statistics information.
In this phase only socket information is collected and max sockets that can
be recorded at any time are configurable through 'MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT'

Network statistics can be enabled through a macro MBED_NW_STATS_ENABLED

More information on design is captured in #8743
2018-11-26 09:42:39 -06:00
Martin Kojtal aae6bb125a
Merge pull request #8836 from SeppoTakalo/clarify_connect_docs
Clarify asynchronous NetworkInterface::connect() documentation
2018-11-25 11:27:16 +01:00
Martin Kojtal b16569dc3f
Merge pull request #8838 from 0xc0170/dev_rollup
Rollup v2 for 5.11rc1
2018-11-24 21:37:02 +01:00
Martin Kojtal cb6f5d65e7
Merge pull request #8766 from jarvte/fix_cellular_backward_com
Fix cellular backward compatibility
2018-11-24 08:05:56 +01:00
Martin Kojtal b9ea30abf1 Merge branch 'socket_open_deprecated' of https://github.com/michalpasztamobica/mbed-os into dev_rollup 2018-11-23 18:38:02 +00:00
Martin Kojtal 95b1e75202 Merge branch 'dtls' of https://github.com/SeppoTakalo/mbed-os into dev_rollup 2018-11-23 18:36:55 +00:00
Seppo Takalo 1b80f6ba5e Clarify asynchronous NetworkInterface::connect() documentation 2018-11-22 12:52:28 +02:00
c_jin a9ce7a6836 Add SPDX identifier for GD EMAC driver 2018-11-21 12:46:28 +08:00
Seppo Takalo 5459a7b5c9 Add license headers into TLSSocket files 2018-11-20 11:47:29 +02:00
Seppo Takalo 0f5cec3ebc Include TLSSocket and DTLSSocket in Doxygen 2018-11-20 11:47:28 +02:00
Jimmy Brisson f41b78c6b8 Move EMAC implementation to shared target 2018-11-19 09:37:17 -06:00
Seppo Takalo bdc355f873 Astyle fixes 2018-11-19 15:31:31 +02:00
Seppo Takalo 5d170f2b3e Clarify that TLSSocket should not be reopened. 2018-11-19 15:19:50 +02:00
Seppo Takalo 6192ed1480 Compare the intermediate timestamps as well 2018-11-19 15:19:50 +02:00
Seppo Takalo 2229a2f2f5 Need to protect members with MBEDTLS_PK_C and X509_CRT_PARSE flags.
This is dependency to X509_CRT_PARSE but just to make sure
that also the 'mbedtls_pk_context' structure is not used if that
flag is not enabled.
2018-11-19 15:19:49 +02:00
Seppo Takalo 46c46019bc Refactor DTLSSocket to use Socket::getpeername()
Also, let DTLSSocket to be a friend of InternetSocket so it can do
the name resolution from its _stack.

+ Some whitespace fixes
2018-11-19 15:19:49 +02:00
Seppo Takalo 695db63df8 Decrease verbosity of the TLSSocketWrapper 2018-11-19 15:19:49 +02:00
Michal Paszta 392bccf835 Add unit tests for TLSSocket and TLSSocketWrapper
This also includes their Datagram counterparts: DTLSSocket and DTLSSocketWrapper.
Coverage missing for timer-related functionality, but this would require more advanced stub development.
The extra (d)tls_test_config.h is necessary for successful compilation without HW support for the mbedtls features in unittests.
I reused the mbedtls stub found in features/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.c and amended it slightly with a few missing functions.
2018-11-19 15:19:49 +02:00
Seppo Takalo 2ca1fe65dd Implement DTLSSocket helper
This is equivalent of TLSSocket class but for UDP and DTLS.
2018-11-19 15:19:49 +02:00
Seppo Takalo d22adbdb26 Implement DTLSSocketWrapper and fix non-blocking connections on TLSSocket
DTLSSocketWrapper is equivalent of TLSSocketWrapper but uses datagram mode
and timers for handling Mbed TLS timeouts.

Non-blocking connections were not working earlier, now fixed for both
secure socket modes.
2018-11-19 15:19:49 +02:00
Michal Paszta 42940fab3c Deprecate TCP/UDPSocket open-calling constructors
Updated Doxygen, removed the only one call of the deprecated constructor from the tests.
2018-11-19 12:19:52 +01:00
Teppo Järvelin a3589ed41f Fixed cellular backward compatiblity. 2018-11-19 09:04:22 +02:00
c_jin 5a15f810a6 Error modification 2018-11-19 09:41:17 +08:00
c_jin 2b9071afe6 conflicts resolve 2018-11-18 20:19:19 +08:00
chao_king 61d3bc804c Update licence 2018-11-18 19:30:17 +08:00
chao_king d2e731bcf5 Update licence 2018-11-18 19:30:07 +08:00
chao_king 9131b3f9ec Update licence 2018-11-18 19:29:43 +08:00
chao_king 700f3a2c69 Add EMAC driver for GD32_F307VG 2018-11-18 19:26:04 +08:00
Qinghao Shi d157e59267 reformat to following codeing style rules 2018-11-16 10:29:31 +00:00
Qinghao Shi 25e8f89567 update wait_ms() to sleep_for() 2018-11-16 10:29:31 +00:00
Qinghao Shi 78b186ec56 Update code according to the reviews
* move emac driver to COMPONENT folder
* use mbed rtos C++ API instead of CMSIS API
2018-11-16 10:29:31 +00:00
Qinghao Shi e603f1ad49 add FVP EMAC driver 2018-11-16 10:22:42 +00:00
Cruz Monrreal II 5c1c7bf71f Merge branch 'fix_astyle_error' of ssh://github.com/0xc0170/mbed-os into rollup-b.1 2018-11-15 18:26:09 -06:00
Cruz Monrreal fa2077df41
Merge pull request #8685 from bridadan/clean_up_deprecated_feature_code
Clean up deprecated feature code
2018-11-15 17:05:22 -06:00
Martin Kojtal 9a252cd218 Merge branch 'feature-emac-mxrt1050' of https://github.com/NXPmicro/mbed into dev_rollup 2018-11-15 13:58:27 +00:00
Martin Kojtal f91eed97da cellular: fix onboard cellular coding style 2018-11-15 10:47:08 +00:00
chao_king 42bffe2d89 Update licence 2018-11-15 16:01:54 +08:00
chao_king 49b25c9699 Update licence 2018-11-15 16:01:54 +08:00
chao_king cc94bfa838 Update licence 2018-11-15 16:01:53 +08:00
chao_king eb39c48841 Add EMAC driver for GD32_F307VG 2018-11-15 16:01:53 +08:00
Anna Bridge 4d07bcbd6e
Merge pull request #8579 from jarvte/cellular_context
Major refactoring: changing Network inheritance from CellularNetwork to new class CellularContext
2018-11-14 14:37:19 +00:00
Mahesh Mahadevan 12c6b1bd88 MIMXRT1050EVK: Add ENET support
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-11-14 07:13:07 -06:00
Cruz Monrreal II 4a5ba7f156 Merge branch 'getpeername' of ssh://github.com/SeppoTakalo/mbed-os into rollup 2018-11-13 17:26:49 -06:00
Seppo Takalo 619bcb5b4e Implement Socket::getpeername() API
This is equivalent of POSIX getpeername() function. It allows to
get remote address associated with the socket.
For example:
socket *s = server.accept();
SocketAddress remote;
s->getpeername(&remote);
2018-11-13 11:02:51 +02:00
Kevin Bracey 913103c34d TLSSocketWrapper: decouple error requirements
* Don't pull in mbedtls_strerror() if trace is not enabled.
* Output error trace even if mbedtls_strerror() is not available.
2018-11-12 13:12:34 +02:00
Teppo Järvelin 3f6e088782 Cellular: Fixed backward compatibility with OnBoardCellularInterface and set default values in NetworkInterfaceDefaults.cpp. 2018-11-11 14:13:05 +02:00
Teppo Järvelin 1a047efade Cellular: review fixes, added missing fixes from master. 2018-11-11 14:13:05 +02:00
Teppo Järvelin 9fb83024ea Changed CellularContext to inherit from CellularBase instead of NetworkInterface. \n Changed Device constructor to take Filehandle instead of eventqueue. 2018-11-11 14:13:05 +02:00
Teppo Järvelin ad2abbe887 Cellular: major refactoring while introducing new CellularContext class. 2018-11-11 14:12:49 +02:00
Teppo Järvelin 8880538eba Cellular: Introduced new state machine to replace old CellularConnectionFSM
CellularDevice class own new state machine. Now we don't have to expose state machine
which may change and so we don't have to make API changes if that happens.
EasyCellularConnection uses now CellularDevice instead of old state machine.
2018-11-11 14:11:21 +02:00
Cruz Monrreal 9d95d46d6c
Merge pull request #8591 from 0xc0170/fix_coding_style_features
features: fix coding style
2018-11-09 09:40:56 -06:00
Brian Daniels da6ce029ea Removing cellular references to COMMON_PAL 2018-11-08 16:55:59 -06:00
Cruz Monrreal II e40c357cb2 Merge branch 'internetsocket' of ssh://github.com/marcemmers/mbed-os into rollup 2018-11-08 13:24:14 -06:00
Martin Kojtal 0217f69511 Merge branch 'cm3ds_emac' of git://github.com/kapi90/mbed-os into dev_rollup 2018-11-08 09:21:38 +00:00
Martin Kojtal 63160d8c5b netsocket: fix astyle coding style 2018-11-08 08:54:17 +00:00
Marc Emmers dcb97f9f74 InternetSocket: Fixed missing unlock before return 2018-11-06 15:02:42 +01:00
Martin Kojtal 4cbcd64ca3 Merge branch 'doxy_refactor' of https://github.com/jamesbeyond/mbed-os into dev_rollup 2018-11-06 12:10:10 +00:00
Martin Kojtal cb4924151e
Merge pull request #8621 from marcuschangarm/fix_include
Add missing include for TLSSocket
2018-11-05 17:18:52 +01:00
Marcus Chang 07eb6bd159 Add missing include for TLSSocket
TCP and UDP sockets are automatically available when mbed.h is
included in an application.

This change lets the TLSSocket be used in the same way.
2018-11-01 13:32:37 -07:00
Seppo Takalo f92108c0f3 Make sure that close() is called before the transport is destroyed.
Transport is a member of TLSSocket which is derived from TLSSocketWrapper.
Make sure that TLSSocketWrapper::close() is called before the transport is
destroyed.
2018-11-01 15:30:27 +02:00
Qinghao Shi 60cc0c295d fixed NetworkInterface Class missing in doxy 2018-10-31 14:50:59 +00:00
Martin Kojtal 2015a61b37
Merge pull request #8580 from tz-arm/fix_incorrect_comment_in_socket_h
Fix the incorrect comment for set_blocking()
2018-10-31 13:10:35 +01:00
Terence Zhang 2c56bd8151 Fix the incorrect comment for set_blocking() 2018-10-30 15:41:32 +08:00
Amanda Butler eae570ef08 Edit EMAC.h
Change Latin abbreviation to English phrase and fix capitalization of EMAC while I'm at it.
2018-10-29 15:14:07 -05:00
kegilbert 4bc7bf3b1e Fix typos in Features/Netsocket 2018-10-29 15:14:07 -05:00
Bence Kaposzta 9e6b1246a4 This commit adds EMAC driver for CM3DS that uses an SMSC LAN 9220
Ethernet controller. To ensure proper operation, some methods
needed to be updated in the SMSC9220's native driver as well.
It passes all related Greentea tests, however when supervised by
the Python environment it tends to fail because of Timeout.

The current timeout is set to 1200s that seems to be a little bit short
to finish all test cases, the timeout happens towards the end of the
last test case.

Change-Id: I914608c34828b493a80e133cd132537a297bfc84
Signed-off-by: Bence Kaposzta <bence.kaposzta@arm.com>
2018-10-29 15:30:47 +01:00
Cruz Monrreal 9403a2f16c
Merge pull request #8499 from michalpasztamobica/master
Socket closing improvements and tests adjustments
2018-10-29 08:47:25 -05:00
Cruz Monrreal II e8728148ac Merge branch 'docs-fix-networkiface' of ssh://github.com/paul-szczepanek-arm/mbed-os into rollup 2018-10-26 11:48:45 -05:00
Mel W 2bab24ffc5
Commas 2018-10-26 17:32:47 +03:00
Mel W ae75dfcf92
Capitalization, formatting of true and false, punctuation. 2018-10-26 17:32:10 +03:00
Mel W b165fc0f93
Articles and capitalization 2018-10-26 16:18:57 +03:00
Mel W 25b1625fff
Sentence restructuring, punctuation 2018-10-26 15:42:26 +03:00
Michal Paszta 0da0f16d60 TCPSocket accept refactored to close cleanly and icetea test added
Private constructor called in TCPSocket accept, when creating a new Socket.
Close() method calls moved "up" to InternetSocket.
InternetSocket::close() returns proper error code when no socket available.
Add TcpSocket::accept icetea tests.
Deleting sockets moved to teardown.
2018-10-26 12:02:25 +03:00
Cruz Monrreal II e021ec4d08 Merge branch 'docs-fix-internetsocket' of ssh://github.com/paul-szczepanek-arm/mbed-os into rollup 2018-10-25 21:49:41 -05:00
Cruz Monrreal II 05a69de5b4 Merge branch 'docs-fix-udpsocket' of ssh://github.com/paul-szczepanek-arm/mbed-os into rollup 2018-10-25 21:49:36 -05:00
Amanda Butler 6db0f67690
Edit InternetSocket.h
Edit file, mostly for branding, commas and U.S. spelling.
2018-10-25 14:49:48 -05:00
Amanda Butler c02f2164d5
Edit UDPSocket.h
Edit file, mostly for minor spelling to existing text.
2018-10-25 11:02:48 -05:00
paul-szczepanek-arm 446ab5d592 review fixes 2018-10-25 16:28:19 +01:00
Paul Szczepanek 85b9b23711
capitalisation 2018-10-25 11:30:59 +01:00
Paul Szczepanek 5241c3b38d
Update WiFiInterface.h 2018-10-25 11:24:11 +01:00
Paul Szczepanek de261a4673
Update CellularBase.h 2018-10-25 11:22:13 +01: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 e31337dab7 remove redundancy and maintainance overhead 2018-10-24 20:49:28 +01:00
paul-szczepanek-arm 5837e3771e return codes 2018-10-24 20:35:53 +01:00
paul-szczepanek-arm 6cdda58cec doxygen fixes 2018-10-24 20:24:33 +01:00
paul-szczepanek-arm 8a7d96c75f doxy cleanup 2018-10-24 17:45:52 +01:00
paul-szczepanek-arm fd0612b763 update internetsocket docs 2018-10-24 16:50:35 +01:00
Cruz Monrreal b18c819837
Merge pull request #8519 from cmonr/rollup
Rollup PR - UK Docathon pt1
2018-10-24 09:32:46 -05:00
Martin Kojtal 7cd1478147
Merge pull request #8003 from Taiki-San/patch-2
Leverage the simplification of the IPv6 parsing primitive
2018-10-24 14:13:16 +01:00
Amanda Butler 0a82253cf5
Add comma to SocketAddress.h
Add comma to existing text.
2018-10-23 11:27:25 -05:00
Conrad Braam e919511d98 Explain default port number, and construction 2018-10-23 15:01:28 +01:00
Taiki 3bc33f6c3e Use the parsing status as a way to detect if the IP string represent a valid IPv6 address 2018-10-23 11:25:52 +02:00
Seppo Takalo c7643ea9c8 Flag certificate verification functions with MBEDTLS_X509_CRT_PARSE_C.
If Mbed TLS support for X509 is not compiled in, this class would
not compile anymore. However, there might be other uses for it, even
if certificates are not used. Therefore add flagging for X509 only
on specific functions.
2018-10-19 12:32:12 +03:00
Cruz Monrreal fc41c3d8e3
Merge pull request #8311 from SeppoTakalo/secure_socket
Implement TLSSocket
2018-10-17 12:24:09 -05:00
Seppo Takalo 5d1cd2552b Check that MBEDTLS_ERROR_C is defined before using mbedtls_strerror().
If MBEDTLS_ERROR_C is not defined, that strerror function does not
exist, or is just dummy definition if MBEDTLS_ERROR_STRERROR_DUMMY is
defined.
2018-10-17 11:45:31 +03:00
Deepika f58e103758 Netsocket: Add required header file and namespace element instead add all 2018-10-15 10:57:21 -05:00
Cruz Monrreal 00f8ecfb7a
Merge pull request #8336 from sentinelt/socket-closed
Fix hard-fault when socket created using accept() is closed
2018-10-15 10:22:17 -05:00
Seppo Takalo 7f39bb4453 Implement TLSSocket
Provide TLSSocket implementation. This implementation allows TLSSocket
to wrap around any existing socket. Currently only TLS supported. DTLS
not yet implemented.

Design document also provided with the implementation.

Documentation submitted to Mbed OS handbook.
2018-10-15 13:31:36 +03:00
Kevin Bracey 1ef213ec89 Clean up Thread deprecation warnings
Static Thread methods and signal methods have been deprecated. Remove
all references in the main code, and most of the tests. Some tests of
the deprecated APIs themselves remain.
2018-10-12 14:57:13 +03:00
Cruz Monrreal 2a91a91313
Merge pull request #8219 from jeromecoutant/PR_EMAC_SLEEP
STM32 EMAC : lock deep sleep
2018-10-11 10:10:32 -05:00
Cruz Monrreal 21b4ecad1a
Merge pull request #8316 from michalpasztamobica/master
unittests: Add tests for netsocket classes
2018-10-10 10:11:12 -05:00
Cruz Monrreal b2f00fb416
Merge pull request #8179 from kivaisan/add_default_cellular_sim_pin
Add missing SIM PIN configuration item
2018-10-08 10:12:41 -05:00
Michal Paszta 5b4634a1fe unittests: Added tests for netsocket classes
New classes covered with unit tests: SocketAddress, EthernetInterface, EMACInterface, WiFiAccessPoint.
Also added missing namespace in front of mbed::Callback usages.
EMACInterface is covered by the EthernetInterface unit tests.
2018-10-08 14:21:01 +02:00
Sławek Piotrowski 9b89ad2fa9 Fix hard-fault when socket created using accept() is closed
When socket created  using accept() is closed by calling the close()
method, "delete this" is executed which triggers the destructor call
on TCPSocket which in turn calls close() once again. Because _stack
is already 0 this results in a hard-fault.

Add a check that skips the rest of the close() method is the _stack
is already 0.
2018-10-06 21:15:29 +02:00
jeromecoutant 79bef6e2c8 STM32 EMAC : lock deep sleep 2018-09-21 15:14:38 +02:00
Steven 9a0fc98bdc Hotfix for PR #7778
TB_SENSE_12 would have been left behind by the changes in #7778. This commit implements the changes in mbed to allow targets to provide a default network interface for Silicon Labs targets.
2018-09-19 12:30:21 +02:00
Kimmo Vaisanen 95114fe8ed Add missing SIM PIN configuration item 2018-09-19 12:24:46 +03:00
Cruz Monrreal c356f1f9d4
Merge pull request #7883 from juhaylinen/fix-netsocket-warning
netsocket: Fix compiler warning
2018-09-18 11:42:21 -05:00
Cruz Monrreal 8475477ca7
Merge pull request #7992 from SeppoTakalo/fix-tcpsocket-accept
Fix TCPSocket::accept()
2018-09-14 11:49:06 -05:00
Juha Ylinen 4ea49f5580 Fix TCPServer::accept()
Missing lock caused Mutex unlock failure
2018-09-07 10:46:25 +03:00
Cruz Monrreal 06106297a4
Merge pull request #6293 from Taiki-San/patch-1
Reduce .text footprint of the network stack
2018-09-05 10:16:04 -05:00
Seppo Takalo 451852d19f Fix TCPSocket::accept()
This one was actually always return NULL, and unsted because we only
have tests with one device.

We will add the testcase for this soon
2018-09-05 12:00:59 +03:00
Martin Kojtal 44925d8527
Merge pull request #7579 from u-blox/ublox_odin_driver_os_5_v3.0.0_rc1
Updated ODIN drivers to v3.0.0 RC1
2018-09-03 09:25:32 +02:00
Seppo Takalo 1ef04796ee On KW24D and NCS36510 default to smaller Nanostack configuration
These boards do not fit the full Nanostack, so we need to select
6LoWPAN-ND as a default.
2018-09-01 12:37:46 -05:00
Ammad Rehmat b934632653 Access Point API 2018-08-31 11:33:30 +05:00
Taiki 758f6d2e83 Switch the IPv4 parser to the one recently introduced in libservice. Return a bool value on wether parsing of the IPv4 address string was successful 2018-08-28 14:00:54 +02:00
Seppo Takalo c5064a8e33 Fix *MeshInterface::get_default_instance()
This was returning object, instead of pointer.
Also it was trying to call lowpan(reference), instad of lowpan(ptr).
2018-08-28 11:02:58 +03:00
Juha Ylinen b8b39ac3ab netsocket: Fix compiler warning
[Warning] InternetSocket.h@237,10: 'InternetSocket::_factory_allocated' will be initialized after [-Wreorder]
[Warning] InternetSocket.h@236,23:   'volatile unsigned int InternetSocket::_pending' [-Wreorder]
[Warning] InternetSocket.cpp@22,1:   when initialized here [-Wreorder]
2018-08-24 13:26:53 +03:00
Steven 1cfddb73b7 Fix stack size for LwIP on EFM32GG11
Typo in the config file made the LwIP stack way too small on EFM32GG11 STK3701 target. Additionally, the EMAC thread stack was slightly too small when debug printing is on.
2018-08-19 14:39:58 +02:00
Martin Kojtal 88a7416941 nsapi: astyle block fix 2018-08-06 09:59:08 +01:00
Martin Kojtal b46aa6108d netsocket: astyle fix 2018-08-03 13:34:33 +01:00
Cruz Monrreal 63f62165d8
Merge pull request #7565 from OpenNuvoton/nuc472_emac_rst
Nuvoton: Fix NUC472 SD-Host HW IP reset definition
2018-07-31 11:44:01 -05:00
cyliangtw 2fcbcf1789
Initialized return value of numaker_emac link-out 2018-07-31 12:01:43 +08:00
Seppo Takalo 96a90c2f2f Allow legacy TCPServer::accept() to override inherited Socket::accept() 2018-07-24 18:06:04 +03:00
cyliangtw 7ea02d95a3 Add error handling for getting null tx buffer 2018-07-20 18:23:54 +08:00
Steven Cooreman da377c6ed3 Add EFM32GG11 Ethernet driver 2018-07-11 18:13:04 +02:00
Cruz Monrreal 93233c4f5d
Merge pull request #7364 from 0xc0170/fix_storage_rtos
Fix storage rtos types - remove including internal header file
2018-07-05 14:29:46 -05:00
Tero Jääskö 2e89fa22a5 netsocket: dns: make dns-cache-size:0 remove whole DNS cache code
Setting ""nsapi.dns-cache-size": 0" still left some of the DNS
caching code in. Add crude #if to remove all of it.
This allows one to save 429 bytes of flash and 48 bytes of RAM on
ARMC5 builds.
2018-06-29 18:17:19 +03:00
Martin Kojtal 4d8baa7451 emac targets: fix thread cb type 2018-06-29 08:35:20 +01:00
Cruz Monrreal cb000ceeab
Merge pull request #7336 from SeppoTakalo/fix_udp_filtering
Fix connected UDPSocket filtering
2018-06-28 10:06:52 -05:00
Martin Kojtal 82b490b0cf kinetis: fix rtos storage type for thread 2018-06-28 15:11:00 +01:00
jeromecoutant 6391b7f2fa TARGET_STM_EMAC astyle 2018-06-27 15:00:51 +02:00
Seppo Takalo f2c0c4e248 Fix connected UDPSocket filtering
Was dropping all packets from connected peer
2018-06-26 17:01:19 +03:00
Seppo Takalo 1ca9ccda73 Filter incoming UDP packets based on connected peer address. 2018-06-20 12:38:07 +03:00
Seppo Takalo e7cb4752fa Fix small issues from the review 2018-06-20 12:38:07 +03:00
Seppo Takalo 2b60e42756 Close Doxygen group at the end of file 2018-06-20 12:38:07 +03:00
Seppo Takalo 96ef8e345d Move string allocation to a point where get_ip_address() is called
This saves RAM/stack on typical socket usage where human readable
format is not exchanged so often.
2018-06-20 12:38:07 +03:00
Seppo Takalo 407b2f275d Move accept() to abstract socket class and implement in TCPSocket
Deprecate TCPServer in favor of just TCPSocket::accept()
2018-06-20 12:38:07 +03: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
Cruz Monrreal e8005f6d72
Merge pull request #7206 from mikaleppanen/k64f_async_powerup
K64f non-blocking powerup
2018-06-19 21:49:37 -05:00
Cruz Monrreal 2bb686ff1e
Merge pull request #7245 from SeppoTakalo/fix-default-interface
Fix default interface selection by using correct macro names.
2018-06-19 08:46:28 -05:00
Martin Kojtal 0658544cb6
Merge pull request #7207 from mikaleppanen/dns_singletons
Change DNS global class definitions to singletons
2018-06-19 14:14:21 +02:00
Seppo Takalo 384fc7e778 Fix typo: WifiInterface -> WiFiInterface and add missing return.
Default WiFiInterface did not even build. And when it was fixed to build,
it was always returning NULL.
2018-06-19 10:47:12 +03:00
Seppo Takalo 412f654c8d Fix default interface selection by using correct macro names.
Code was written using MBED_CONF_DEFAULT_* but the mbed_lib.json file
that created these values is prefixed with "nsapi" and therefore
final macros are MBED_CONF_NSAPI_DEFAULT_*
2018-06-18 18:59:43 +03:00
Mika Leppänen 9b0cbe064d Disabled STM ethernet driver hardware checksum calculation
No need for driver level hardware IPv4/TCP/UDP/ICMP checksum insertion
since LWIP and nanostack handles those already.

Related to issue: https://github.com/ARMmbed/mbed-os/issues/7227
2018-06-15 14:24:05 +03:00
Mika Leppänen b7627e823b K64F, K66F: Update the ENET PHY driver
PHY init and autonegotation is split into own functions.
2018-06-15 10:41:31 +03:00
Mika Leppänen 9457bd13b0 Changed DNS global class definitions to singletons
This saves memory on platforms without network interface.
2018-06-13 15:50:22 +03:00
Mika Leppänen 5e8ed3364a Added delay to K64F/K66F ethernet TX when all descriptors are in use
Currently, if all TX descriptors are in use and IP stack calls K64F/K66F
ethernet driver link out, link out drops the packet. Added 10ms delay
to link out to wait for a descriptor to become available before dropping
the packet.
2018-06-13 10:02:13 +03:00
Mika Leppänen db672b36c5 Non-blocking K64F/K66F ethernet power up
Changed K64F/K66F power up to return without waiting for link up i.e. for
the ethernet cable to be connected. This is needed for non-blocking use
of driver e.g. for using the driver from event queue.
2018-06-13 09:53:32 +03:00
Cruz Monrreal ed9a1f1327
Merge pull request #7161 from kjbracey-arm/ppp-gateway
Correct PPPCellularInterface::get_gateway()
2018-06-11 22:11:18 -05:00
Cruz Monrreal 0eac433a66
Merge pull request #7119 from kjbracey-arm/nsapi-ip6string
NSAPI: Use IPv6 conversion routines from frameworks
2018-06-11 21:27:21 -05:00
Cruz Monrreal 8c6a664380
Merge pull request #7086 from mikaleppanen/nxp_lpc17xx_emac
NXP lpc17xx emac driver
2018-06-11 08:43:43 -05:00
Cruz Monrreal 2ac81de533
Merge pull request #7141 from kjbracey-arm/kinetis-mem-conf
Kinetis EMAC: Make number of buffers configurable
2018-06-11 08:41:14 -05:00
Kevin Bracey 45e24d4682 Correct PPPCellularInterface::get_gateway()
Two cascading copy-paste errors stopped this working:

  * PPPCellularInterface::get_gateway() called
    nsapi_ppp_get_ip_address();
  * nsapi_ppp_get_gateway() called the interface's get_netmask().

First bug has always been there - second one was introduced in 5.9.

AT_CellularNetwork currently lacks calls to get both netmask and gateway
- this patch would be needed for that when added.
2018-06-07 14:28:19 +03:00
Mika Leppänen 97de145adf Added missing license to header of the file 2018-06-06 14:29:49 +03:00
Mika Leppänen a8402256a3 Corrected TX buffer reclaim error
When all TX descriptors were reserved in a row so that TX buffer
reclaim interrupt did not happen during reservation sequence, after
the interrupt occurred, TX buffer reclaim did no longer free buffers.

This happened because when all descriptors were in use, last free
index pointed to consumed index.
2018-06-06 14:29:49 +03:00
Mika Leppänen a5a8b350ce Ported NXP LPCxx ethernet driver to unified EMAC 2018-06-06 14:29:49 +03:00
Kevin Bracey a8e8775aa9 Kinetis EMAC: Correct TX ring pointer array size
TX pointer array was using RX ring length in its declaration.
Wasted memory if RX ring > TX ring, as is the default, but would
be broken if RX ring < TX ring.
2018-06-06 13:30:01 +03:00
Kevin Bracey 30e68f3201 Kinetis EMAC: Make number of buffers configurable
16 RX buffers and 8 TX buffers is probably excessive. Nanostack
version of driver successfully used 4+4, and data pump should be
broadly equivalent.

This means that switching K64F devices from Nanostack to EMAC increases
base heap usage by 18K - observed in Nanostack border router builds.

Add a config option to make it possible to lower the number of buffers.
Defer consideration of lowering the default to later.
2018-06-06 13:30:01 +03:00
Kevin Bracey 6c6bcc3575 NSAPI: Use IPv6 conversion routines from frameworks
Share IPv6 conversion code with mbed_trace, Nanostack and
mbed client.

Output formatting is better, being conformant to RFC 5952.
2018-06-05 15:31:18 +03:00
Mika Leppänen 9ec1ec90d9 Fixed DNS resolution in case all sendto operations fail
DNS resolver now counts how many sendto operations are successful
during one DNS server attempt cycle (attempting to contact DNS
servers from 0 to last index, including stack specific ones). If all
socket sendto operations fail, DNS resolution is aborted.

If one or more are successful, DNS resolution is continued until
total network attempts count is reached or all sendto operations
fails during a cycle.
2018-06-05 14:29:48 +03:00
Veijo Pesonen aafeef7401 gethostbyname won't accept empty name
Considers both versions - synchronous and asynchronous. Earlier the
underlying stack was trusted to do this check.
2018-05-30 12:07:07 +03:00
Cruz Monrreal 24cebbaec3
Merge pull request #7016 from mikaleppanen/async_dns_corr
Corrected asynchronous DNS functionality
2018-05-29 10:48:17 -05:00
Cruz Monrreal 7418260b78
Merge pull request #7014 from KariHaapalehto/interface_check
Add check for _interface
2018-05-29 10:42:19 -05:00
Kari Haapalehto 8540b1ea23 Add check for _interface 2018-05-25 12:16:00 +03:00
Mika Leppänen d648bf8477 Corrected asynchronous DNS functionality
- Set network stack to store event queue so that mbed::mbed_event_queue() call
  is not needed every time call_in() is called
- Added dns state variables and enum (states are: created, initiated and cancelled)
- Corrected DNS response handling so that if DNS server returns that host name is
  unknown the DNS query is not tried again
- Reorder mutexes in nsapi_dns_query_multiple_async()
- Created nsapi_dns_query_async_initiate_next() function to initiate the next
  DNS query from the queue after delete of previous query
- Added dsn_timer_running variable to supervise DNS timer start/stop
- Changed cancel function to only mark query as deleted and moved deletion
  to timer function. This allows to run socket close on DNS thread
- Added new nsapi error NSAPI_ERROR_TIMEOUT for DNS (and other) timeouts
2018-05-25 11:21:52 +03:00
Seppo Takalo f989f6838b Fix build for MBT_ODIN_W2 and MBED_CONNECT_ODIN when using WiFi
Odin WiFi driver was only supplied for EVK board.
These all are just the same module, so using the main target name
that all inherit.
2018-05-25 10:54:09 +03:00
Asif Rizwan 657ac3f643 WIFI_EMAC class renamed to OdinWiFiEMAC, Formatting
Revert "in ODIN emac initialization required before connection"
2018-05-23 12:25:21 +03:00
Kevin Bracey 7e4eb5c24b LPC546XX: Correct Ethernet length calculations
Subtract 4 from the received packet length - the buffer contains the
CRC, which we shouldn't pass up.

Ensure we allocate receive buffers of a size corresponding to the
rounded-up size we tell the hardware - the hardware was overrunning the
allocation by a couple of bytes.
2018-05-23 12:25:21 +03:00
Mahesh Mahadevan 91ac8356ba LPC546XX: Add ENET support
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-05-23 12:25:20 +03:00
Asif Rizwan 0b14f1277e EMAC adaption added, updated ODIN drivers to v2.5.0 RC1 2018-05-23 12:25:18 +03:00
Kevin Bracey f3ec0dacd5 Add NetworkInterface::get_default_instance()
Provide an initial framework to make it easier to find a default network
interface.
2018-05-23 12:25:17 +03:00
Mika Leppänen e481c5ef75 Added memory manager set to add_ethernet_interface() of test stack
This allows that EMAC memory manager can be used to allocate EMAC driver
memory already after the add_ethernet_interface() call.
2018-05-23 12:24:11 +03:00
Mika Leppänen 31b8f73de7 Changed mutexes, delete and DNS call in callback set
- Changed mutexes to platform mutexes
- Removed not needed null check from delete
- Changed nsapi_dns_call_in_set() to use call_in_callback_cb_t and
added prototype to header
2018-05-23 12:24:10 +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
TomoYamanaka bad530ab0d Implementation of unified EMAC driver for Renesas mbed boards
Implementation of unified EMAC driver for Renesas mbed boards

Based on the driver so far, Renesas implemented the emac driver for GR-PEACH and VK-RZ/A1H.
The mainly changes is below.
- Add the connection part with LWIP according to the unified emac specification.
- Add three new multicast functions(add, remove, set_all).

The Greentea test netsocket and emac test passed.
2018-05-23 12:24:09 +03:00
cyliangtw 7bfa362492 [M487/NUC472] Fix tx frame length and remove GPL license 2018-05-23 12:24:09 +03:00
cyliangtw 401f09c479 [M487/NUC472] Support DHCP & TCP sample, also remove legacy emac 2018-05-23 12:24:09 +03:00
cyliangtw 89209b6cd5 [M487/NUC472] Support new EMAC feature, built OK 2018-05-23 12:24:08 +03:00
Mahesh Mahadevan 82b2a27a1c Kinetis EMAC: Renamed K64F files to Kinetis
This driver is used by more SoC's than K64F

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-05-23 12:24:07 +03:00
Mahesh Mahadevan 7bc4c0ec21 K64F, K66F: Update the SYSMPU implementation
Do not disable SYSMPU, instead add access for ENET bus master

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-05-23 12:24:07 +03:00
Mika Leppänen de72090d26 Changed STM emac driver to loop RX frame reading 2018-05-23 12:24:06 +03:00
Kevin Bracey 953f1b615a Add EMAC driver README.md with porting guide 2018-05-23 12:24:06 +03:00
Kevin Bracey fbd920777b Add extra labels for Freescale & STM EMAC drivers
Just checking "does the chip have an EMAC" doesn't work - there are
targets using those chips which do not have an Ethernet connector and
don't provide the necessary surrounding infrastructure (eg DISCO_F429ZI,
not providing the board emac config call, and HEXIWEAR not providing PHY
info).

Make the targets that actually do want EMAC define their own local
Freescale_EMAC and STM_EMAC labels, and move the drivers into
the corresponding TARGET_ directories, removing the #ifdefs.
2018-05-23 12:24:06 +03:00
Kevin Bracey d83dec9ea4 Stop drivers checking DEVICE_EMAC
Checking DEVICE_EMAC is problematic - particularly for the Odin W2 where
apps have been shutting this off to disable the Wi-fi interface.

Make drivers check a locally-relevant flag instead, pending new
thoughts on how to achieve application/test-relevant flagging for
XXX:get_default_instance() being provided by a system.

However that is achieved, drivers do require a flag set purely by the
target - they mustn't be tripped up by an add-on module providing itself
as the system's default EMAC.
2018-05-23 12:24:05 +03:00
Mika Leppänen 01b4d97cb4 Corrected STM eth driver flagging, memory allocation and thread init 2018-05-23 12:24:05 +03:00
Kevin Bracey 3c83c62ff7 Nanostack EMAC implementation
Make Nanostack an OnboardNetworkInterface, implementing
add_ethernet_interface so it can use EMAC drivers.

Can now be used via EthernetInterface, and be the system's default
network stack.

Legacy support for NanostackEthernetInterface retained. Some
restructuring of mesh interface code to fit into the
OnboardNetworkStack:::Interface system.
2018-05-23 12:24:04 +03:00
Kevin Bracey a0d374ef00 Extend EMAC multicast APIs 2018-05-23 12:24:02 +03:00
Kevin Bracey 5472a9703f EMAC: check link status callback is set
Nanostack doesn't set the link status callback. Make sure the two
example drivers don't crash if it isn't set.
2018-05-23 12:24:02 +03:00
Kevin Bracey 7ce098acb4 K64F EMAC: Fix TX error path leaks 2018-05-23 12:24:02 +03:00
Mika Leppänen 5da3cd9cce Added preferred alignment to emac and copy to/from to memory manager 2018-05-23 12:24:01 +03:00
Kevin Bracey 4950a993fd Move STM EMAC driver out out lwIP 2018-05-23 12:24:01 +03:00
Mika Leppänen 668e0821a1 Updated K64F ethernet driver to use memory manager 2018-05-23 12:24:00 +03:00
Mika Leppänen bc5d4d1c0d Created memory manager class to netsocket and updated lwip to use it
instead of old memory interface.
2018-05-23 12:24:00 +03:00
Kevin Bracey b222c25435 Work around Nuvoton #define EMAC 2018-05-23 12:23:58 +03:00
Kevin Bracey 0ecf4e4695 Move Freescale EMAC driver out of lwIP 2018-05-23 12:23:58 +03:00
Kevin Bracey 74dfe3423a Add downcast methods to NetworkInterface
As we've introduced virtual inheritance to support EMACInterface, we can
no longer use C-style casts or static_cast to downcast from
NetworkInterface to more specific types. RTTI is disabled in the
toolchains, so dynamic_cast is unavailables.

Add virtual downcast methods to permit conversions to the 6 derived
classes. Probably only needed for EMACInterface, WiFiInterface and
EthInterface, but handles the set.
2018-05-23 12:23:55 +03:00
Kevin Bracey 6dffe6e4e7 Remove CellularInterface
This has been superceded by CellularBase. Name change occurred late
in review of https://github.com/ARMmbed/mbed-os/pull/4119 and
original unused CellularInterface was left behind.
2018-05-22 11:44:46 +03:00
Kevin Bracey 1c5bbaf4d8 Insert EMACInterface class
Rather than let "EthernetInterface" be the base EMAC NetworkInterface,
insert an "EMACInterface" class.

EthernetInterface then derives from EMACInterface and EthInterface.

A Wi-Fi driver can derive from EMACInterface and WiFiInterface - this
will be more logical than deriving from EthernetInterface and
WiFiInterface.

This does mean adding a couple of virtual inheritances to avoid
duplicate NetworkInterfaces:

                   NetworkInterface
                     /           \
            virtual /             \ virtual
                   /               \
             EMACInterface     WiFiInterface
                   \               /
                    \             /
                     \           /
                  MyCustomWiFiInterface
2018-05-22 11:44:45 +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
Amanda Butler a83745bcdd
Copy edit UARTCellularInterface.h
Copy edit file for grammar.
2018-04-17 11:51:24 -05:00
Amanda Butler 8389bbfc61
Copy edit PPPCellularInterface.h
Copy edit file for grammar.
2018-04-17 11:49:20 -05:00
Amanda Butler 0f8a2c75e7
Copy edit OnboardCellularInterface.h
Copy edit file for grammar.
2018-04-17 11:44:28 -05:00
Amanda Butler 5835d83efa
Copy edit CellularInterface.h
Copy edit for grammar.
2018-04-17 11:41:59 -05:00
Teppo Järvelin 3b1c8c0a94 Cellular: Updated doxygen for deprecated API's. 2018-04-17 12:30:16 +03:00
Teppo Järvelin 89843246ac Separated context activation from connect, increased stack size to 2048 to avoid stack underflows and changed connection callback call. 2018-04-11 09:31:44 +03:00
Teppo Järvelin 83ea9be5f5 temp commit while changing work... 2018-04-11 09:31:44 +03:00
Teppo Järvelin 1661fc2744 Modified state machine, added cellular state and callback. 2018-04-11 09:31:44 +03:00
Max Payne bd47110554 Fix IPv4 address parsing due to not-so-portable scanf modifier
Bug is raised when using newlib-based toolchains.
%hh format is only avaliable in scanf if newlib is compiled
with _WANT_IO_C99_FORMATS option.
2018-04-02 23:33:21 +03:00
Cruz Monrreal 7c30faf69d
Merge pull request #6264 from jarvte/master
Deprecated warnings for feature/netsocket/cellular
2018-03-16 13:32:09 -05:00
Cruz Monrreal 9cac3b2f6b
Merge pull request #6149 from bmcdonnell-ionx/typos
Fix typos in the files
2018-03-15 10:53:03 -05:00
Teppo Järvelin 53455c5528 Fixed correct includes so that compile log is not polluted. 2018-03-13 16:23:15 +02:00
Teppo Järvelin 16e8b77474 PR review findings, updated deprecated comments. 2018-03-13 13:15:29 +02:00
Antti Kauppila 783d0c58f5 MBED_DEPRECATED_SINCE taken into use 2018-03-13 13:15:29 +02:00
Teppo Järvelin 7fd6b71337 Moved APN_db.h under new cellular. 2018-03-13 13:15:29 +02:00
Teppo Järvelin bee31ad1b3 Added deprecation notes to old cellular interfaces. 2018-03-13 13:15:29 +02:00
Amanda Butler a302a4be6d Copy edit OnboardCellularInterface.h
Copy edit file for active voice and removal of Latin abbreviations.
2018-03-02 14:38:08 +02:00
Ari Parkkila e53b93114e Typedef OnboardCellularInterface to EasyCellularConnection 2018-03-02 14:38:07 +02:00
Rob Meades 2fe3223612 Make MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP default in mbed_lib.json while
ensuring that, if there is a user-specified APN, it is still used.
2018-02-26 11:33:40 +00:00
Teemu Kultala 34ef11630c fix issue 6150 by always setting net interface UP in mbed_set_dhcp 2018-02-22 13:00:46 +02:00
Brendan McDonnell c4f10aafee typos 2018-02-20 20:11:19 -05:00
Jarno Lamsa 8bea5ef438 Add some documentation for the callback 2018-02-12 11:02:07 +02:00
Teemu Kultala 5a7482667e NSAPI status callback changes
This is the original content of feature-status-callbacks, reviewed in
https://github.com/ARMmbed/mbed-os/pull/5457
2018-02-09 12:44:31 +02:00
Kevin Bracey 15a3922f58 Correct return value of nsapi_dns_query_multiple
Documentation states that nsapi_dns_query_multiple returns the number of
addresses found on success - it was returning 0.

Overloads using SocketAddress are relying on the return value, meaning
those calls didn't work at all.

Fixes #5921.
2018-01-26 14:08:29 +02:00
Seppo Takalo 6bf0611748 Clarify TCPSocket::recv() and UDPSocket::recvfrom() documentation. 2018-01-12 12:03:56 +02:00
Kevin Bracey 67b97d39c4 Make TCPSocket send all data when blocking
Previously, send() was somewhat soft - it only ever made one send
call to the underlying stack, so it would typically take as much data
as would fit in the buffer, and only block if it was unable to write
anything.

This is not the intent of a POSIX socket/filehandle write. It should try
to send everything if blocking, and only send less if interrupted by a
signal:

 - If the O_NONBLOCK flag is clear, write() shall block the calling
   thread until the data can be accepted.

 - If the O_NONBLOCK flag is set, write() shall not block the thread.
   If some data can be written without blocking the thread, write()
   shall write what it can and return the number of bytes written.
   Otherwise, it shall return -1 and set errno to [EAGAIN].

This "send all" behaviour is of slightly limited usefulness in POSIX, as
you still usually have to worry about the interruption possibility:

  - If write() is interrupted by a signal before it writes any data, it
    shall return -1 with errno set to [EINTR].

  - If write() is interrupted by a signal after it successfully writes
    some data, it shall return the number of bytes written.

But as mbed OS does not have the possibility of signal interruption, if we
strengthen send to write everything, we can make applications' lives
easier - they can just do "send(large amount)" confident that it will
all go in one call (if no errors).

So, rework to make multiple sends to the underlying stack, blocking as
necessary, until all data is written.

This change does not apply to recv(), which is correct in only blocking until
some data is available:

 - If O_NONBLOCK is set, read() shall return -1 and set errno to [EAGAIN].

 - If O_NONBLOCK is clear, read() shall block the calling thread until some
   data becomes available.

 - The use of the O_NONBLOCK flag has no effect if there is some data
   available.
2017-11-21 09:51:36 +02:00
Kevin Gilbert b56ced249a Add multicast implementation for UDPSocket. IPv4 and IPv6 both supported. 2017-10-10 18:21:18 -05:00
Jimmy Brisson 908a05b231 Merge pull request #5016 from u-blox/apndb_fix
Fix cellular APN_db.h lookup.
2017-09-27 09:06:46 -05:00
Hasnain Virk 8c9a0b3aa5 Seperatig string literal from macro
From C++11 and beyond string literals must be seperated by space
so that they are recongizable as seperate tokens.

Context macro in PPPCellularInterface (CTX) has been causing issues
as it was not augmented with a space from a nearby string literal.
2017-09-15 17:39:46 +03:00
adbridge 6bd28ecb68 Remove string literal values and revert back to using CTX macro .
The previous fix to replace CTX with string literals was the wrong
solution. All that was actually required was to insert a space before
the macro.
2017-09-11 11:13:54 +01:00
Deepika 0132d31124 Fix IAR8 : user-defined literal operator not found
Cellular example had build issues with IAR8, combination of define and string
as argument to send function resulted in above error. Typecasting to const char *
didn't help, hence replacing the define explicitly.
2017-09-10 09:58:34 -05:00
Rob Meades bce900d8f7 Fix cellular APN_db.h lookup. 2017-09-05 11:50:51 +01:00
Martin Kojtal abafc6e7df Merge pull request #4580 from deepikabhavnani/wifi_34
Use EventFlags instead of Semaphores
2017-09-04 16:54:55 +01:00
Deepika beb5aac640 RTOS: Add EventFlags class
EventFlags class is a wrapper for Event Flag functionality introduced in
RTOS2/RTX5.
2017-08-29 14:07:44 -05:00
Mika Leppänen dd346ec5a8 Either ipv4 or ipv4v6 PPP and IP stacks are enabled based on 3GPP context 2017-08-22 13:14:41 +03:00
Russ Butler 026df0b7cd Turn on doxygen for DEVICE_* features
Enable doxygen for all device features. Also fix the warnings that
showed up once this was enabled.
2017-08-11 15:47:44 -05:00
Martin Kojtal 334c02f7d4 Cellular: not-supported error if MODEM_ON_BOARD not defined
If a test is empty, it leads to undef. Therefore if a test requires additional
details, it should print an error [NOT SUPPORTED].
2017-06-30 10:01:46 +01:00