-
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
ng_net: header building facilities #2575
Conversation
@@ -134,6 +136,46 @@ static inline void ng_netif_hdr_set_dst_addr(ng_netif_hdr_t *hdr, uint8_t *addr, | |||
memcpy(((uint8_t *)(hdr + 1)) + hdr->src_l2addr_len, addr, addr_len); | |||
} | |||
|
|||
/** | |||
* @brief Builds a generic network interface header for sending and |
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.
s/network interface/network layer/
? But what does "generic" mean in this context?
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.
No this is correct. This module (ng_netif_hdr
) defines the "generic network interface header". This name was introduced after @OlegHahm was not happy with the name "generic link layer header" ;-)
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.
I'm confused. I thought this was meant to implement (in a IMO weird way) IPv6 upper layer checksum calculation. Why do one need to build a generic network interface header?
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.
No that's in #2553. This just offers netif_hdr_init()
and pktbuf_add()
in one go.
Sorry, I guess I asked this a 100 times before, but I'm confused again why an upper layer wants to build a lower layer's header? |
Use-case: IPv6 wants to send packet.
|
Why not just the address? Because in the rest of the model we use the header for exactly the same reason as I sketched out previously: The upper-layer might want to set additional information (hop-limit, traffic class, etc. you name it). |
But this would require an additional function, right? Why can I do this not just with a set_opt command? |
Because this requires additional context switches. And no it would not need additional functions. Once you've build the header, you know the type of the header anyways, so if you need to, you can just change the fields after the creation. This functions are primarily for service functions for layers that DON'T need to know the build-up of a lower-layer header. |
6881f2e
to
d6b7e38
Compare
Rebased to current master |
@@ -126,6 +127,26 @@ int ng_netreg_num(ng_nettype_t type, uint32_t demux_ctx); | |||
*/ | |||
ng_netreg_entry_t *ng_netreg_getnext(ng_netreg_entry_t *entry); | |||
|
|||
/** | |||
* @brief Builds a header for sending for a protocol in the registry and |
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.
nitpick: I find this sentence a bit hard to parse. Maybe the “for sending” could be left out?
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.
No, since a receiving packet would store the payload differently.
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.
Oh. Then maybe we could split it up into two sentences or something?
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.
"Builds a header for sending and adds it to the packet buffer" would also work, I think. That the protocol is defined through type
is apparent through the type parameter I think.
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
Simplified doc a little. |
3dad5a1
to
c547d93
Compare
Needed to add #2706 as a depenency since Travis is taking forever -.- |
c547d93
to
9674697
Compare
Awww come on Travis! |
The last successful Travis run is two and a half days old. I think we've killed that poor fellow. |
I'll sponsor a dedicated server if anyone fancies setting up Janky (or Jenkins) on it! Travis is a nighmare |
@saurabh984 we're (or rather @phiros is) working on a solution. We had Jenkins in the past. This was also no solution, since someone(TM) needs to manage that machine and nobody got time for that. |
It's probably gonna be build bot. |
But thanks for the offer |
Fixed thingie |
Moved author tag. |
Apart from the squash and PR dependency warning and an aborted (and now restarted) build in the msp430 group travis seems to be fine. Squash? |
Yes please! |
44e0eb1
to
5ae0325
Compare
Done |
👍 Okay... Let's do this! ACK & Go. |
Correction: ACK, wait for Travis & go. I'll keep this tab open. |
5ae0325
to
1ea70be
Compare
Ahhh sorry… I needed to change something for constistency: |
:D good catch! Tab is still open, will merge as soon as Travis is happy. |
I would like to put this topic on the list for the next NSTF meeting. I'm not nacking this, but am still not convinced of this approach. |
@OlegHahm can you point me to the problem with this approach? |
ng_net: header building facilities
No, I just still don't like upper layers building lower layers' headers. But it's so far more like a gut feeling. |
This was taken out of #2553
The idea is that an upper-layer can build a header for the layer it wants to send data over without knowledge about the actual structure of the header. I also added a convinience function of similar format to
ng_netif_hdr
.Depends on #2706(merged)