Enable GUI option for 'custom command' connection. Don't g_free strings in
[platform/upstream/evolution-data-server.git] / camel / camel-multipart-signed.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2  * camel-signed--multipart.h : class for a signed-multipart 
3  *
4  * Authors: Michael Zucchi <notzed@ximian.com>
5  *
6  * Copyright 2002 Ximian, Inc. (www.ximian.com)
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of version 2 of the GNU General Public
10  * License as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  * USA
21  */
22
23 /* Should this be a subclass of multipart?
24    No, because we dont have different parts?
25    I'm not really sure yet ... ? */
26
27 #ifndef CAMEL_MULTIPART_SIGNED_H
28 #define CAMEL_MULTIPART_SIGNED_H 1
29
30 #ifdef __cplusplus
31 extern "C" {
32 #pragma }
33 #endif /* __cplusplus }*/
34
35 #include <camel/camel-multipart.h>
36 #include <camel/camel-cipher-context.h>
37
38 #define CAMEL_MULTIPART_SIGNED_TYPE     (camel_multipart_signed_get_type ())
39 #define CAMEL_MULTIPART_SIGNED(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_MULTIPART_SIGNED_TYPE, CamelMultipartSigned))
40 #define CAMEL_MULTIPART_SIGNED_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MULTIPART_SIGNED_TYPE, CamelMultipartSignedClass))
41 #define CAMEL_IS_MULTIPART_SIGNED(o)    (CAMEL_CHECK_TYPE((o), CAMEL_MULTIPART_SIGNED_TYPE))
42
43 /*
44 enum {
45         CAMEL_MULTIPART_EMPTY,
46         CAMEL_MULTIPART_CONST,
47         CAMEL_MULTIPART_SIGN,
48         CAMEL_MULTIPART_ENCR,
49 };
50 */
51
52 /* 'handy' enums for getting the internal parts of the multipart */
53 enum {
54         CAMEL_MULTIPART_SIGNED_CONTENT,
55         CAMEL_MULTIPART_SIGNED_SIGNATURE,
56 };
57
58 typedef struct _CamelMultipartSigned CamelMultipartSigned;
59
60 struct _CamelMultipartSigned
61 {
62         CamelMultipart parent_object;
63
64         /* these are the client visible parts, decoded forms of our data wrapper content */
65         CamelMimePart *content;
66         CamelMimePart *signature;
67
68         /* the raw content which must go over the wire, if we have generated it */
69         /* perhaps this should jsut set data_wrapper->stream and update start1/end1 accordingly, as it is done
70            for other parts, or visa versa? */
71         CamelStream *contentraw;
72
73         /*int state;*/
74
75         /* just cache some info we use */
76         char *protocol;
77         char *micalg;
78
79         /* offset pointers of start of boundary in content object */
80         off_t start1, end1;
81         off_t start2, end2;
82 };
83
84 typedef struct {
85         CamelMultipartClass parent_class;
86 } CamelMultipartSignedClass;
87
88 /* Standard Camel function */
89 CamelType camel_multipart_signed_get_type (void);
90
91 /* public methods */
92 CamelMultipartSigned *camel_multipart_signed_new           (void);
93
94 CamelStream *camel_multipart_signed_get_content_stream(CamelMultipartSigned *mps, CamelException *ex);
95
96 int                   camel_multipart_signed_sign          (CamelMultipartSigned *mps, CamelCipherContext *context,
97                                                             CamelMimePart *content, const char *uiserid,
98                                                             CamelCipherHash hash, CamelException *ex);
99 CamelCipherValidity  *camel_multipart_signed_verify        (CamelMultipartSigned *mps, CamelCipherContext *context,
100                                                             CamelException *ex);
101
102 #ifdef __cplusplus
103 }
104 #endif /* __cplusplus */
105
106 #endif /* CAMEL_MULTIPART_SIGNED_H */
107
108