IPV6标头的C ++结构.. [英] C++ structure for IPV6 Header ..

查看:53
本文介绍了IPV6标头的C ++结构..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



任何人都可以给我IPV6标头的C ++结构..
字段是:
版本:4位
流量等级:8位
流标签:20位
PayLoadLength:16位
下一个标题:8位
跳数限制:8位
源IPv6地址:128位
目的IPv6地址:128位


问候
Lakkan

Hi,

Could any one please give me C++ structure for IPV6 Header ..
Fields are :
Version : 4 bits
Traffic Class : 8 Bits
Flow Label : 20 Bits
PayLoadLength : 16 Bits
Next Header : 8 Bits
Hop Limit : 8 Bits
Source IPv6 Address : 128 Bits
Destination IPv6 Address : 128 Bits


Regards
Lakkan

推荐答案

请参阅此处 [^ ],以获取有关在C ++ struct s中使用位字段的示例代码.
See here[^] for sample code on using bit fields in C++ structs.


问Google:ipv6.c-IP标头信息 [
It never hurts to ask Google: ipv6.c - IP header information[^]


那是什么,难道是您的麻烦吗?
如果发布的内容是您的确切要求(还没有为此定义的结构,是吗?),那么编码就很简单了:
What is, exactly your trouble?
If the posted ones are your exact requirements (there isn''t an already defined struct for this, is there?), then the coding is just straightforward:
struct IPV6header
{
  u_int version: 4;
  u_int traffic_class: 8;
  // ... and so on ...
  u_char source_addr[16];
  u_char dest_addr[16];
};


这篇关于IPV6标头的C ++结构..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆