Add base64 encoder/decoder at anna core functions
[anna.git] / include / anna / core / functions.hpp
index 382a625..58b8cd8 100644 (file)
@@ -1097,6 +1097,28 @@ struct functions {
   * @param target Isup number octet string.
   */
   static void codeIsupNumber(const isup_number_t & isupNumber, bool calledOrCalling, std::string & target) throw(RuntimeException);
+
+  /**
+  * Base64 encoding
+  *
+  * @param str String to be encoded
+  *
+  * @return Returns encoded representation
+  */
+  static std::string encodeBase64(const U8* buf, unsigned int bufLen);
+  static std::string encodeBase64(const std::string & str)
+  {
+    return encodeBase64((const U8 *)str.c_str(), str.size());
+  }
+
+  /**
+  * Base64 decoding
+  *
+  * @param encodedString Encoded base64 representation
+  *
+  * @return Returns decoded representation
+  */
+  static std::string decodeBase64(const std::string & encodedString);
 };
 
 }