src/mime.h
author Krista Bennett <krista@pep-project.org>
Tue, 21 Mar 2017 14:41:59 +0100
branchfdik_sync
changeset 1684 20643edc4c53
parent 1513 e7f7e42385b5
permissions -rw-r--r--
stowing changes - broken commit, FYI
     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 // pEp-internal functions
    13 PEP_STATUS raise_body(message* msg);
    14 
    15 
    16 // is_PGP_message_text() - determine if text encodes a PGP message
    17 //
    18 //  parameters:
    19 //      text (in)               text to examine
    20 //
    21 //  return value:
    22 //      true if text is a PGP message, false otherwise
    23 
    24 DYNAMIC_API bool is_PGP_message_text(const char *text);
    25 
    26 
    27 // mime_encode_message() - encode a MIME message
    28 //
    29 //  parameters:
    30 //      msg (in)                message to encode
    31 //      omit_fields (in)        only encode message body and attachments
    32 //      mimetext (out)          the resulting encoded text or NULL on any error
    33 //
    34 //  return value:
    35 //      PEP_STATUS_OK           if everything worked
    36 //      PEP_BUFFER_TOO_SMALL    if encoded message size is too big to handle
    37 //      PEP_CANNOT_CREATE_TEMP_FILE
    38 //                              if there are issues with temp files; in
    39 //                              this case errno will contain the underlying
    40 //                              error
    41 //      PEP_OUT_OF_MEMORY       if not enough memory could be allocated
    42 //
    43 //  caveat:
    44 //      the resulttext will go to the ownership of the caller
    45 //      the message will remain in the ownership of the caller
    46 //      omit_fields is true for payload of PGP/MIME messages
    47 
    48 DYNAMIC_API PEP_STATUS mime_encode_message(
    49         const message * msg,
    50         bool omit_fields,
    51         char **mimetext
    52     );
    53 
    54 
    55 // mime_decode_message() - decode a MIME message
    56 //
    57 //  parameters:
    58 //      mimetext (in)           MIME encoded text to decode
    59 //      size (in)               size of text to decode
    60 //      msg (out)               decoded message
    61 //
    62 //  return value:
    63 //      PEP_STATUS_OK           if everything worked
    64 //      PEP_BUFFER_TOO_SMALL    if encoded message size is too big to handle
    65 //      PEP_CANNOT_CREATE_TEMP_FILE
    66 //                              if there are issues with temp files; in
    67 //                              this case errno will contain the underlying
    68 //                              error
    69 //      PEP_OUT_OF_MEMORY       if not enough memory could be allocated
    70 //
    71 //  caveat:
    72 //      the decoded message will go to the ownership of the caller; mimetext
    73 //      will remain in the ownership of the caller
    74 
    75 DYNAMIC_API PEP_STATUS mime_decode_message(
    76         const char *mimetext,
    77         size_t size,
    78         message **msg
    79     );
    80 
    81 #ifdef __cplusplus
    82 }
    83 #endif