主机顺序字节中的 ether_addr_octet
我想将 struct ether_addr (ether_addr_octet) 转换为整数主机字节顺序表示。有什么想法吗?
ntohl(eth->ether_addr_octet)
不起作用,因为 ether_addr_octet
是一个字符数组。
问候
I would like convert struct ether_addr (ether_addr_octet) to integer host byte order representation. Any ideas?
ntohl(eth->ether_addr_octet)
not working, because ether_addr_octet
is a char array.
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定这的语义是什么。
以太币为 48 位,最大 ntoh* 为 32 位值。
我想你可以创建一个 64 位值解析 char 数组,并调用 ntohl() 两次......
I'm not sure what the semantics of this are going to be.
The ether is 48bit, and the largest ntoh* is for 32bit values.
I suppose you can create a 64bit value parsing the char array, and calling ntohl() twice...
你可以将它转换为 char 然后你可以做你想做的其他事情......
我希望它有帮助
You can convert it to char and then you can do something else you want...
I hope it helps