src/mime.h
author Volker Birk <vb@pep.foundation>
Tue, 27 Dec 2016 21:13:41 +0100
changeset 1513 e7f7e42385b5
parent 269 7eb06a6984fe
child 1684 20643edc4c53
child 1984 06e6c0f1d8fc
permissions -rw-r--r--
adding license info to each file
     1 // This file is under GNU General Public License 3.0
     2 // see LICENSE.txt
     3 
     4 #pragma once
     5 
     6 #include "message.h"
     7 
     8 #ifdef __cplusplus
     9 extern "C" {
    10 #endif
    11 
    12 
    13 // is_PGP_message_text() - determine if text encodes a PGP message
    14 //
    15 //  parameters:
    16 //      text (in)               text to examine
    17 //
    18 //  return value:
    19 //      true if text is a PGP message, false otherwise
    20 
    21 DYNAMIC_API bool is_PGP_message_text(const char *text);
    22 
    23 
    24 // mime_encode_message() - encode a MIME message
    25 //
    26 //  parameters:
    27 //      msg (in)                message to encode
    28 //      omit_fields (in)        only encode message body and attachments
    29 //      mimetext (out)          the resulting encoded text or NULL on any error
    30 //
    31 //  return value:
    32 //      PEP_STATUS_OK           if everything worked
    33 //      PEP_BUFFER_TOO_SMALL    if encoded message size is too big to handle
    34 //      PEP_CANNOT_CREATE_TEMP_FILE
    35 //                              if there are issues with temp files; in
    36 //                              this case errno will contain the underlying
    37 //                              error
    38 //      PEP_OUT_OF_MEMORY       if not enough memory could be allocated
    39 //
    40 //  caveat:
    41 //      the resulttext will go to the ownership of the caller
    42 //      the message will remain in the ownership of the caller
    43 //      omit_fields is true for payload of PGP/MIME messages
    44 
    45 DYNAMIC_API PEP_STATUS mime_encode_message(
    46         const message * msg,
    47         bool omit_fields,
    48         char **mimetext
    49     );
    50 
    51 
    52 // mime_decode_message() - decode a MIME message
    53 //
    54 //  parameters:
    55 //      mimetext (in)           MIME encoded text to decode
    56 //      size (in)               size of text to decode
    57 //      msg (out)               decoded message
    58 //
    59 //  return value:
    60 //      PEP_STATUS_OK           if everything worked
    61 //      PEP_BUFFER_TOO_SMALL    if encoded message size is too big to handle
    62 //      PEP_CANNOT_CREATE_TEMP_FILE
    63 //                              if there are issues with temp files; in
    64 //                              this case errno will contain the underlying
    65 //                              error
    66 //      PEP_OUT_OF_MEMORY       if not enough memory could be allocated
    67 //
    68 //  caveat:
    69 //      the decoded message will go to the ownership of the caller; mimetext
    70 //      will remain in the ownership of the caller
    71 
    72 DYNAMIC_API PEP_STATUS mime_decode_message(
    73         const char *mimetext,
    74         size_t size,
    75         message **msg
    76     );
    77 
    78 #ifdef __cplusplus
    79 }
    80 #endif
    81