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