src/mime.h
author vb
Wed, 04 Mar 2015 10:39:29 +0100
changeset 87 060a95de62a8
parent 59 88429085f8da
child 89 aef5a4bc78f3
permissions -rw-r--r--
fixing Makefile
vb@48
     1
#pragma once
vb@48
     2
vb@59
     3
#include "transport.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@48
    10
// mime_encode_text() - encode a MIME message
vb@48
    11
//
vb@48
    12
//  parameters:
vb@48
    13
//      plaintext (in)          plaintext of message as UTF-8 string
vb@48
    14
//      htmltext (in)           optional HTML version of message as UTF-8
vb@48
    15
//                              string or NULL if it does not apply
vb@59
    16
//      attachments (in)        attatchments or NULL if there are none
vb@87
    17
//      mimetext (out)          the resulting encoded text or NULL on any error
vb@48
    18
//
vb@48
    19
//  return value:
vb@48
    20
//      PEP_STATUS_OK           if everything worked
vb@48
    21
//      PEP_BUFFER_TOO_SMALL    if encoded message size is too big to handle
vb@48
    22
//      PEP_CANNOT_CREATE_TEMP_FILE
vb@48
    23
//                              if there are issues with temp files; in
vb@48
    24
//                              this case errno will contain the underlying
vb@48
    25
//                              error
vb@48
    26
//      PEP_OUT_OF_MEMORY       if not enough memory could be allocated
vb@48
    27
//
vb@48
    28
//  caveat:
vb@59
    29
//      the resulttext will go to the ownership of the caller; plaintext,
vb@59
    30
//      htmltext and attachments will remain in the ownership of the caller
vb@48
    31
vb@48
    32
DYNAMIC_API PEP_STATUS mime_encode_text(
vb@48
    33
        const char *plaintext,
vb@48
    34
        const char *htmltext,
vb@59
    35
        bloblist_t *attachments,
vb@87
    36
        char **mimetext
vb@87
    37
    );
vb@87
    38
vb@87
    39
vb@87
    40
// mime_decode_text() - decode a MIME message
vb@87
    41
//
vb@87
    42
//  parameters:
vb@87
    43
//      mimetext (in)           MIME encoded text to decode
vb@87
    44
//      plaintext (out)         plaintext of message as UTF-8 string
vb@87
    45
//      htmltext (out)          optional HTML version of message as UTF-8
vb@87
    46
//                              string or NULL if it does not apply
vb@87
    47
//      attachments (out)       attatchments or NULL if there are none
vb@87
    48
//
vb@87
    49
//  return value:
vb@87
    50
//      PEP_STATUS_OK           if everything worked
vb@87
    51
//      PEP_BUFFER_TOO_SMALL    if encoded message size is too big to handle
vb@87
    52
//      PEP_CANNOT_CREATE_TEMP_FILE
vb@87
    53
//                              if there are issues with temp files; in
vb@87
    54
//                              this case errno will contain the underlying
vb@87
    55
//                              error
vb@87
    56
//      PEP_OUT_OF_MEMORY       if not enough memory could be allocated
vb@87
    57
//
vb@87
    58
//  caveat:
vb@87
    59
//      plaintext, htmltext and attachments will go to the ownership of the
vb@87
    60
//      caller; mimetext will remain in the ownership of the caller
vb@87
    61
vb@87
    62
DYNAMIC_API PEP_STATUS mime_decode_text(
vb@87
    63
        const char *mimetext,
vb@87
    64
        char **plaintext,
vb@87
    65
        char **htmltext,
vb@87
    66
        bloblist_t **attachments
vb@48
    67
    );
vb@48
    68
vb@48
    69
#ifdef __cplusplus
vb@48
    70
}
vb@48
    71
#endif
vb@48
    72