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