-
Notifications
You must be signed in to change notification settings - Fork 2k
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
gnrc_netif: provide helper functions for NETOPT_IPV6_(ADDR|GROUP)
#8253
Conversation
fbef268
to
7105bf0
Compare
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.
Only some remarks on the comments, looks good otherwise.
* @pre `addrs != NULL` | ||
* @pre `max_len >= sizeof(ipv6_addr_t)` | ||
* | ||
* @param[in] netif The interface. May not be `NULL`. |
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.
Judging from the assertions, shouldn't this be "Must not be NULL
?
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.
Mhhh... In the past I always used "May"... Maybe I'm wrong, but AFAIK "must not" and "may not" are synonymous (meaning "you can not do that"; at least that is what my English-German dictionary is telling me), while their opposite "may" (it is optional to do that) and "must" (it is required to do that) are not. Maybe "may not" is a little bit weaker in the ears of a native speaker, but for consistency I would prefer to keep it this way or to change my older wordings first.
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.
Just realized however, that I used "Must not" here as well ^^"
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.
Grammatically speaking I'd say you're completely correct here (not going to burn my fingers on English grammar). The reason I stumbled over this is because I'm interpreting these musts and mays as rfc2119 :)
I think together with the documented preconditions "may" is also clear enough.
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.
Mhhh, but RFC2119 only documents "Must", "Must not" and "May"... or do you mean because "may not" it isn't documented the precondition is unclear?
Sidenote: I'm not aware if the terminology of our doc MUST be according to RFC 2119 ;-).
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.
Mhhh, but RFC2119 only documents "Must", "Must not" and "May"... or do you mean because "may not" it isn't documented the precondition is unclear?
To be honest, I never noticed that "May not" was missing. No, I rather think that with the documented @pre
s, it is quite clear that the netif
argument is mandatory.
Sidenote: I'm not aware if the terminology of our doc MUST be according to RFC 2119 ;-).
Never said it should be according to that, only that I'm interpreting these things by default as RFC 2119. Whether that is correct is a whole different discussion. ;-)
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.
True, that's why I repeat myself:
[…] for consistency I would prefer to keep it this way or to change my older wordings first.
(I prefer to do it in a separate PR afterwards)
* @pre `addr != NULL` | ||
* @pre `(pfx_len > 0) && (pfx_len <= 128)` | ||
* | ||
* @param[in] netif The interface. May not be `NULL`. |
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.
Same as above
* @pre `netif != NULL` | ||
* @pre `addr != NULL` | ||
* | ||
* @param[in] netif The interface. May not be `NULL`. |
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.
And another may that should be a must
* @pre `addr != NULL` | ||
* | ||
* @param[in] netif The interface. May not be `NULL`. | ||
* @param[in] addr The address to remove from @p netif. May not be `NULL`. |
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.
Same as above.
* @pre `groups != NULL` | ||
* @pre `max_len >= sizeof(ipv6_addr_t)` | ||
* | ||
* @param[in] netif The interface. May not be `NULL`. |
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.
And another
* @pre `group != NULL` | ||
* | ||
* @param[in] netif The interface. | ||
* @param[in] group The address of the multicast group to join on @p netif. |
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.
Maybe add comments here to clarify the restrictions as done with the ipv6_groups_get 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.
(done in the line below)
* @pre `group != NULL` | ||
* | ||
* @param[in] netif The interface. | ||
* @param[in] group The address of the multicast group to leave on @p netif. |
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.
And also here the clarifications maybe
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.
(done in the line below)
Addressed comments (used "may not" were I used "must not" before; if this is blocking, I can change all to "must not"…). |
If there is no space left on the interface, a user should be notified about that when using `gnrc_netapi_set()`
4075cef
to
b6da6a9
Compare
Rebased to current master. |
ACK, please squash |
b6da6a9
to
9681e5d
Compare
Squashed |
Since especially the setter for `NETOPT_IPV6_ADDR` and the getter for both `NETOPT_IPV6_ADDR` and `NETOPT_IPV6_GROUP` isn't that obvious, I decided to provided a helper function for those `gnrc_netapi_get/_set` operations.
9681e5d
to
16374d0
Compare
Fixed Murdock issues and squashed immediately ( |
Contribution description
Since especially the setter for
NETOPT_IPV6_ADDR
and the getter forboth
NETOPT_IPV6_ADDR
andNETOPT_IPV6_GROUP
isn't that obvious, Idecided to provided a helper function for those
gnrc_netapi_get/_set
operations.
Issues/PRs references
Depends on
#8252(merged).