Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File Directive PDU data length field is off by 1 #5

Closed
avan989 opened this issue Nov 3, 2023 · 1 comment · Fixed by #6
Closed

File Directive PDU data length field is off by 1 #5

avan989 opened this issue Nov 3, 2023 · 1 comment · Fixed by #6

Comments

@avan989
Copy link

avan989 commented Nov 3, 2023

From the code, it looks like the "PDU data length" for the File Directive does not include the directive code. From CCSDS 727.0-B-5 Section 5.2.1.1

The data field of File Directives shall consist of a Directive Code octet followed by a Directive Parameter field

Example from cfdp_pdu_eof.rb:

pdu = build_initial_pdu(type: "FILE_DIRECTIVE", destination_entity: destination_entity, transmission_mode: transmission_mode, file_size: file_size, segmentation_control: segmentation_control)
pdu_header_part_1_length = pdu.length # Measured here before writing variable data
pdu_header = pdu.build_variable_header(source_entity_id: source_entity['id'], transaction_seq_num: transaction_seq_num, destination_entity_id: destination_entity['id'], directive_code: "EOF")
pdu_header_part_2_length = pdu_header.length
pdu_contents = pdu.build_eof_pdu_contents(condition_code: condition_code, file_checksum: file_checksum, file_size: file_size, canceling_entity_id: canceling_entity_id)
pdu.write("VARIABLE_DATA", pdu_header + pdu_contents)
pdu.write("PDU_DATA_LENGTH", pdu.length - pdu_header_part_1_length - pdu_header_part_2_length)

@ryanmelt
Copy link
Member

You are correct. Fill fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants