X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/76e975a593f0194edcbfbfc952eb391b2b8605cf..085c36723242f7bd1e0fd9bf49b950da6cb96039:/projects/stargazer/plugins/other/smux/value2os.h

diff --git a/projects/stargazer/plugins/other/smux/value2os.h b/projects/stargazer/plugins/other/smux/value2os.h
index 420616a1..9084aa72 100644
--- a/projects/stargazer/plugins/other/smux/value2os.h
+++ b/projects/stargazer/plugins/other/smux/value2os.h
@@ -1,20 +1,61 @@
-#ifndef __VALUE_2_OS_H__
-#define __VALUE_2_OS_H__
+#pragma once
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include "stg/ObjectSyntax.h"
+#pragma GCC diagnostic pop
+
+#include <string>
 
 template <typename T>
-bool ValueToOS(const T & value, ObjectSyntax * objectSyntax);
+void ValueToOS(const T & value, ObjectSyntax * objectSyntax);
+
+template <>
+inline
+void ValueToOS<int>(const 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);
+}
+
+template <>
+inline
+void ValueToOS<unsigned int>(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);
+}
 
 template <>
 inline
-bool ValueToOS<int>(const int & value, ObjectSyntax * objectSyntax)
+void ValueToOS<long>(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;
 }
 
-#endif
+template <>
+inline
+void ValueToOS<unsigned long>(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);
+}
+
+template <>
+inline
+void ValueToOS<std::string>(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(), static_cast<int>(value.length()));
+}