【发布时间】:2015-06-05 09:03:21
【问题描述】:
我正在开发一个解析器/协议作为网络层之上的插件,以便 IP 解析器将解析所有 IP 标头并查看“协议”字段以将有效负载传递给我的协议。
假设协议号是“ 254 ”。
需要执行哪些步骤才能使 IP 解析器将有效负载传递给我的协议?
编辑:
我的 packet-temp.c 文件包含:
#include "config.h"
#include <epan/packet.h>
#define IP_PROTO_TEMP 254
static int proto_temp = -1;
static void dissect_temp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, "TEMP");
/* Clear out stuff in the info column */
col_clear(pinfo->cinfo, COL_INFO);
}
void proto_register_temp(void)
{
proto_temp = proto_register_protocol (
"TEMP Protocol", /* name */
"TEMP", /* short name */
"temp" /* abbrev */
);
}
void proto_reg_handoff_temp(void)
{
static dissector_handle_t temp_handle;
temp_handle = create_dissector_handle(dissect_temp, proto_temp);
dissector_add_uint("ip.proto", IP_PROTO_TEMP , temp_handle);
}
我在 >C:\Development\wireshark\plugins\temp 文件夹中有这个文件,因为我将它作为插件编写。
谢谢。
【问题讨论】:
标签: wireshark wireshark-dissector