Skip to content

Commit b65b4be

Browse files
committed
adding header gvcid extraction for AOS to get_max_frame_size function
1 parent b475aef commit b65b4be

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

  • ammos-cryptolib/kmc_sdls/kmc_sdls_python/KmcSdlsClient/src/gov/nasa/jpl/ammos/kmc/sdlsclient

ammos-cryptolib/kmc_sdls/kmc_sdls_python/KmcSdlsClient/src/gov/nasa/jpl/ammos/kmc/sdlsclient/KmcSdlsClient.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,26 @@ def get_max_frame_size(type, input_byte_array) -> int:
4545
max_frame_size : int
4646
The maximum frame size.
4747
'''
48-
# Extract GVCID from TM frame header to look up max frame size
49-
# TM Primary Header format (CCSDS 132.0-B-3):
50-
# Bits 0-1: TFVN, Bits 2-11: SCID (10 bits), Bits 12-14: VCID (3 bits)
51-
tfvn = (input_byte_array[0] & 0xC0) >> 6
52-
scid = ((input_byte_array[0] & 0x3F) << 4) | ((input_byte_array[1] & 0xF0) >> 4)
53-
vcid = (input_byte_array[1] & 0x0E) >> 1
48+
if type == 'tm':
49+
# Extract GVCID from TM frame header to look up max frame size
50+
# TM Primary Header format (CCSDS 132.0-B-3):
51+
# Bits 0-1: TFVN
52+
# Bits 2-11: SCID (10 bits)
53+
# Bits 12-14: VCID (3 bits)
54+
tfvn = (input_byte_array[0] & 0xC0) >> 6
55+
scid = ((input_byte_array[0] & 0x3F) << 4) | ((input_byte_array[1] & 0xF0) >> 4)
56+
vcid = (input_byte_array[1] & 0x0E) >> 1
57+
elif type == 'aos':
58+
# Extract GVCID from AOS frame header to look up max frame size
59+
# AOS Primary Header format (CCSDS 732.0-B):
60+
# Bits 0-1: TFVN (2 bits, binary '01')
61+
# Bits 2-9: SCID (8 bits)
62+
# Bits 10-15: VCID (6 bits)
63+
tfvn = (input_byte_array[0] & 0xC0) >> 6
64+
scid = ((input_byte_array[0] & 0x3F) << 2) | ((input_byte_array[1] & 0xC0) >> 6)
65+
vcid = input_byte_array[1] & 0x3F
66+
else:
67+
raise SdlsClientException(SdlsClientException.SDLS_INITIALIZATION_ERROR, f"{type} frame type is invalid")
5468

5569
# Build frame key to look up managed parameters
5670
frame_key = f"{type}.{scid}.{vcid}.{tfvn}"

0 commit comments

Comments
 (0)