Ace_Decoder_Fragment_Add()
摘要
为数据包设置分片信息。
语法
Ace_Decoder_Fragment_Add (pk_ptr, unique_id, frag_offset, layer, layer_offset, last_fragment)
| 参数 | 类型 | 说明 |
|---|---|---|
pk_ptr |
AceT_Packet * |
目标数据包。 |
unique_id |
int |
当前消息的 ID,该分片是此消息的一部分。 |
frag_offset |
int |
分片在消息中的偏移(以字节计)。 |
layer |
int |
目标协议层。 |
layer_offset |
int |
协议在数据包中的偏移(以字节计)。 |
last_fragment |
int |
若这是最后一个分片则为 PRGC_TRUE,否则为 PRGC_FALSE。 |
返回类型
void
无返回值。
头文件
ace_client_api.h
示例
/* There was a "Content-Length" header in the frame, so we know */
/* exactly the number of bytes in the HTTP Message Body. */
if (curr_msg_ptr->prev_pk_ptr || curr_msg_ptr->remaining_bytes > 0)
{
/* If we know to expect more bytes then we should be able to */
/* set up the fragment info, expecting there will be continuation frames. */
Ace_Decoder_Fragment_Add (pk_ptr, curr_msg_ptr->unique_id,
curr_msg_ptr->bytes_so_far, layer-1, offset,
(curr_msg_ptr->remaining_bytes==0)?PRGC_TRUE:PRGC_FALSE);
详情
本函数向分片数据库添加一个新分片。如果该分片所属的分片组尚不在数据库中,函数会在添加新分片之前先创建一个新的分片组。