-
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
[RFC] ng_ipv6_addr: add (optional) string conversion functions #2546
[RFC] ng_ipv6_addr: add (optional) string conversion functions #2546
Conversation
Hi, a quick word of warning: I'm currently on vacation with only a tablet (gasp!), so I can only read the code, but not try anything out... |
Well we have travis :D |
(otherwise feel free to reassign ;-)) |
/** | ||
* @brief Maximum length of an IPv6 address as string. | ||
*/ | ||
/* take also encapsulated IPv4 address in account */ |
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.
Into account
In the Interest of speeding things up I'll reassign... |
Reassigning to me to me to speed things up? You daredevil! |
ebae2ed
to
f1c63ea
Compare
Rebased to current master. |
ACK |
f1c63ea
to
b63d610
Compare
Rebased and fixed a minor doc error, travis was complaining about ;-) |
All green |
…g_functions [RFC] ng_ipv6_addr: add (optional) string conversion functions
This adds the functions
ng_ipv6_addr_to_str()
andng_ipv6_addr_from_str()
(basicallyinet_pton6()
andinet_ntop6()
specialized for our types [I only made small rewrites to them]) to theng_ipv6_addr
module. They only are included into the binary if they are used (since they are implemented in their own .c-files), and only are intended for debug output and the shell.The rational of including them to
ng_ipv6_addr
is that it can be used forDEBUG()
output without including thenet_help
module. Additionally, I was able to simplify the implementation was a little bit due to the benefits ofng_ipv6_addr_t
(as opposed to just usingchar *
) andnetwork_uint32_t
(for IPv4) addresses.I also removed one
snprintf()
call (for just creating a hexadecimal number) and replaced it with manual formation. This makes this implementation much better suited for embedded devices.