net: added CoAP RD client for simple node registration#7406
net: added CoAP RD client for simple node registration#7406bergzand merged 4 commits intoRIOT-OS:masterfrom
Conversation
0026499 to
b082539
Compare
|
just a quick one on first sight: I find the naming ( |
|
but then the name gets too long... Also, I just saw, the official name is CoRE Resource Directory, so the natural name would be |
|
mhm, I thought RD is intrinsically connected to/with CoAP - but as I just read, its not [;] CoAP is just one way to access resources. So never mind, leave naming as is. |
|
awesome. Would you be inclined to maybe have a look at the underlying PR by any chance?! |
| (void)arg; | ||
|
|
||
| /* wait some seconds to give the address configuration some time to settle */ | ||
| xtimer_sleep(3); |
There was a problem hiding this comment.
Isn't more useful to have a define for this delay? Are there situations where 3 seconds is insufficient?
There was a problem hiding this comment.
Probably yes. Will add this.
8fe48f2 to
da7ca54
Compare
|
startup delay is now configurable. Still waiting for kaspar030/sock#17, though. |
4eb2070 to
ea2af21
Compare
|
kaspar030/sock#17 was merged, so rebased and updated the nanocoap pkg |
|
Did some additional enhancements and fixes:
|
|
Is there any advantage to having the separate gcoap RD examples instead of integrating them in the gcoap example? As a test, I think it is useful to have a minimal CoAP RD test, but I think it would be better to have the example integrated in the gcoap example. |
|
Yes, so far it's separation of concerns... The example of introduced by this PR is to demonstrate the simplified registration as most likely used by very minimal setups, and this is IMHO best demonstrated by a minimal demo application. I would then rather integrate the full RD client as part of the gcoap example... |
bergzand
left a comment
There was a problem hiding this comment.
I've added a number of remarks based on a scan through the code. Example looks and works good.
|
|
||
| ifneq (,$(filter rdcli_common,$(USEMODULE))) | ||
| USEMODULE += luid | ||
| USEMODULE += fmt |
There was a problem hiding this comment.
wouldn't it be better if the rdcli_common module depends on gcoap? It is the first module in this module dependency string that requires coap.
examples/rdcli_simple/Makefile
Outdated
| USEMODULE += shell_commands | ||
| USEMODULE += ps | ||
|
|
||
| FEATURES_REQUIRED += periph_hwrng |
There was a problem hiding this comment.
I'm don't see why a hwrng required for this example.
There was a problem hiding this comment.
ups, leftover from a previous example, will drop
examples/rdcli_simple/main.c
Outdated
| * @{ | ||
| * | ||
| * @file | ||
| * @brief CoRE RD simple registration test application |
There was a problem hiding this comment.
Only a minor remark, but maybe it is possible to add here that this is a CoAP CoRE RD example, as this example is a CoAP specific example of the CoRE RD rfc.
| return res; | ||
| } | ||
| /* finish, we don't have any payload */ | ||
| ssize_t len = gcoap_finish(&pkt, 0, COAP_FORMAT_TEXT); |
There was a problem hiding this comment.
Looking at the rfc draft section 5.3.2, this should be COAP_FORMAT_LINK.
91fead5 to
6b4af09
Compare
|
@bergzand addressed your comments, thanks for the review! |
|
please rebase, also |
|
reabsed and added the RD server address configuration to the example's Makefile. @bergzand can I squash? |
|
ACK
Yes, I'd say this is ready to get merged unless somebody else wants to start nitpicking over it at this point :) |
kaspar030
left a comment
There was a problem hiding this comment.
minors, feel free to directly squash
| #define PRIO (THREAD_PRIORITY_MAIN - 1) | ||
| #define TNAME "rdcli_simple" | ||
|
|
||
| char stack[STACKSIZE]; |
| } | ||
|
|
||
| luid_get(luid, sizeof(luid)); | ||
| for (unsigned i = 0; i < sizeof(luid); i++) { |
There was a problem hiding this comment.
there's a fmt_bytes_hex now
|
@haukepetersen, @bergzand: What did you use as an RD server for development/testing? |
Never mind. I see Hauke's comment in #7428 on @pekkanikander's JavaScript-based server. |
|
I haven't actually tested the implementation but have a couple of comments. Overall, I think this work is a nice addition. A resource directory seems like a worthwhile service to reduce the burden on a constrained network. I understand the need for flexibility at this point in the implementation. Let the user decide whether to run the registration themselves or in an external thread. However, registration management seems like an infrastructure task rather than something an application developer should care about in detail. gcoap itself seems well suited to this work. It runs in its own thread and is designed as a kind of messaging hub. In the future, it can provide resource registration as an optional service. gcoap already has the gcoap_register_listener() function to trigger registration. Then it can use its thread message handler loop to react to a timer to re-register based on lifetime. Maybe this work could be the beginning of a plug-in mechanism for optional CoAP features. Just to be clear, I'm envisioning gcoap-based registration as future work, and not blocking this PR. :-) |
96703af to
a0373a5
Compare
|
rebased and squashed. @kaspar030 fixed your remarks and merged them right in @kb2ma Thanks for your thoughts! I think what you sketch makes a lot of sense, and reusing the gcoap's thread for this kind of tasks seems like a very valid approach. Being able to integrate this RD implementation into a 'larger' scope is exactly the reason, why I factored out the thread-stuff into an optional sub-module. Once this PR is merged, I will bring the 'full' RD client PR (#7428) back in a good shape. I would think that that PR is suited well to filter out the exact requirements on gcoap for running additionally 'CoAP based services'. So lets see were we can take that. |
|
ACK from my side. @bergzand all yours! |
a0373a5 to
fb4b622
Compare
|
fixed header guards and sqqashed. |
|
@haukepetersen Could you please add the failed boards from Murdock to the examples |
|
done |
|
Travis seems to have a point here, do not merge yet! |
|
nope, false alarm, defining a custom value for So until somebody can explain why |
|
@bergzand what do you say, should we merge? |
|
Murdock is not complaining about it, so I blame the older cppcheck from travis. |
based on #7402also needs
nanocoap: add Uri-Query handling capabilities kaspar030/sock#16nanocoap: fixed setting of option length kaspar030/sock#17This PR provides a CoAP resource directory (RD) client implementation, that uses the simplified client registration as described in section 5.3.2 in draft-ietf-core-resource-directory-11. The client implementation can be used in two different ways:
USEMODULE += rdcli_simple_standalone): in this mode the module is running in its own thread, which is started automatically on system startup viaauto-init. In this mode, nothing has to be done by the user.USEMODULE += rdcli_simple): in this mode, the user has to take care of callingrdcli_simple_register()for initial registration and then periodically or on certain events to refresh the registration and to reset the lifetime counter in the resource directory.The
rdcli_simpleclient is statically configured through thesys/net/include/rdcli_config.hheader.