Commit Graph

343 Commits (293b0189d2192c4ff8e41e9b34564a7f52c5bfd7)

Author SHA1 Message Date
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