convert ip address string to unsigned int
来源:互联网 发布:南京行知实验中学官网 编辑:程序博客网 时间:2024/05/18 03:28
sscanf(temp,"srcip=%d.%d.%d.%d,dstip=%d.%d.%d.%d", &c1, &c2, &c3, &c4, &d1, &d2, &d3, &d4);
printk(KERN_DEBUG "%d.%d.%d.%d,%d.%d.%d.%d\n", c1, c2, c3, c4, d1, d2, d3, d4);
if (((c1 + c2 + c3 + c4) > 255 * 4) ||
((d1 + d2 + d3 + d4) > 255 * 4)) {
pr_err("Input ip address is wrong!\n");
return count;
}
lsrc_ip = c4 + (c3 << 8) +
(c2 << 16) + (c1 << 24);
ldst_ip = d4 + (d3 << 8) +
(d2 << 16) + (d1 << 24);
printk(KERN_DEBUG "src_ip:0x%08x, dst_ip:0x%08x\n", lsrc_ip, ldst_ip);
printk(KERN_DEBUG "%d.%d.%d.%d,%d.%d.%d.%d\n", c1, c2, c3, c4, d1, d2, d3, d4);
if (((c1 + c2 + c3 + c4) > 255 * 4) ||
((d1 + d2 + d3 + d4) > 255 * 4)) {
pr_err("Input ip address is wrong!\n");
return count;
}
lsrc_ip = c4 + (c3 << 8) +
(c2 << 16) + (c1 << 24);
ldst_ip = d4 + (d3 << 8) +
(d2 << 16) + (d1 << 24);
printk(KERN_DEBUG "src_ip:0x%08x, dst_ip:0x%08x\n", lsrc_ip, ldst_ip);
0 0
- convert ip address string to unsigned int
- convert unsigned int to ip string
- C++ convert int to string
- Convert string type to int
- How convert DWORD to Ip address?
- long[] or int[] convert to string[] method
- Java – Convert String to int
- Convert int/long to hex string.
- Convert string to int in C++
- Java – Convert IP address to Decimal Number
- Convert int? to int
- 字符串转换为数字:String:convert a string to int
- c++ int convert to std::string 转换成std::string
- How to convert from int to string in objective c
- How to convert from int to string in objective c
- Easiest way to convert int to string in C++
- String convert int , and int convert String
- convert unsigned long to char*
- sort/qsort对字符串排序
- 解决Failed to create BuildConfig class问题
- index_06_01 中间
- JS-绑定事件两种方式
- 22.allegro中PCB打印设置
- convert ip address string to unsigned int
- ORACLE查询管理器建表引号问题呢
- Linux系统日志管理(redhat)
- 手机开门——门禁系统升级到移动互联网时代
- Gson解析Json二
- convert unsigned int to ip string
- list the recent svn log
- Linux信号量
- java实现浮点数人民币的汉字读法,简洁版