Ace_Decoder_Protocol_Add()
摘要
向所处理的协议列表中添加一个协议。
语法
Ace_Decoder_Protocol_Add (import_ptr, protocol_name, protocol_long_name)
| 参数 | 类型 | 说明 |
|---|---|---|
import_ptr |
AceT_Import_Handle * |
上下文信息。 |
protocol_name |
const char * |
协议名称。 |
protocol_long_name |
const char * |
未使用。 |
返回类型
int
新建协议的 ID;失败时为 ACEC_DECODER_PROTOCOL_UNKNOWN。
头文件
ace_client_api.h
示例
/* Make sure that the tcp has payload before adding a next protocol */
if (!port_name_ptr || tcp_info.tcp_payload_len == 0)
{
*next_protocol_id = ACEC_DECODER_PROTOCOL_UNKNOWN;
}
else
{
/* port_name_ptr exists. */
*next_protocol_id = Ace_Decoder_Protocol_ID_Get (import_ptr,
port_name_ptr->short_name);
if (*next_protocol_id == ACEC_DECODER_PROTOCOL_UNKNOWN)
{
*next_protocol_id = Ace_Decoder_Protocol_Add (import_ptr,
port_name_ptr->short_name, port_name_ptr->short_name);
}
}