Conversions between HostAddress(6) and endianness-independent tuples#210
Conversions between HostAddress(6) and endianness-independent tuples#210kazu-yamamoto merged 7 commits intohaskell:masterfrom ppetr:conversions
Conversation
|
I don't have a strong opinion on the introduction of these functions, but I would like to see tests provided for this code, either in the suite or in doctest. @kazu-yamamoto Might have a stronger opinion. |
|
Good point, I'll add proper tests and update the PR. Dne pá 8. 7. 2016 20:36 uživatel Evan Borden [email protected]
|
|
I don't have strong opinions and can accept this pull request. Let's merge when ready. |
|
There's really no case for exporting the C functions |
|
@vincenthz Thank you for the information! So, I think what we should do is documentation to suggest to use these functions if necessary. |
|
@vincenthz This is not entirely correct. Functions Therefore I still believe that exporting (Also the exports is only a part of this PR. Regardless of them, the other functions for manipulating IP addresses as tuples of bytes/words are still quite useful, as they provide access to addresses as they're defined in the specification, rather than how they're represented in memory as certain Words.) |
|
I added basic tests for the new functions. Comments welcome. It'd be slightly cleaner to add a QuickCheck test, but the difference isn't that big and I wasn't sure if you'd be OK with adding a new dependency. |
| iNADDR_ANY :: HostAddress | ||
| iNADDR_ANY = htonl (#const INADDR_ANY) | ||
|
|
||
| -- | Converts the from host byte order to network byte order. |
There was a problem hiding this comment.
It might be helpful to enumerate the possible id behaviour of these functions.
|
I have merged this pull request. Thank you for your contribution. |
.. to allows direct, more convenient manipulation with low-level IP addresses.