2 ======================================================================
3 FILE: sspm.h Mime Parser
4 CREATOR: eric 25 June 2000
6 $Id: sspm.h,v 1.5 2008-01-15 23:17:43 dothebart Exp $
9 (C) COPYRIGHT 2000, Eric Busboom <eric@softwarestudio.org>
10 http://www.softwarestudio.org
12 The contents of this file are subject to the Mozilla Public License
13 Version 1.0 (the "License"); you may not use this file except in
14 compliance with the License. You may obtain a copy of the License at
15 http://www.mozilla.org/MPL/
17 Software distributed under the License is distributed on an "AS IS"
18 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
19 the License for the specific language governing rights and
20 limitations under the License.
23 This program is free software; you can redistribute it and/or modify
24 it under the terms of either:
26 The LGPL as published by the Free Software Foundation, version
27 2.1, available at: http://www.fsf.org/copyleft/lesser.html
31 The Mozilla Public License Version 1.0. You may obtain a copy of
32 the License at http://www.mozilla.org/MPL/
34 The Initial Developer of the Original Code is Eric Busboom
36 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
37 ======================================================================*/
42 enum sspm_major_type {
45 SSPM_IMAGE_MAJOR_TYPE,
46 SSPM_AUDIO_MAJOR_TYPE,
47 SSPM_VIDEO_MAJOR_TYPE,
48 SSPM_APPLICATION_MAJOR_TYPE,
49 SSPM_MULTIPART_MAJOR_TYPE,
50 SSPM_MESSAGE_MAJOR_TYPE,
51 SSPM_UNKNOWN_MAJOR_TYPE
54 enum sspm_minor_type {
57 SSPM_PLAIN_MINOR_TYPE,
58 SSPM_RFC822_MINOR_TYPE,
59 SSPM_DIGEST_MINOR_TYPE,
60 SSPM_CALENDAR_MINOR_TYPE,
61 SSPM_MIXED_MINOR_TYPE,
62 SSPM_RELATED_MINOR_TYPE,
63 SSPM_ALTERNATIVE_MINOR_TYPE,
64 SSPM_PARALLEL_MINOR_TYPE,
65 SSPM_UNKNOWN_MINOR_TYPE
70 SSPM_QUOTED_PRINTABLE_ENCODING,
80 SSPM_UNEXPECTED_BOUNDARY_ERROR,
81 SSPM_WRONG_BOUNDARY_ERROR,
82 SSPM_NO_BOUNDARY_ERROR,
84 SSPM_MALFORMED_HEADER_ERROR
92 enum sspm_major_type major;
93 enum sspm_minor_type minor;
95 char ** content_type_params;
97 enum sspm_encoding encoding;
100 enum sspm_error error;
105 struct sspm_header header;
111 struct sspm_action_map {
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,
116 const char* line, size_t size);
117 void* (*end_part)(void* part);
118 void (*free_part)(void *part);
121 const char* sspm_major_type_string(enum sspm_major_type type);
122 const char* sspm_minor_type_string(enum sspm_minor_type type);
123 const char* sspm_encoding_string(enum sspm_encoding type);
125 int sspm_parse_mime(struct sspm_part *parts,
127 const struct sspm_action_map *actions,
128 char* (*get_string)(char *s, size_t size, void* data),
129 void *get_string_data,
130 struct sspm_header *first_header
133 void sspm_free_parts(struct sspm_part *parts, size_t max_parts);
135 char *decode_quoted_printable(char *dest,
138 char *decode_base64(char *dest,
143 int sspm_write_mime(struct sspm_part *parts,size_t num_parts,
144 char **output_string, const char* header);