Hello folks,
I looked into https://sbabic.github.io/swupdate/swupdate-ipc-interface.html?highlight=api. I found a high-level protocol explanation in it. But, it's not enough to write a library/framework to favorise alternative tools/services.
I started the reverse-engineering process from the source code and filed the blank with the protocol implementation. I found a `union` in https://github.com/sbabic/swupdate/blob/master/include/network_ipc.h to describe all messages.
Because of this kind of design approach, the documentation part is not easy to write. A third-party component should not rely on an easy breakable part of an API.
Facts:
- union relies on the biggest entity present on the C-struct)
- all read/write ops rely on `sizeof(msg)` in `network_ipc.c`.
Should we debate about refactoring or creating new interfaces?
Considerations:
From these considerations, I need support from maintainers, contributors and community members to elaborate a plan that satisfied all of us.
Before any proposal, do you have any pieces of advice, ideas, highlights, pros, cons, requested features or whatever you want to put in this debate?
Thank you all for your time,
Best Regards,
Sorry for the spam,
Hi Stefano and Michael,
Thank you so much for your messages and your time,
Yes, I can elaborate on a use case.
I think a simple API should be available to integrate SWUpdate software with alternative tooling.
# 1 - use case
Write an HTTP service (e.g in Rust) that allows update (POST) without depending on any no necessary services (e.g mongoose) or C-binding usage.
Example: This HTTP REST API can be in Rust with an authentication controller. We should be able to update the target from this secure endpoint.
> This API is described in the documentation, but it is also thought that
details remain hidden using the binding libraries (libswupdate and
lua_swupdate) provided with the project.
I rely on the documentation that says `API for external programs`. So, it's, from my understanding point of view, the best approach to use the `API for external programs` for communication.
> Correct - to overcome this, user should take advantage of the provided
libraries instead of accessing the API directly.
I am not sure about this part. Is there another API or under the hood the libraries accessing the API directly?
# 2 - use case
Write an alternative progress client that updates a local event bus (e.g MQTT Broker) with the progress status. Again, my point of view is that `API for external programs` should be used to listen to progress status and send events through the event bus.
# Anwsers
> struct alignment, usage of enum in structs, endianness
If the API is well-documented and easy, you should be able to implement your own external interface/adapter between remote and local transport layers. I don't think is important to deal with these parts for a local communication IPC. I second Stefano on it.
But, you're right about enum and compiler-specific syntax interpretation.
> To be clear: there is no intention that the API (as explained in
network_ipc.h) is thought to be used remotely, it is thought to be used
only by processes running on the device itself and if the user knows how
security is affected doing this.
I don't plan to expose it remotely. Read about my use case on top.
>> The API should standardize protocol or well-defined protocol
> What are we talking about ? Can you tell something more, examples ?
> Let's see - at this point of the project, compatibility is important and we
cannot break the past. Improvement must take care of this.
Yes,
Thank you all,
B. r
Walter BONETTI
Software Developer
In that way of talking about API - we make test to implement SWUpdate for our devices.
Now we develop Client GUI (Ionic for Android and iOS) who will
check Hawkbit for updates about particular device with his ID.
Then GUI will download the update and send to device when connect
to device's access point. The device doesn't have Internet nor
access to Hawkbit.
We expect difficulties to upload to the device .swu file causing
CORS policy violation.
app/connect:1 Access to XMLHttpRequest at 'http://10.100.30.17:8080/' from origin 'http://localhost:8100' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Hi folks,
It's been a long time without any response on my side. I was overloaded. Sorry!
First, thank you @Stefano Babic,
# Why Mongoose should not be mandatory?
The hard dependecy in the yocto recipe to mongoose server and the Web-UI is a limitation.
As I said, mongoose should not be part of the SW update. But a third-party implementation. The current mongoose interface doesn't fit well and limits others third-party to provides alternatives.
# What is about optimization?
I don't think we should over optimize things. We should prefere breakable logic parts and "eco-system's integration".
# Outdated IPC/documentation :
I was implementing my own swupdate-progress (Rust Based) to map event over my internal mqtt bus.
# Current workaround to bypass mongoose requirements
> This was already done on several projects, but because the license is
more permissive, none was reported back. The IPC is not in
network_ipc.h, but in progress_ipc.h. Because this is just a description
of a message, it is quite straightforward and users have built their own
version in the preferred language just connecting to the socket.
> Again, the progress interface, too, is thought to send events to local
processes. If sopmeone wnats to send over the network, he should
implement himself. I am just opne to collect these implementation, if
they are reported back to the project. An example is in the
mongoose_interface.c, that listens to the progress interface (locally)
and sends events back to the connected browser via a WS connection.
I just want to make IPC endpoints user-friendly, flexible and allow everyone to implement their own send_update and event monitoring.
Best regards,