sys: net: sock: add uint32_t ipv4 address to address union#6114
Merged
miri64 merged 1 commit intoRIOT-OS:masterfrom Nov 13, 2016
Merged
sys: net: sock: add uint32_t ipv4 address to address union#6114miri64 merged 1 commit intoRIOT-OS:masterfrom
miri64 merged 1 commit intoRIOT-OS:masterfrom
Conversation
miri64
requested changes
Nov 13, 2016
sys/include/net/sock.h
Outdated
| #endif | ||
| uint8_t ipv4[4]; /**< IPv4 address mode */ | ||
| uint8_t ipv4[4]; /**< IPv4 address mode */ | ||
| uint32_t ipv4_u32[4]; /**< IPv4 address in network byte order */ |
Member
There was a problem hiding this comment.
can I haz emphasis on network byte order?
Contributor
Author
There was a problem hiding this comment.
Why? It's not emphasized for the port either.
sys/include/net/sock.h
Outdated
| #endif | ||
| uint8_t ipv4[4]; /**< IPv4 address mode */ | ||
| uint8_t ipv4[4]; /**< IPv4 address mode */ | ||
| uint32_t ipv4_u32[4]; /**< IPv4 address in network byte order */ |
miri64
approved these changes
Nov 13, 2016
Member
|
Please squash. |
eef3d11 to
6324cf9
Compare
cgundogan
reviewed
Nov 13, 2016
sys/include/net/sock.h
Outdated
| #endif | ||
| uint8_t ipv4[4]; /**< IPv4 address mode */ | ||
| uint8_t ipv4[4]; /**< IPv4 address mode */ | ||
| uint32_t ipv4_u32[4]; /**< IPv4 address *in network byte order* */ |
Member
There was a problem hiding this comment.
just wondering why [4]? Didn't you mean uint32_t ipv4_u32;?
Member
There was a problem hiding this comment.
Oops, sorry for overlooking that
miri64
previously requested changes
Nov 13, 2016
sys/include/net/sock.h
Outdated
| #endif | ||
| uint8_t ipv4[4]; /**< IPv4 address mode */ | ||
| uint8_t ipv4[4]; /**< IPv4 address mode */ | ||
| uint32_t ipv4_u32[4]; /**< IPv4 address *in network byte order* */ |
Member
There was a problem hiding this comment.
Oops, sorry for overlooking that
6324cf9 to
2b1cd62
Compare
Contributor
Author
|
Yeah, only one uint32_t... fixed & immediately squashed. |
Kijewski
reviewed
Nov 13, 2016
| #endif | ||
| uint8_t ipv4[4]; /**< IPv4 address mode */ | ||
| uint8_t ipv4[4]; /**< IPv4 address mode */ | ||
| uint32_t ipv4_u32; /**< IPv4 address *in network byte order* */ |
Contributor
There was a problem hiding this comment.
Why not network_uint32_t?
Contributor
Author
There was a problem hiding this comment.
I'm using sock on Linux [1], which doesn't have byteorder.h.
[1] https://github.com/kaspar030/sock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#5945 changed the ipv4 address type to an array (as it is for ipv6).
But "What we gain by introducing an uint32_t version of the IPv4 address is the ability to do 32bit register compares due to 4b alignment, which, apart from being easier to code (and read), is probably way more efficient than having to do memcpys and memcmps."