-
Notifications
You must be signed in to change notification settings - Fork 190
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
Conversions between HostAddress(6) and endianness-independent tuples #210
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. |
@@ -1021,7 +1027,10 @@ aNY_PORT = 0 | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.