博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
lwip IP address handling 关于 IP 地址的 操作 API接口
阅读量:7220 次
发布时间:2019-06-29

本文共 1117 字,大约阅读时间需要 3 分钟。

 

 

/*** @file* IP address API (common IPv4 and IPv6)*/

 

1、u32_t ipaddr_addr(const char *cp);

  把一个 字符串的 IP 地址转换成  ip4_addr_t 类型的IP。

1 /** 2  * Ascii internet address interpretation routine. 3  * The value returned is in network order. 4  * 5  * @param cp IP address in ascii representation (e.g. "127.0.0.1") 6  * @return ip address in network order 7  */ 8 u32_t 9 ipaddr_addr(const char *cp)10 {11   ip4_addr_t val;12 13   if (ip4addr_aton(cp, &val)) {14     return ip4_addr_get_u32(&val);15   }16   return (IPADDR_NONE);17 }

2、char *ip4addr_ntoa(const ip4_addr_t *addr);

  把一个 ip4_addr_t 类型 的IP地址 转换 成 字符串形式!

1 /** 2  * Convert numeric IP address into decimal dotted ASCII representation. 3  * returns ptr to static buffer; not reentrant! 4  * 5  * @param addr ip address in network order to convert 6  * @return pointer to a global static (!) buffer that holds the ASCII 7  *         representation of addr 8  */ 9 char*10 ip4addr_ntoa(const ip4_addr_t *addr)11 {12   static char str[IP4ADDR_STRLEN_MAX];13   return ip4addr_ntoa_r(addr, str, IP4ADDR_STRLEN_MAX);14 }

 

转载于:https://www.cnblogs.com/suozhang/p/8435020.html

你可能感兴趣的文章
Base64转码和解码的帮助类
查看>>
侃侃正向代理和反向代理
查看>>
PLSQL连接oracel数据库_用户无法登陆_oci.dll_配置问题
查看>>
李洪强iOS经典面试题37-解释垃圾回收的原理
查看>>
多校第二场 1004 hdu 5303 Delicious Apples(背包+贪心)
查看>>
Executor , ExecutorService 和 Executors
查看>>
关于图数据库查询语言:Cypher
查看>>
Android中m、mm、mmm、mma、mmma的区别
查看>>
知道各个层使用的是哪个数据交换设备
查看>>
MySQL索引类型总结和使用技巧以及注意事项
查看>>
iOS:在cell中使用倒计时的最佳方法
查看>>
深入浅出空间索引:为什么需要空间索引
查看>>
EF 数据版本号,处理具体使用方法 RowVersion / Timestamp 使用方法。进行自动处理并发修改...
查看>>
centos6.5关闭ipv6
查看>>
springboot整合mybatis将sql打印到日志
查看>>
自定义视图
查看>>
dedecms后台管理员密码重置方法
查看>>
JS函数节流和函数防抖问题分析
查看>>
116 - Unidirectional TSP(DP)
查看>>
内存泄露问题
查看>>