-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C] Add protobuf implementation to C Command Samples #57
Conversation
…response protobuf. Add mock unlock function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with the following observations:
- the door lock example, as shown, is dangerous and has multiple (physical) security consequences (e.g. opening the door a few hours after the request was made is not a good thing).
- My preference for generated code is to have it generated pre-build: that way it can't ever run out of sync with the checked-in definitions.
Furthermore, the generated code is not really meant to be human-readable or reviewed, not copyrighted properly, etc.
(Other nitpicks - safe to ignore)
mqttclients/c/mosquitto_client_extensions/protobuf_handlers/google/protobuf/timestamp.pb-c.c
Outdated
Show resolved
Hide resolved
This is a sample to show the RPC pattern in action, it's not intended to be the ultimate reference to implement a safe unlock mechanism for production grade vehicle manufacturers. It's not only about the time sync, also about AuthN/AuthZ etc.. We inherit the scenario description from EG, and I believe it's a good sample, easy to understand and with a clear purpose. Do you have a better suggestion?
AFAIK we are not using persistent sessions in this sample, so the client expects the server to be online when the command is invoked. In which case the command will be executed at a later time? do you have a repro? |
Yes - I've left suggestions in throughout my comments about these issues. We should at least clearly explain the constraints / dangers.
That would indeed solve the issue when the RPC server is offline but not the case when the MQTT broker is either busy, disconnected from the network or shut down for any reasons (crash, maintenance, etc).
There are (at least) two cases: broker failure and server failure: Broker failure
Note that if messageExpiry is configured, depending on broker timer implementation, only killing the broker process would result in the message being transmitted later. Server failureIn this case, the server receives the message but it either:
In case 2, depending on time to recover, the server may connect at a later time, receiving the (delayed) unack-ed QoS1 request. |
@CIPop @rido-min, I think a lot of the concerns brought up here apply to all of the command samples and not just the C sample. I'll open up a task on our board to discuss and decide what pattern to align on for all of the languages, to be addressed in a future PR. For now, the C sample has parity with the other languages in regards to security, and I've added a disclaimer in the readme |
Agree, however we have not been able to find a way to call the proto generator from CMake, and a result I logged #63 As a workaround, I think it might be ok to commit the generated files. /c @vaavva |
Purpose
Checklist
main
branch.main
branch prior to submission and re-merged as needed after I took any feedback.Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test
What to Check
Verify that the following are valid
Other Information