这是那个结构体,提到的那个字符串数组就是这个payload
struct pbuf {
/** next pbuf in singly linked pbuf chain */
struct pbuf *next;
/** pointer to the actual data in the buffer */
void *payload;//指向缓存数组
/**
* total length of this buffer and all next buffers in chain
* belonging to the same packet.
*
* For non-queue packet chains this is the invariant:
* p->tot_len == p->len + (p->next? p->next->tot_len: 0)
*/
u16_t tot_len;//数据包总的长度(数据包分到了几个buffer中)
/** length of this buffer */
u16_t len;//单个buffer的长度
/** pbuf_type as u8_t instead of enum to save space */
u8_t /*pbuf_type*/ type;//数据包类型
/** misc flags */
u8_t flags;
/**
* the reference count always equals the number of pointers
* that refer to this pbuf. This can be pointers from an application,
* the stack itself, or pbuf->next pointers from a chain.
*/
u16_t ref;//引用pbuf的次数
};
这是那个结构体,提到的那个字符串数组就是这个payload
struct pbuf {
/** next pbuf in singly linked pbuf chain */
struct pbuf *next;
/** pointer to the actual data in the buffer */
void *payload;//指向缓存数组
/**
* total length of this buffer and all next buffers in chain
* belonging to the same packet.
*
* For non-queue packet chains this is the invariant:
* p->tot_len == p->len + (p->next? p->next->tot_len: 0)
*/
u16_t tot_len;//数据包总的长度(数据包分到了几个buffer中)
/** length of this buffer */
u16_t len;//单个buffer的长度
/** pbuf_type as u8_t instead of enum to save space */
u8_t /*pbuf_type*/ type;//数据包类型
/** misc flags */
u8_t flags;
/**
* the reference count always equals the number of pointers
* that refer to this pbuf. This can be pointers from an application,
* the stack itself, or pbuf->next pointers from a chain.
*/
u16_t ref;//引用pbuf的次数
};
unsigned char buf [100];
自己编写一个HexToChar函数,将U8数组16进制转换成字符(网上一大把)往缓冲区tcp_client_sendbuf[i++]填充,记得在结尾添加0x00,不知道这样能不能帮到你。
一周热门 更多>