X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/52b4afb2c72468a55fb49aeed3f7dda1277319df..9b9f5b6503dab7eaf2c35de920169933496715d0:/projects/stargazer/plugins/other/smux/value2os.h?ds=inline diff --git a/projects/stargazer/plugins/other/smux/value2os.h b/projects/stargazer/plugins/other/smux/value2os.h index 830fb3b3..d17cb357 100644 --- a/projects/stargazer/plugins/other/smux/value2os.h +++ b/projects/stargazer/plugins/other/smux/value2os.h @@ -1,6 +1,8 @@ #ifndef __VALUE_2_OS_H__ #define __VALUE_2_OS_H__ +#include "stg/ObjectSyntax.h" + template bool ValueToOS(const T & value, ObjectSyntax * objectSyntax); @@ -15,4 +17,48 @@ asn_long2INTEGER(&simpleSyntax->choice.number, value); return true; } +template <> +inline +bool ValueToOS(const unsigned int & value, ObjectSyntax * objectSyntax) +{ +objectSyntax->present = ObjectSyntax_PR_simple; +SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple; +simpleSyntax->present = SimpleSyntax_PR_number; +asn_long2INTEGER(&simpleSyntax->choice.number, value); +return true; +} + +template <> +inline +bool ValueToOS(const long & value, ObjectSyntax * objectSyntax) +{ +objectSyntax->present = ObjectSyntax_PR_simple; +SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple; +simpleSyntax->present = SimpleSyntax_PR_number; +asn_long2INTEGER(&simpleSyntax->choice.number, value); +return true; +} + +template <> +inline +bool ValueToOS(const unsigned long & value, ObjectSyntax * objectSyntax) +{ +objectSyntax->present = ObjectSyntax_PR_simple; +SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple; +simpleSyntax->present = SimpleSyntax_PR_number; +asn_long2INTEGER(&simpleSyntax->choice.number, value); +return true; +} + +template <> +inline +bool ValueToOS(const std::string & value, ObjectSyntax * objectSyntax) +{ +objectSyntax->present = ObjectSyntax_PR_simple; +SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple; +simpleSyntax->present = SimpleSyntax_PR_string; +OCTET_STRING_fromBuf(&simpleSyntax->choice.string, value.c_str(), value.length()); +return true; +} + #endif