mbox series

[v1,0/8] suricatta: ipc: add request to get hawkBit server status

Message ID 20211015082457.6804-1-roland.gaudig-oss@weidmueller.com
Headers show
Series suricatta: ipc: add request to get hawkBit server status | expand

Message

Roland Gaudig Oct. 15, 2021, 8:24 a.m. UTC
From: Roland Gaudig <roland.gaudig@weidmueller.com>


This patch series ads a new GET_STATUS request to the Suricatta IPC
API. The response contains a JSON object representing the connection
status to the hawkBit server during the last poll cycle.

        { "server" : {
                        "status" : <status>
                        "time" : <time>
                     }
        }

The value of <status> is just an integer value according the
channel_op_res_t enum from channel_op_res.h.

The value of <time> contains an ISO 8601 formatted date time string.

To suport converting older timestamps from logs the
swupdate_time_iso8601 function has been extended with a parameter
for entering a struct timeval. In case a NULL pointer is passed, it
will convert the current time like it did before this modification.

While testing the new GET_STATUS request some problems were discovered.
In case the hawkBit server was not availlable or there were connection
problems the IPC socket could have been blocked for several minutes,
without responding a valid status. To overcome these problems the
Suricatta IPC has been separated into a separate thread.

As during start-up the server_start function could stay very long
inside a loop waiting for server responses before entering the
Suricatta main loop, an additional status CHANNEL_REQUEST_PENDING
has been added to channel_op_res_t. This allows the GET_STATUS
request to return a more specific status what is going on during that
phase.

For testing the "trigger" command I extended the swupdate-hawkbitcfg
with an additional option for emitting "trigger" requests.



Roland Gaudig (8):
  util: add optional swupdate_time_iso8601 param
  suricatta: add basic status request
  tools: add swupdate-gethawkbitstatus
  tools: add trigger to swupdate-hawkbitcfg
  gitignore: add tools/swupdate-gethawkbitstatus
  doc: add description for hawkBit server status
  channel_curl: add separate error codes for SSL
  suricatta: separate ipc into separate thread

 .gitignore                        |  1 +
 core/util.c                       |  9 ++-
 corelib/channel_curl.c            | 12 ++--
 doc/source/swupdate-ipc.rst       | 23 +++++++
 include/channel_op_res.h          |  5 +-
 include/network_ipc.h             |  3 +-
 include/util.h                    |  2 +-
 suricatta/common.c                |  3 +
 suricatta/server_general.c        |  2 +-
 suricatta/server_hawkbit.c        | 54 ++++++++++++++++-
 suricatta/server_hawkbit.h        |  2 +
 suricatta/suricatta.c             | 99 ++++++++++++++++++++++---------
 tools/Makefile                    |  1 +
 tools/swupdate-gethawkbitstatus.c | 56 +++++++++++++++++
 tools/swupdate-hawkbitcfg.c       | 12 ++++
 15 files changed, 245 insertions(+), 39 deletions(-)
 create mode 100644 tools/swupdate-gethawkbitstatus.c