우리는 소프트웨어를 개발하고 프로토콜은 표준 pdcp를 사용하지만 표준 pdcp 프로토콜 앞에 44 바이트 사용자 정의 데이터를 추가합니다.
wireshark 플러그인을 작성하여 패키지를 구문 분석하고 헤드 44 바이트 사용자 정의 데이터를 무시하고 다른 데이터를 구문 분석 한 후 wireshark pdcp dissector를 사용하십시오. 코드 목록은 아래 : PDCP parsewireshark 플러그인은 상세 정보를 표시 할 수 없습니다
코드와 무슨 일이야 :
static gint ett_dtmpdcp = -1;
static gint hf_sdtprot_pdu_Msg_Content_None
static hf_register_info hf[] = {
{ &hf_sdtprot_pdu_Msg_Content_None,
{ " ", "dtmpdcp.none",
FT_NONE, BASE_NONE,
NULL, 0x0,
NULL, HFILL }
}
};
static gint *ett[] = {
&ett_dtmpdcp
};
int packet_parse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
{
int item_offset = 44; //ignore head 44 bytes custom data
gint16 pdu_len = tvb_reported_length(tvb);
proto_item * pdcp_item = proto_tree_add_item(tree, proto_dtmpdcp, tvb, 0, -1, ENC_NA);
proto_item_append_text(pdcp_item, ",PDU len : %-05u", pdu_len);
proto_tree * subtree = proto_item_add_subtree(pdcp_item, ett_dtmpdcp);
offset += item_offset;
//use wireshark pdcp dissector,wireshark register pdcp-lte dissector in packet_pdcp_lte.c file
dissector_handle_t handle = find_dissector("pdcp-lte");
if(handle)
{
tvbuff_t* next_tvb = tvb_new_subset(tvb, offset, -1, pdu_len - item_offset);
if(next_tvb)
{
call_dissector(handle, next_tvb, pinfo, subtree);
//tvb_free(next_tvb);
}
}
return 0;
}
const char *c_proto_string = "DTM-PDCP";
static void
dissect_dtmpdcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, c_proto_string);
col_clear(pinfo->cinfo,COL_INFO);
if (tree)
{
gint offset = 0;
do
{
offset = packet_parse(tvb, pinfo, tree, offset);
} while(offset > 0);
}
}
void proto_register_dtmpdcp(void)
{
module_t *sdtpprot_module;
proto_dtmpdcp = proto_register_protocol("PDCP DTM", /* name */
"a-pdcp", /* short name */
"a-pdcp" /* abbrev */
);
proto_register_field_array(proto_dtmpdcp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
sdtpprot_module = prefs_register_protocol(proto_dtmpdcp, NULL);
prefs_register_bool_preference(sdtpprot_module, "desegment",
"Desegment all dtm-pdcp messages spanning multiple TCP segments",
"Whether the dtm-pdcp dissector should desegment all messages spanning multiple TCP segments",
&sdtpprot_desegment);
}
void proto_reg_handoff_dtmpdcp(void)
{
dissector_handle_t dtmpdcp_handle;
int port = 20000;
dtmpdcp_handle = create_dissector_handle(dissect_dtmpdcp, proto_dtmpdcp);
dissector_add_uint("udp.port", port, dtmpdcp_handle);
}
때 사용하는 패키지를 해부학자이 플러그인, 와이어 샤크 UI는 PDCP 프로토콜 상세 정보]를 표시하지 않습니다?
감사합니다.