author | Volker Birk <vb@pep.foundation> |
Thu, 01 Sep 2016 17:55:03 +0200 | |
branch | keysync |
changeset 1111 | 3c46dc58096d |
parent 269 | 7eb06a6984fe |
child 1513 | e7f7e42385b5 |
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@117 | 10 |
// is_PGP_message_text() - determine if text encodes a PGP message |
vb@117 | 11 |
// |
vb@117 | 12 |
// parameters: |
vb@117 | 13 |
// text (in) text to examine |
vb@117 | 14 |
// |
vb@117 | 15 |
// return value: |
vb@117 | 16 |
// true if text is a PGP message, false otherwise |
vb@117 | 17 |
|
vb@117 | 18 |
DYNAMIC_API bool is_PGP_message_text(const char *text); |
vb@117 | 19 |
|
vb@117 | 20 |
|
vb@89 | 21 |
// mime_encode_message() - encode a MIME message |
vb@48 | 22 |
// |
vb@48 | 23 |
// parameters: |
vb@89 | 24 |
// msg (in) message to encode |
vb@113 | 25 |
// omit_fields (in) only encode message body and attachments |
vb@87 | 26 |
// mimetext (out) the resulting encoded text or NULL on any error |
vb@48 | 27 |
// |
vb@48 | 28 |
// return value: |
vb@48 | 29 |
// PEP_STATUS_OK if everything worked |
vb@48 | 30 |
// PEP_BUFFER_TOO_SMALL if encoded message size is too big to handle |
vb@48 | 31 |
// PEP_CANNOT_CREATE_TEMP_FILE |
vb@48 | 32 |
// if there are issues with temp files; in |
vb@48 | 33 |
// this case errno will contain the underlying |
vb@48 | 34 |
// error |
vb@48 | 35 |
// PEP_OUT_OF_MEMORY if not enough memory could be allocated |
vb@48 | 36 |
// |
vb@48 | 37 |
// caveat: |
vb@89 | 38 |
// the resulttext will go to the ownership of the caller |
vb@89 | 39 |
// the message will remain in the ownership of the caller |
vb@113 | 40 |
// omit_fields is true for payload of PGP/MIME messages |
vb@48 | 41 |
|
vb@89 | 42 |
DYNAMIC_API PEP_STATUS mime_encode_message( |
vb@89 | 43 |
const message * msg, |
vb@113 | 44 |
bool omit_fields, |
vb@87 | 45 |
char **mimetext |
vb@87 | 46 |
); |
vb@87 | 47 |
|
vb@87 | 48 |
|
vb@89 | 49 |
// mime_decode_message() - decode a MIME message |
vb@87 | 50 |
// |
vb@87 | 51 |
// parameters: |
vb@87 | 52 |
// mimetext (in) MIME encoded text to decode |
vb@269 | 53 |
// size (in) size of text to decode |
vb@89 | 54 |
// msg (out) decoded message |
vb@87 | 55 |
// |
vb@87 | 56 |
// return value: |
vb@87 | 57 |
// PEP_STATUS_OK if everything worked |
vb@87 | 58 |
// PEP_BUFFER_TOO_SMALL if encoded message size is too big to handle |
vb@87 | 59 |
// PEP_CANNOT_CREATE_TEMP_FILE |
vb@87 | 60 |
// if there are issues with temp files; in |
vb@87 | 61 |
// this case errno will contain the underlying |
vb@87 | 62 |
// error |
vb@87 | 63 |
// PEP_OUT_OF_MEMORY if not enough memory could be allocated |
vb@87 | 64 |
// |
vb@87 | 65 |
// caveat: |
vb@89 | 66 |
// the decoded message will go to the ownership of the caller; mimetext |
vb@89 | 67 |
// will remain in the ownership of the caller |
vb@87 | 68 |
|
vb@89 | 69 |
DYNAMIC_API PEP_STATUS mime_decode_message( |
vb@87 | 70 |
const char *mimetext, |
vb@269 | 71 |
size_t size, |
vb@89 | 72 |
message **msg |
vb@48 | 73 |
); |
vb@48 | 74 |
|
vb@48 | 75 |
#ifdef __cplusplus |
vb@48 | 76 |
} |
vb@48 | 77 |
#endif |
vb@48 | 78 |