Commit Graph

158 Commits

Author SHA1 Message Date
Juha Niskanen
3b21cd9ceb netutils/ntpclient: add more features
Allow multiple NTP servers, also with runtime configurable list
Add validation of received NTP packets
NTPv4 support with 'Kiss o' Death' message handling
IPv6 support
Collect multiple NTP samples and filter outsiders
Check if system clock has been altered during NTP (if CONFIG_CLOCK_MONOTONIC)

Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-01-26 03:23:27 -08:00
YAMAMOTO Takashi
1131cbe14d webclient: Implement AF_LOCAL 2021-01-17 18:44:17 -08:00
Juha Niskanen
35535655c5 ntpclient: change sinfo to ninfo
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-01-14 11:07:58 -06:00
Juha Niskanen
2a11d60246 netutils/ftpc: fix incorrect comments, nxstyle
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-12-13 11:14:43 -06:00
YAMAMOTO Takashi
73fb7baa05 webclient: Distinguish request size and buffer size in body callback
This fixes the case when webclient_set_static_body is used
for data larger than webclient_context::buflen.

Note: as of writing this, webclient_set_static_body is the
only user of body_callback in NuttX apps tree.
2020-11-19 18:46:38 -08:00
YAMAMOTO Takashi
a1db71fa43 webclient improvements
Highlights:

* TLS support (a hook to allow users to provide TLS implementation)
* ability to add extra request headers
* ability to use PUT method
* ability to report http status
* error handling improvements

Proposed on the ML while ago:
https://www.mail-archive.com/dev@nuttx.apache.org/msg03803.html

The original API is kept for now.
I plan to remove them after adapting the existing users.
(examples in this repo)
2020-10-01 15:32:25 +08:00
YAMAMOTO Takashi
b78370dbf2 webclient: move WGET_USE_URLENCODE definiton to the header
Because it's used by the header.

This fixes warnings while building wgetjson.
2020-09-30 08:22:16 +02:00
Xiang Xiao
837b405624 Change all files come from Xiaomi/Pinecone to Apache License 2.0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-23 15:44:32 -06:00
Peter van der Perk
839b3530d4 netlib: add AF_CAN family and CONFIG_NET_CAN support 2020-06-15 07:23:37 -06:00
YAMAMOTO Takashi
984b80d7cf netlib.h: Fix nxstyle complaints 2020-05-27 16:41:13 +08:00
YAMAMOTO Takashi
4e32615ab7 netlib: #if 0 out unimplemented fields in url_s
- Avoid giving a wrong impression to users
- Save a little memory
2020-05-27 16:41:13 +08:00
chao.an
018c9420ac netutils/dhcpd: cancelable dhcp daemon
Change-Id: Iea3c0b8f91b0d6d8ececcd3932d8756a9d021608
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-09 13:31:15 -06:00
Juha Niskanen
2aabd1c9a7 webclient: run through nxstyle
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-04-23 09:29:36 -06:00
Juha Niskanen
f8f16975a9 webclient: use getaddrinfo to get IPv4 addresses on dual stack systems
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-04-23 09:29:36 -06:00
Alan C. Assis
6e403fc343 Fix remaining issues with nxstyle 2020-04-16 20:39:47 -06:00
Alan C. Assis
04856ccfde Rescue incorrectly removed line 2020-04-16 20:39:47 -06:00
Alan C. Assis
d10eb2ae3a Fix nxstyle issue for Juha patch 2020-04-16 20:39:47 -06:00
Xiang Xiao
41d88f06e7 Run codespell -w with the latest dictonary again 2020-02-23 07:10:14 -06:00
Xiang Xiao
d660492289 Run codespell -w against all files
and fix the wrong correction
2020-02-22 14:41:36 -06:00
Xiang Xiao
bf3e6e2367 Improvements for telnet server
Author: Xiang Xiao <xiaoxiang@xiaomi.com>

    Check POLLHUP and POLLERR in telnet poll loop

      to handle the remote end close correctly

    Send "NVT"(network virtual terminal) as the default if getenv("TERM") return NULL

      telnet should trigger the error handling if inet_pton return zero
      since zero mean the string has format error

    Don't return 1 in _environ_telnet to avoid trigger the compression
    and remove the redundant TELNET_TELOPT_COMPRESS2 check

    Change telnet_error_u to telnet_error_e required by the coding standard

    Ensure telnet object get freed before the abnormal exit
2020-02-04 19:09:22 -03:00
Xiang Xiao
1154735ca6 Refine the preprocess conditional guard style 2020-01-31 11:04:10 -06:00
Xiang Xiao
e0dcfa0c55 Remove extra whitespace from files (#43)
* Remove multiple newlines at the end of file
* Remove the white space from the end of line
2020-01-31 08:29:24 -06:00
Ouss4
eb1af03259 examples/sendmail: Few fixes to make the example run on a local SMTP
server.
2020-01-25 16:39:21 -06:00
Xiang Xiao
db61c92100 Fix dhcpd #17
apps/netutils/dhcpd/dhcpd.c:  Fix unused const variable

dhcpd.c:273:29: warning: 'g_anyipaddr' defined but not used [-Wunused-const-variable=]
 static const uint8_t        g_anyipaddr[4] = {0, 0, 0, 0};

apps/netutils/dhcpd:  Make dhcpd interface configurable

apps/netutils/dhcpd:  Lease address directly if hit in address range

apps/netutils/netinit: Initialize dhcpc_state

update the addresses only on request success
2020-01-16 12:06:25 -06:00
Gregory Nutt
3da8091d30 Include nuttx/symtab.h instead of nuttx/binfmt/symtab.h since symtab.h under binfmt folder is for internal use. 2019-12-10 08:39:22 -06:00
Gregory Nutt
1859f56380 apps/netutils/netinit, apps/netutils/netlib/, and apps/include/netutils/netlib.h: Extend a few definitions to permit building netutils and netinit with only Netlink sockets enabled. 2019-11-19 09:49:36 -06:00
Gregory Nutt
449290c8da apps/examples/netlink_route: Add test/example of NETLINK_ROUTE 'get' opeations. apps/netutils/netlib: Fixes to NETLINK_ROUTE helpers found by testing with apps/examples/netlink_route. 2019-11-11 13:40:57 -06:00
Gregory Nutt
438777cd38 netutils/netlib/netlib_getroute.c: Add function to retrieve routing tables using netlink. 2019-11-10 12:36:34 -06:00
Gregory Nutt
e260ea779c apps/netutils/netlib/netlib_getnbtab.c: Add a utility function that will return a list of all network devices in the UP state. 2019-11-09 17:38:02 -06:00
Gregory Nutt
2507cc15e8 netutils/netlib/netlib_getnbtab.c: Add support for retrieving a snapshot of the IPv6 neighbor table using Netlink sockets. 2019-11-08 11:30:32 -06:00
Gregory Nutt
b65c3dac0e netutils/netlib/netlib_getarptab.c: Misc fixes from initial testing with the 'arp -t' commeand. 2019-11-03 19:29:20 -06:00
Gregory Nutt
400995dec6 nshlib/nsh_netcmds.c: Add a -t option to the arp command which will enable printing the entire ARP table. 2019-11-03 16:19:14 -06:00
Gregory Nutt
768218ee81 netutils/netlib/netlib_getarptab.c: Add a function to read the entire ARP tableusing NETLINK_ROUTE protocol. 2019-11-03 15:13:47 -06:00
Masayuki Ishikawa
9eff955556 Merged in masayuki2009/nuttx.apps/fix_webserver_with_period (pull request #183)
netutils/webserver: Fix directory listing containing period in name

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-07-06 13:05:45 +00:00
Masayuki Ishikawa
0b352178c1 Merged in masayuki2009/nuttx.apps/add_dirlist_to_webserver (pull request #181)
netutils/webserver: Add directory listing to httpd

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-07-05 02:58:53 +00:00
Masayuki Ishikawa
b12b61df69 Merged in masayuki2009/nuttx.apps/fix_webserver (pull request #179)
apps/examples/webserver: Fix to compile with CONFIG_NETUTILS_HTTPD_SENDFILE=y

Also, in this PR, some configs such as CONFIG_NETUTILS_HTTPDFILESTATS
can be selected by menuconfig.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-07-03 12:20:29 +00:00
Gregory Nutt
bd14bf7165 apps/netutils/json: Removed. Replaced with apps/netutils/cjson. 2019-06-03 19:17:25 -06:00
Gregory Nutt
9fd60f1908 apps/include/netutils/cJSON.h: Restore file that was accidentally removed with commit f730108adb. The normal way to recover from errors like this is to revert the change, then reapply it without the error. But I could not do that in this cast because there were too many conflicts when try to revert the commit. Instead, this commit just restores the file, losing its history. This lost history on this file is not long and is duplicated in its entirety here:
Author: Pierre-Noel Bouteville <pnb990@gmail.com>
  Date:   Sun Dec 4 08:01:56 2016 -0600

      Remove some garbage characters added by error.

  commit f8d425f0ad
  Author: Pierre-noel Bouteville <pn_bouteville@yahoo.fr>
  Date:   Tue Jul 12 16:27:14 2016 -0600

      apps/netutils/cJSON: Eliminate some warnings

  commit b9cf7acb1a
  Author: Gregory Nutt <gnutt@nuttx.org>
  Date:   Sun Apr 13 16:24:28 2014 -0600

      More trailing whilespace removal

  commit 2a038d1bc0
  Author: patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>
  Date:   Sat Oct 27 18:21:26 2012 +0000

      Add port of cJSON from Darcy Gong

      git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5267 42af7a65-404d-4744-a932-0658087f49c3
2019-05-31 09:17:30 -06:00
Gregory Nutt
dd35a7cacc apps/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled. 2019-05-21 19:08:12 -06:00
Sebastien Lorquet
fc7aa92b57 apps/netutils/libcurl4nx: This is an initial comit libcurl4nx. It is not complete yet, but I still wish to commit the unfinished bits to describe the roadmap, and because it is already usable. It will be updated and fixed in the future weeks and months, certainly including POST support and later, SSL.
Some improvements could be made by anyone.  For example, I know the main routine in perform() shall be split into several parts for readability. I apologize in advance for this kind of spaghetti code, but I was short on time to refactor it.  Also chunked HTTP transfer encoding would be a nice contribution from anyone interested. It is detected but not yet supported.
2019-05-03 07:26:13 -06:00
Gregory Nutt
f730108adb Squashed commit of the following:
apps/graphics/NxWidgets:  Fix a possible deadlock condition when waiting for window geometry data that will never come.  Fixed by re-requesting geometry data if we don't already have it.

    apps/graphics/twm4nx:  Add some debug output.

    apps/graphics/twm4nx:  Rethink how background events are handled.

    apps/grephics/twm4nx:  Expermimental organization to capture background events.
2019-05-01 11:11:43 -06:00
Gregory Nutt
8f5944c4a8 Squashed commit of the following:
include/ and netutils/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    nshlib/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    system/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    testing/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    examples/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
2019-04-29 14:53:38 -06:00
Gregory Nutt
ad57b3de4d apps/graphics/twm4nx: Add options to initialize the system via boardctl() and to bring up the network using the new apps/netutils/netinit. This latter is only necessary because VNC is being used to provide graphics. 2019-04-29 11:49:15 -06:00
Gregory Nutt
94a0d92b54 This commit removes the private network initialization logic from NSH and puts in a common location at apps/netutils/netinit. Now that netork initialization logic can be used by applications that do not include NSH.
Squashed commit of the following:

    apps/nshlib:  Remove NSH initialization.  Now uses the common apps/netutils/netinit logic (which was cloned from nshlib to begin with).

    apps/netutils/netinit:  Clone network initialization logic from NSH to this directory so that it can be available for general use.
2019-04-29 10:22:56 -06:00
Sebastien Lorquet
fe0954cd62 netutils/netlib/netlib_parseurl.c: Add a more flexible version of netlib_parsehttpurl. This one can parse any URL, and is extensible so future improvements keep the same API. 2019-04-26 13:08:38 -06:00
Gregory Nutt
9db029e318 The file system can no longer be disabled. Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS==0 2019-02-11 13:10:10 -06:00
ligd
557cd8e454 netutils/codecs/base64.c: Add base64_[de|en]code_length() API 2019-01-27 07:20:25 -06:00
Xiang Xiao
4d2f580568 apps/netutils/codecs/base64.c: Remove the big stack array 2019-01-27 07:17:07 -06:00
Gregory Nutt
e88a529010 From patch attached to nuttx/ Bitbucket Issue #136 from Vlado Vidovic:
The patch provided in issue 135, which adds support for HTTP Chunked Encoding, covers all paths in the webserver app except CGI callbacks. As a result, if a page being served happens to use CGI, it could generate stream content that does not comply with HTTP Chunked Encoding.

The patch attached amends the webserver app's CGI callbacks to use the HTTP Chunked Encoding sender function instead of using send() directly.
2018-11-23 17:29:07 -06:00
Gregory Nutt
d3c36663d0 netutils/webserver: Contributed by "Anonymous" via attachment to Bitbucket issue #135: "webserver broken when scripting support enabled - support for chunked encoding fixes it"
The webserver/httpd app is currently broken when script support is enabled (CONFIG_NETUTILS_HTTPD_SCRIPT_DISABLE). The root cause has been tracked down to the "Content-length" not being available ahead of time in this case (length of -1 passed to send_headers() ). On the other hand, the server closing the socket does not result in FIN being sent to the browser either (FIN not supported by NuttX yet).

Simple solution: Add support for HTTP Chunked Encoding to webserver/httpd (attached patch).

The attached patch is simple. It adds a configuration option to enable chunked encoding. When enabled, the implementation will auto-detect the cases where content length is not available ahead of time, and will automatically engage chunked encoding transfers.

Without this patch, the browser/client hangs forever, as it is expecting more data. With this patch, the browser displays the content.
2018-11-23 10:13:34 -06:00