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