src/message_api.h
author Volker Birk <vb@pep-project.org>
Wed, 15 Apr 2015 11:19:59 +0200
changeset 189 dc89296e774b
parent 117 d2ff99ccdf30
child 190 b5cdb862fb16
permissions -rw-r--r--
defining color values
vb@39
     1
#pragma once
vb@39
     2
vb@102
     3
#include "pEpEngine.h"
vb@102
     4
#include "keymanagement.h"
vb@101
     5
#include "message.h"
vb@101
     6
#include "mime.h"
vb@101
     7
vb@37
     8
#ifdef __cplusplus
vb@37
     9
extern "C" {
vb@37
    10
#endif
vb@37
    11
vb@39
    12
vb@39
    13
// encrypt_message() - encrypt message in memory
vb@39
    14
//
vb@39
    15
//  parameters:
vb@48
    16
//      session (in)        session handle
vb@48
    17
//      src (in)            message to encrypt
vb@48
    18
//      extra (in)          extra keys for encryption
vb@83
    19
//      dst (out)           pointer to new encrypted message or NULL on failure
vb@84
    20
//      enc_format (in)     encrypted format
vb@39
    21
//
vb@39
    22
//  return value:
vb@48
    23
//      PEP_STATUS_OK                   on success
vb@48
    24
//		PEP_KEY_NOT_FOUND	            at least one of the receipient keys
vb@48
    25
//		                                could not be found
vb@48
    26
//		PEP_KEY_HAS_AMBIG_NAME          at least one of the receipient keys has
vb@48
    27
//		                                an ambiguous name
vb@48
    28
//		PEP_GET_KEY_FAILED		        cannot retrieve key
vb@83
    29
//
vb@83
    30
//	caveat:
vb@83
    31
//	    the ownership of the new message goes to the caller
vb@117
    32
//	    if src is unencrypted this function returns PEP_UNENCRYPTED and sets
vb@117
    33
//	    dst to NULL
vb@38
    34
vb@44
    35
DYNAMIC_API PEP_STATUS encrypt_message(
vb@37
    36
        PEP_SESSION session,
vb@113
    37
        message *src,
vb@37
    38
        stringlist_t *extra,
vb@38
    39
        message **dst,
vb@81
    40
        PEP_enc_format enc_format
vb@37
    41
    );
vb@37
    42
vb@39
    43
vb@39
    44
// decrypt_message() - decrypt message in memory
vb@39
    45
//
vb@39
    46
//  parameters:
vb@48
    47
//      session (in)        session handle
vb@48
    48
//      src (in)            message to decrypt
vb@113
    49
//      mime (in)           MIME encoding wanted
vb@83
    50
//      dst (out)           pointer to new decrypted message or NULL on failure
vb@39
    51
//
vb@39
    52
//  return value:
vb@39
    53
//      error status or PEP_STATUS_OK on success
vb@83
    54
//
vb@83
    55
//	caveat:
vb@83
    56
//	    the ownership of the new message goes to the caller
vb@39
    57
vb@44
    58
DYNAMIC_API PEP_STATUS decrypt_message(
vb@37
    59
        PEP_SESSION session,
vb@113
    60
        message *src,
vb@113
    61
        PEP_MIME_format mime,
vb@113
    62
        message **dst
vb@37
    63
    );
vb@37
    64
vb@189
    65
vb@189
    66
typedef enum _pEp_color {
vb@189
    67
    pEp_undefined = 0,
vb@189
    68
    pEp_unencrypted,
vb@189
    69
    pEp_unreliable,
vb@189
    70
    pEp_reliable,
vb@189
    71
    pEp_yellow = pEp_reliable,
vb@189
    72
    pEp_trusted,
vb@189
    73
    pEp_green = pEp_trusted,
vb@189
    74
    pEp_trusted_and_anonymized,
vb@189
    75
    pEp_fully_anonymous,   
vb@189
    76
vb@189
    77
    pEp_under_attack = -1,
vb@189
    78
    pEp_red = pEp_under_attack,
vb@189
    79
    pEp_b0rken = -2
vb@189
    80
} pEp_color;
vb@189
    81
vb@189
    82
// get_color() - get color for a message
vb@189
    83
//
vb@189
    84
//  parameters:
vb@189
    85
//      session (in)        session handle
vb@189
    86
//      msg (in)            message to get the color for
vb@189
    87
//      color (out)         color for the message
vb@189
    88
//
vb@189
    89
//  return value:
vb@189
    90
//      error status or PEP_STATUS_OK on success
vb@189
    91
vb@189
    92
DYNAMIC_API PEP_STATUS get_color(
vb@189
    93
        PEP_SESSION session,
vb@189
    94
        const message *msg,
vb@189
    95
        pEp_color *color
vb@189
    96
    );
vb@189
    97
vb@37
    98
#ifdef __cplusplus
vb@37
    99
}
vb@37
   100
#endif
vb@37
   101