app_voicemail: Refactor email generation functions

Refactors generic functions used for email generation
into utils.c so that they can be used by multiple
modules, including app_voicemail and app_minivm,
to avoid code duplication.

ASTERISK-29715 #close

Change-Id: I1de0ed3483623e9599711129edc817c45ad237ee
This commit is contained in:
Naveen Albert
2021-11-01 15:40:42 +00:00
committed by George Joseph
parent b290bb1251
commit 70cdb0f9a8
6 changed files with 193 additions and 300 deletions

View File

@@ -137,6 +137,15 @@ int ast_filedelete(const char *filename, const char *fmt);
*/
int ast_filecopy(const char *oldname, const char *newname, const char *fmt);
/*!
* \brief same as mkstemp, but return a FILE
* \param template The template for the unique file name to generate. Modified in place to return the file name.
* \param mode The mode for file permissions
*
* \return FILE handle to the temporary file on success or NULL if creation failed
*/
FILE *ast_file_mkftemp(char *template, mode_t mode);
/*!
* \brief Callback called for each file found when reading directories
* \param dir_name the name of the directory

View File

@@ -336,6 +336,26 @@ char *ast_base64url_decode_string(const char *src);
*/
char *ast_base64url_encode_string(const char *src);
/*!
* \brief Performs a base 64 encode algorithm on the contents of a File
* \param inputfile A FILE handle to the input file to be encoded. Must be readable. This handle is not automatically closed.
* \param outputfile A FILE handle to the output file to receive the base 64 encoded contents of the input file, identified by filename.
* \param endl The line ending to use (e.g. either "\n" or "\r\n")
*
* \return zero on success, -1 on error.
*/
int ast_base64_encode_file(FILE *inputfile, FILE *outputfile, const char *endl);
/*!
* \brief Performs a base 64 encode algorithm on the contents of a File
* \param filename The path to the file to be encoded. Must be readable, file is opened in read mode.
* \param outputfile A FILE handle to the output file to receive the base 64 encoded contents of the input file, identified by filename.
* \param endl The line ending to use (e.g. either "\n" or "\r\n")
*
* \return zero on success, -1 on error.
*/
int ast_base64_encode_file_path(const char *filename, FILE *outputfile, const char *endl);
#define AST_URI_ALPHANUM (1 << 0)
#define AST_URI_MARK (1 << 1)
#define AST_URI_UNRESERVED (AST_URI_ALPHANUM | AST_URI_MARK)