Libical API Documentation 3.0

sspm.h
1/*======================================================================
2 FILE: sspm.h Mime Parser
3 CREATOR: eric 25 June 2000
4
5 (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
6
7 This library is free software; you can redistribute it and/or modify
8 it under the terms of either:
9
10 The LGPL as published by the Free Software Foundation, version
11 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
12
13 Or:
14
15 The Mozilla Public License Version 2.0. You may obtain a copy of
16 the License at https://www.mozilla.org/MPL/
17
18 This library is free software; you can redistribute it and/or modify
19 it under the terms of either:
20
21 The LGPL as published by the Free Software Foundation, version
22 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
23
24 Or:
25
26 The Mozilla Public License Version 2.0. You may obtain a copy of
27 the License at https://www.mozilla.org/MPL/
28
29 The Initial Developer of the Original Code is Eric Busboom
30======================================================================*/
31
32#ifndef ICAL_SSPM_H
33#define ICAL_SSPM_H
34
35#include "libical_ical_export.h"
36
37 enum sspm_major_type
38{
39 SSPM_NO_MAJOR_TYPE,
40 SSPM_TEXT_MAJOR_TYPE,
41 SSPM_IMAGE_MAJOR_TYPE,
42 SSPM_AUDIO_MAJOR_TYPE,
43 SSPM_VIDEO_MAJOR_TYPE,
44 SSPM_APPLICATION_MAJOR_TYPE,
45 SSPM_MULTIPART_MAJOR_TYPE,
46 SSPM_MESSAGE_MAJOR_TYPE,
47 SSPM_UNKNOWN_MAJOR_TYPE
48};
49
50 enum sspm_minor_type
51{
52 SSPM_NO_MINOR_TYPE,
53 SSPM_ANY_MINOR_TYPE,
54 SSPM_PLAIN_MINOR_TYPE,
55 SSPM_RFC822_MINOR_TYPE,
56 SSPM_DIGEST_MINOR_TYPE,
57 SSPM_CALENDAR_MINOR_TYPE,
58 SSPM_MIXED_MINOR_TYPE,
59 SSPM_RELATED_MINOR_TYPE,
60 SSPM_ALTERNATIVE_MINOR_TYPE,
61 SSPM_PARALLEL_MINOR_TYPE,
62 SSPM_UNKNOWN_MINOR_TYPE
63};
64
65 enum sspm_encoding
66{
67 SSPM_NO_ENCODING,
68 SSPM_QUOTED_PRINTABLE_ENCODING,
69 SSPM_8BIT_ENCODING,
70 SSPM_7BIT_ENCODING,
71 SSPM_BINARY_ENCODING,
72 SSPM_BASE64_ENCODING,
73 SSPM_UNKNOWN_ENCODING
74};
75
76 enum sspm_error
77{
78 SSPM_NO_ERROR,
79 SSPM_UNEXPECTED_BOUNDARY_ERROR,
80 SSPM_WRONG_BOUNDARY_ERROR,
81 SSPM_NO_BOUNDARY_ERROR,
82 SSPM_NO_HEADER_ERROR,
83 SSPM_MALFORMED_HEADER_ERROR
84};
85
86 struct sspm_header
87{
88 int def;
89 char *boundary;
90 enum sspm_major_type major;
91 enum sspm_minor_type minor;
92 char *minor_text;
93 char **content_type_params;
94 char *charset;
95 enum sspm_encoding encoding;
96 char *filename;
97 char *content_id;
98 enum sspm_error error;
99 char *error_text;
100};
101
102 struct sspm_part
103{
104 struct sspm_header header;
105 int level;
106 size_t data_size;
107 void *data;
108};
109
110 struct sspm_action_map
111{
112 enum sspm_major_type major;
113 enum sspm_minor_type minor;
114 void *(*new_part) (void);
115 void (*add_line) (void *part, struct sspm_header * header, const char *line, size_t size);
116 void *(*end_part) (void *part);
117 void (*free_part) (void *part);
118};
119
120LIBICAL_ICAL_EXPORT const char *sspm_major_type_string(enum sspm_major_type type);
121
122LIBICAL_ICAL_EXPORT const char *sspm_minor_type_string(enum sspm_minor_type type);
123
124LIBICAL_ICAL_EXPORT const char *sspm_encoding_string(enum sspm_encoding type);
125
126LIBICAL_ICAL_EXPORT int sspm_parse_mime(struct sspm_part *parts,
127 size_t max_parts,
128 const struct sspm_action_map *actions,
129 char *(*get_string) (char *s, size_t size, void *data),
130 void *get_string_data, struct sspm_header *first_header);
131
132LIBICAL_ICAL_EXPORT void sspm_free_parts(struct sspm_part *parts, size_t max_parts);
133
134LIBICAL_ICAL_EXPORT char *decode_quoted_printable(char *dest, char *src, size_t *size);
135
136LIBICAL_ICAL_EXPORT char *decode_base64(char *dest, char *src, size_t *size);
137
138LIBICAL_ICAL_EXPORT int sspm_write_mime(struct sspm_part *parts, size_t num_parts,
139 char **output_string, const char *header);
140
141#endif /* ICAL_SSPM_H */
sspm_action_map
Definition: sspm.h:111
sspm_header
Definition: sspm.h:87
sspm_part
Definition: sspm.h:103