CFDP: Add some length fields

Related to #18495
This commit is contained in:
Uli Heilmeier 2022-10-30 10:22:10 +01:00
parent ea41d58d47
commit 8b34bfdb59
1 changed files with 65 additions and 33 deletions

View File

@ -77,9 +77,13 @@ static int hf_cfdp_end_system_stat = -1;
static int hf_cfdp_delivery_code = -1;
static int hf_cfdp_file_stat = -1;
static int hf_cfdp_segment_control = -1;
static int hf_cfdp_src_file_name_len = -1;
static int hf_cfdp_src_file_name = -1;
static int hf_cfdp_dst_file_name_len = -1;
static int hf_cfdp_dst_file_name = -1;
static int hf_cfdp_first_file_name_len = -1;
static int hf_cfdp_first_file_name = -1;
static int hf_cfdp_second_file_name_len = -1;
static int hf_cfdp_second_file_name = -1;
static int hf_cfdp_nak_st_scope = -1;
static int hf_cfdp_nak_sp_scope = -1;
@ -109,6 +113,7 @@ static int hf_cfdp_suspension_ind = -1;
static int hf_cfdp_tlv_len = - 1;
/* Generated from convert_proto_tree_add_text.pl */
static int hf_cfdp_filestore_message_len = -1;
static int hf_cfdp_filestore_message = -1;
static int hf_cfdp_entity = -1;
static int hf_cfdp_message_to_user = -1;
@ -599,6 +604,7 @@ static guint32 dissect_cfdp_filestore_req_tlv(tvbuff_t *tvb, proto_tree *tree, g
guint8 tlv_len;
guint32 offset = ext_offset;
guint32 length;
/* Get field length */
tlv_len = tvb_get_guint8(tvb, offset);
@ -618,17 +624,19 @@ static guint32 dissect_cfdp_filestore_req_tlv(tvbuff_t *tvb, proto_tree *tree, g
proto_tree_add_uint(cfdp_filestore_req_tree, hf_cfdp_spare_four, tvb, offset, 1, aux_byte);
offset += 1;
aux_byte = tvb_get_guint8(tvb, offset);
proto_tree_add_item_ret_uint(cfdp_filestore_req_tree, hf_cfdp_first_file_name_len, tvb, offset, 1, ENC_NA, &length);
offset += 1;
proto_tree_add_item(cfdp_filestore_req_tree, hf_cfdp_first_file_name, tvb, offset, aux_byte, ENC_ASCII);
offset += aux_byte;
aux_byte = tvb_get_guint8(tvb, offset);
offset += 1;
if(aux_byte > 0){
proto_tree_add_item(cfdp_filestore_req_tree, hf_cfdp_second_file_name, tvb, offset, aux_byte, ENC_ASCII);
offset += aux_byte;
if(length > 0){
proto_tree_add_item(cfdp_filestore_req_tree, hf_cfdp_first_file_name, tvb, offset, length, ENC_ASCII);
}
offset += length;
proto_tree_add_item_ret_uint(cfdp_filestore_req_tree, hf_cfdp_second_file_name_len, tvb, offset, 1, ENC_NA, &length);
offset += 1;
if(length > 0){
proto_tree_add_item(cfdp_filestore_req_tree, hf_cfdp_second_file_name, tvb, offset, length, ENC_ASCII);
}
offset += length;
}
return offset;
@ -647,6 +655,7 @@ static guint32 dissect_cfdp_filestore_resp_tlv(tvbuff_t *tvb, proto_tree *tree,
if(tlv_len > 0){
proto_tree *cfdp_filestore_resp_tree;
guint8 aux_byte;
guint32 length;
/* Create a subtree */
cfdp_filestore_resp_tree = proto_tree_add_subtree(tree, tvb, offset-2, tlv_len+2,
@ -687,25 +696,27 @@ static guint32 dissect_cfdp_filestore_resp_tlv(tvbuff_t *tvb, proto_tree *tree,
}
offset += 1;
aux_byte = tvb_get_guint8(tvb, offset);
proto_tree_add_item_ret_uint(cfdp_filestore_resp_tree, hf_cfdp_first_file_name_len, tvb, offset, 1, ENC_NA, &length);
offset += 1;
proto_tree_add_item(cfdp_filestore_resp_tree, hf_cfdp_first_file_name, tvb, offset, aux_byte, ENC_ASCII);
offset += aux_byte;
aux_byte = tvb_get_guint8(tvb, offset);
offset += 1;
if(aux_byte > 0){
proto_tree_add_item(cfdp_filestore_resp_tree, hf_cfdp_second_file_name, tvb, offset, aux_byte, ENC_ASCII);
offset += aux_byte;
if(length > 0){
proto_tree_add_item(cfdp_filestore_resp_tree, hf_cfdp_first_file_name, tvb, offset, length, ENC_ASCII);
}
offset += length;
proto_tree_add_item_ret_uint(cfdp_filestore_resp_tree, hf_cfdp_second_file_name_len, tvb, offset, 1, ENC_NA, &length);
offset += 1;
if(length > 0){
proto_tree_add_item(cfdp_filestore_resp_tree, hf_cfdp_second_file_name, tvb, offset, length, ENC_ASCII);
}
offset += length;
/* Filestore Message */
aux_byte = tvb_get_guint8(tvb, offset);
proto_tree_add_item_ret_uint(cfdp_filestore_resp_tree, hf_cfdp_filestore_message_len, tvb, offset, 1, ENC_NA, &length);
offset += 1;
if(aux_byte > 0){
proto_tree_add_item(cfdp_filestore_resp_tree, hf_cfdp_filestore_message, tvb, offset, tlv_len, ENC_NA);
offset += aux_byte;
if(length > 0){
proto_tree_add_item(cfdp_filestore_resp_tree, hf_cfdp_filestore_message, tvb, offset, length, ENC_NA);
}
offset += length;
}
return offset+1;
@ -740,7 +751,6 @@ static guint32 dissect_cfdp_fault_location_tlv(tvbuff_t *tvb, proto_tree *tree,
/* Dissect the Message to User TLV */
static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ext_offset){
guint8 aux_byte;
guint8 tlv_type;
guint8 tlv_len;
proto_tree *cfdp_msg_to_user_tree;
@ -882,8 +892,7 @@ static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, packet_info *pinfo, p
case DIRECTORY_LIST_RESP:
/* Listing Response Code */
aux_byte = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(cfdp_msg_to_user_tree, hf_cfdp_listing_resp_code, tvb, offset, 1, aux_byte);
proto_tree_add_item(cfdp_msg_to_user_tree, hf_cfdp_listing_resp_code, tvb, offset, 1, ENC_NA);
offset += 1;
/* Directory Name */
tlv_len = tvb_get_guint8(tvb, offset);
@ -1145,6 +1154,7 @@ static guint32 dissect_cfdp_metadata_pdu(tvbuff_t *tvb, packet_info *pinfo, prot
guint8 aux_byte, tlv_type;
guint cfdp_packet_data_length = ext_packet_len;
guint32 length;
guint32 offset = ext_offset;
@ -1154,16 +1164,18 @@ static guint32 dissect_cfdp_metadata_pdu(tvbuff_t *tvb, packet_info *pinfo, prot
offset += 1;
proto_tree_add_item(tree, hf_cfdp_file_size, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
aux_byte = tvb_get_guint8(tvb, offset);
if(aux_byte >0){
proto_tree_add_item(tree, hf_cfdp_src_file_name, tvb, offset+1, aux_byte, ENC_ASCII);
proto_tree_add_item_ret_uint(tree, hf_cfdp_src_file_name_len, tvb, offset, 1, ENC_NA, &length);
offset += 1;
if(length >0){
proto_tree_add_item(tree, hf_cfdp_src_file_name, tvb, offset, length, ENC_ASCII);
}
offset += aux_byte+1;
aux_byte = tvb_get_guint8(tvb, offset);
if(aux_byte >0){
proto_tree_add_item(tree, hf_cfdp_dst_file_name, tvb, offset+1, aux_byte, ENC_ASCII);
offset += length;
proto_tree_add_item_ret_uint(tree, hf_cfdp_dst_file_name_len, tvb, offset, 1, ENC_NA, &length);
offset += 1;
if(length >0){
proto_tree_add_item(tree, hf_cfdp_dst_file_name, tvb, offset, length, ENC_ASCII);
}
offset += aux_byte+1;
offset += length;
/* Add TLV fields */
while(offset < cfdp_packet_data_length){
tlv_type = tvb_get_guint8(tvb, offset);
@ -1791,18 +1803,34 @@ proto_register_cfdp(void)
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_cfdp_src_file_name_len,
{"Length of source file name", "cfdp.src_file_name_len", FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL}
},
{ &hf_cfdp_src_file_name,
{"Source file name", "cfdp.src_file_name", FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL}
},
{ &hf_cfdp_dst_file_name_len,
{"Length of destination file name", "cfdp.dst_file_name_len", FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL}
},
{ &hf_cfdp_dst_file_name,
{"Destination file name", "cfdp.dst_file_name", FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL}
},
{ &hf_cfdp_first_file_name_len,
{"Length of first file name", "cfdp.first_file_name_len", FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL}
},
{ &hf_cfdp_first_file_name,
{"First file name", "cfdp.first_file_name", FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL}
},
{ &hf_cfdp_second_file_name_len,
{"Length of second file name", "cfdp.second_file_name_len", FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL}
},
{ &hf_cfdp_second_file_name,
{"Second file name", "cfdp.second_file_name", FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL}
@ -1907,6 +1935,10 @@ proto_register_cfdp(void)
FT_UINT8, BASE_DEC, VALS(cfdp_suspension_ind), 0x80,
NULL, HFILL}
},
{ &hf_cfdp_filestore_message_len,
{"Length of filestore message", "cfdp.filestore_message_len", FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL}
},
/* Generated from convert_proto_tree_add_text.pl */
{ &hf_cfdp_filestore_message, { "Filestore Message", "cfdp.filestore_message", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},