diff --git a/malattributes/include/mal_attribute.h b/malattributes/include/mal_attribute.h index 5f0d925a..708aa901 100644 --- a/malattributes/include/mal_attribute.h +++ b/malattributes/include/mal_attribute.h @@ -29,6 +29,33 @@ extern "C" { #endif +// See comments in mal_attributes.h for a description of what this is all about +#ifndef MAL_ATTRIBUTES_NMF_TAG_HOTFIX +#define MAL_ATTRIBUTES_NMF_TAG_HOTFIX 0 +#endif + +#if MAL_ATTRIBUTES_NMF_TAG_HOTFIX + +#define MAL_BLOB_ATTRIBUTE_TAG 1 +#define MAL_BOOLEAN_ATTRIBUTE_TAG 2 +#define MAL_DURATION_ATTRIBUTE_TAG 3 +#define MAL_FLOAT_ATTRIBUTE_TAG 4 +#define MAL_DOUBLE_ATTRIBUTE_TAG 5 +#define MAL_IDENTIFIER_ATTRIBUTE_TAG 6 +#define MAL_OCTET_ATTRIBUTE_TAG 7 +#define MAL_UOCTET_ATTRIBUTE_TAG 8 +#define MAL_SHORT_ATTRIBUTE_TAG 9 +#define MAL_USHORT_ATTRIBUTE_TAG 10 +#define MAL_INTEGER_ATTRIBUTE_TAG 11 +#define MAL_UINTEGER_ATTRIBUTE_TAG 12 +#define MAL_LONG_ATTRIBUTE_TAG 13 +#define MAL_ULONG_ATTRIBUTE_TAG 14 +#define MAL_STRING_ATTRIBUTE_TAG 15 +#define MAL_TIME_ATTRIBUTE_TAG 16 +#define MAL_FINETIME_ATTRIBUTE_TAG 17 +#define MAL_URI_ATTRIBUTE_TAG 18 + +#else #define MAL_BLOB_ATTRIBUTE_TAG 0 #define MAL_BOOLEAN_ATTRIBUTE_TAG 1 @@ -49,6 +76,8 @@ extern "C" { #define MAL_FINETIME_ATTRIBUTE_TAG 16 #define MAL_URI_ATTRIBUTE_TAG 17 +#endif + union mal_attribute_t { mal_blob_t *blob_value; mal_boolean_t boolean_value; diff --git a/malattributes/include/malattributes.h b/malattributes/include/malattributes.h index 3a7e2d00..bf860b3e 100644 --- a/malattributes/include/malattributes.h +++ b/malattributes/include/malattributes.h @@ -120,6 +120,16 @@ typedef double mal_duration_t; #define MAL_FINETIME_LIST_SHORT_FORM 0x1000001FFFFEFL #define MAL_URI_LIST_SHORT_FORM 0x1000001FFFFEEL +// There's a difference between attribute short form values and tag values that seems to be mixed up in the NanoSat MO Framework (NMF). +// Some responses to a request interaction includes the attribute types' short form values which are then decoded as if they were tag values. +// The decoding in question happens in the malbinary project's malbinary_decoder_decode_attribute function. +// It could be that NMF is MAL response messages includes the attribute short form values instead of the tag values. +// As a workaround, defining this macro name will increment all tag values by one thus decoding them as short form values instead of tags. +// +// See section 5.2.1. of document CCSDS 524.2-R-1 or the GitHub Issue discussed here: https://github.com/CNES/ccsdsmo-malc/issues/56 +// This is a workaround and by no means a permanent fix. +#define MAL_ATTRIBUTES_NMF_TAG_HOTFIX 1 + // Public API classes #include "mal_blob.h" #include "mal_string.h"