Conversation
|
Also includes the HOWTOs requested by @emmanuelsearch. |
aabadie
left a comment
There was a problem hiding this comment.
I had a "brief" look at this one and put some comments (typo, rephrasing). Good job !
sys/include/net/sock.h
Outdated
| * they serve as a common API that connects application- and network stack code. | ||
| * This module provides a set of functions to establish connections or send and | ||
| * receive datagrams using different types of protocols. Together, they serve as | ||
| * an API allows an application or library to connect to a network. |
sys/include/net/sock.h
Outdated
| * Implementors Notes | ||
| * ================== | ||
| * ### Type definition | ||
| * For simplicity and modularity this API doesn't put any restriction of the |
sys/include/net/sock.h
Outdated
| * ### Type definition | ||
| * For simplicity and modularity this API doesn't put any restriction of the | ||
| * actual implementation of the type. For example, one implementation might | ||
| * choose to have all `sock` types have a common base class or use the raw IP |
sys/include/net/sock/ip.h
Outdated
| * res = sock_ip_send(NULL, data, data_len, PROTNUM, &remote); | ||
| * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| * | ||
| * With `data` being the data send, `data_len` the length of `data`, `PROTNUM` |
sys/include/net/sock/ip.h
Outdated
| * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| * | ||
| * With `data` being the data send, `data_len` the length of `data`, `PROTNUM` | ||
| * the next header number for the send packet and `remote` the remote end point |
sys/include/net/sock/ip.h
Outdated
| * } | ||
| * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| * | ||
| * We then create a remote end point for the link-local all nodes multicast |
There was a problem hiding this comment.
not sure I correctly understand this.
There was a problem hiding this comment.
If you tell me how you understand it I maybe can clear that up. As is the sentence seems straight forward to me... :-/
There was a problem hiding this comment.
if I understand well (I hope I do ;) ), I would rephrase like this :
create a remote end point with the link-local multicast address of all nodes and send
There was a problem hiding this comment.
Not completely. It creates a remote end point with the link-local all-nodes multicast address (which is a defined address (ff02::1) and is called as such)
There was a problem hiding this comment.
yes, thanks for the clarification :)
sys/include/net/sock/ip.h
Outdated
| * (remote->netif != SOCK_ADDR_ANY_NETIF))` if neither is `NULL`). | ||
| * @return -ENOMEM, if the stack can't provide enough resources for `sock` to | ||
| * be created. | ||
| * @return -ENOMEM, if not enough resources for `sock` to be created can be |
There was a problem hiding this comment.
maybe ... not enough resources can be provided for sock to be created ?
sys/include/net/sock/udp.h
Outdated
| * uint8_t buf[128]; | ||
| * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| * | ||
| * To be able to listen for incoming packets we want to bind the sock so we need |
There was a problem hiding this comment.
we want to bind the sock so we need, etc
=> we bind the sock by setting a local end point with a port ?
sys/include/net/sock/udp.h
Outdated
| * } | ||
| * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| * | ||
| * We then wait indefinitely for an incoming message in `buf` from `remote`. |
There was a problem hiding this comment.
I think using 'we' when explaining the behavior of the code should be replaced with something more non personal.
Example:
The program then wait indefinitely for an incoming message...
sys/include/net/sock/udp.h
Outdated
| * With `data` being the data send, `data_len` the length of `data` and `remote` | ||
| * the remote end point the packet is to be sent. | ||
| * | ||
| * To see some other utilization we look at a more complex example in form of |
|
Applied requested changes. |
| * choose to have all sock types have a common base class or use the raw IP | ||
| * sock type to send e.g. UDP packets, while others will keep them | ||
| * completely separate from each other. | ||
| * Note that there might be no relation between the different `sock` types. |
There was a problem hiding this comment.
Do you think users might try that?
There was a problem hiding this comment.
People tried it with conn so why wouldn't they try it with sock?
sys/include/net/sock.h
Outdated
| * The actual code very much depends on the used `sock` type. Please refer to | ||
| * their documentation for specific examples. | ||
| * | ||
| * Implementors Notes |
There was a problem hiding this comment.
Implementors -> implementor?
There was a problem hiding this comment.
This is a caption... Why should I remove the capitalization?
just remove the plural s at the end of Implementors, capital I is fine. |
Someone tried to re-cast the objects into each other? |
oops I actually overlooked that. |
Yes some testers get funny ideas when you do not explicitly state that a behavior is forbidden ;-). And actually I can understand that when you come from the socket world. Also: casting |
|
Mind you, they didn't cast a |
|
I just tried testing this and I get a missing "sock_types.h' from udp.h:198, I have gnrc_sock_udp and gnrc_ipv6_default included. I also cannot find sock_types.h anywhere in the codebase. Any tips? |
|
My humblest apologies, I did not see #5772. |
|
Ping? |
aabadie
left a comment
There was a problem hiding this comment.
This looks like a good documentation with good examples.
|
@aabadie was that an ACK? |
|
@miri64, Murdock is asking for squashing. Then I'll give an ACK. |
|
Squashed. |
|
Murdock is happy 😀 |
|
ACK and Go ! |
Fixes the comments in #5758.