CANOE IP Address Byte Ordering-IP地址字节排序

OS:CAPL里IP和MAC赋值都可用以下这种方式直接写。

The specification of IPv4 addresses as DWORD corresponds to a Little Endian representation.
作为DWORD的IPv4地址规范对应于Little Endian表示。

You must represent an address a.b.c.d as number 0x0d0c0b0a.
您必须将地址a.b.c.d表示为数字0x0d0c0b0a

Example

The number representation of 192.168.2.1 corresponds to 0x0102a8c0.
192.168.2.1的数字表示形式对应于0x0102a8c0。

 

Note

If no quantity is specified in the formatting in CAPL function Write, the leading zero is ignored resulting in 0x201A8C0. Take this into account when back-calculating to the hex character count in order to avoid false pairing.

如果在CAPL Write函数的格式化中没有指定数量,则忽略前导零,结果为0x201A8C0。在反向计算十六进制字符计数时要考虑到这一点,以避免错误配对。

 

The formatting for an 8-digit hexadecimal representation in Write corresponds to: %.8x or 0x%.8x.

Write中8位十六进制表示的格式对应于:%.8x或0x%.8x.

 

Alternatively you can use CAPL function SwapDWord to enable writing an IPv4 address in readable form.
或者,您可以使用CAPL函数SwapDWord来启用以可读形式写入IPv4地址。

dword addr = SwapDWord(0xc0a80102);

Byte arrays that are filled in readable order are used for IPv6 addresses.
以可读顺序填充的字节数组用于IPv6地址。

Example

Representation of the IPv6 address 2001:DB8:85A3:8D3:1319:8A2E:370:7344 in the form of a byte array:
IPv6地址2001:DB8:85A3:8D3:1319:8A2E:370:7344以字节数组的形式表示:

{ 0x20, 0x01, 0x0d, 0xb8, 0x85, 0xa3, 0x08, 0xd3, 0x13, 0x19, 0x8a, 0x2e, 0x03, 0x70, 0x73, 0x44 }

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值