UniMRCP  1.7.0
apt_multipart_content.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2015 Arsen Chaloyan
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef APT_MULTIPART_CONTENT_H
18 #define APT_MULTIPART_CONTENT_H
19 
20 /**
21  * @file apt_multipart_content.h
22  * @brief Multipart Content Routine
23  */
24 
25 #include "apt_header_field.h"
26 
28 
29 /** Opaque multipart content declaration */
31 
32 /** Content part declaration */
34 
35 /** Content part */
37  /** Header section */
39  /** Body */
41 
42  /** Pointer to parsed content-type header field */
44  /** Pointer to parsed content-id header field */
46  /** Pointer to parsed content-length header field */
48 };
49 
50 /**
51  * Create an empty multipart content
52  * @param max_content_size the max size of the content (body)
53  * @param boundary the boundary to separate content parts
54  * @param pool the pool to allocate memory from
55  * @return an empty multipart content
56  */
57 APT_DECLARE(apt_multipart_content_t*) apt_multipart_content_create(apr_size_t max_content_size, const apt_str_t *boundary, apr_pool_t *pool);
58 
59 /**
60  * Add content part to multipart content
61  * @param multipart_content the multipart content to add content part to
62  * @param content_part the content part to add
63  * @return TRUE on success
64  */
66 
67 /**
68  * Add content part to multipart content by specified header fields and body
69  * @param multipart_content the multipart content to add content part to
70  * @param content_type the type of content part
71  * @param content_id the identifier of content part
72  * @param body the body of content part
73  * @return TRUE on success
74  */
75 APT_DECLARE(apt_bool_t) apt_multipart_content_add2(apt_multipart_content_t *multipart_content, const apt_str_t *content_type, const apt_str_t *content_id, const apt_str_t *body);
76 
77 /**
78  * Finalize multipart content generation
79  * @param multipart_content the multipart content to finalize
80  * @return generated multipart content
81  */
83 
84 
85 /**
86  * Assign body to multipart content to get (parse) each content part from
87  * @param body the body of multipart content to parse
88  * @param boundary the boundary to separate content parts
89  * @param pool the pool to allocate memory from
90  * @return multipart content with assigned body
91  */
92 APT_DECLARE(apt_multipart_content_t*) apt_multipart_content_assign(const apt_str_t *body, const apt_str_t *boundary, apr_pool_t *pool);
93 
94 /**
95  * Get the next content part
96  * @param multipart_content the multipart content to get the next content part from
97  * @param content_part the parsed content part
98  * @param is_final indicates the final boundary is reached
99  * @return TRUE on success
100  */
102 
103 
105 
106 #endif /* APT_MULTIPART_CONTENT_H */
apt_bool_t apt_multipart_content_add2(apt_multipart_content_t *multipart_content, const apt_str_t *content_type, const apt_str_t *content_id, const apt_str_t *body)
apt_str_t * type
Definition: apt_multipart_content.h:43
Definition: apt_multipart_content.h:36
#define APT_END_EXTERN_C
Definition: apt.h:38
apt_header_section_t header
Definition: apt_multipart_content.h:38
apt_multipart_content_t * apt_multipart_content_assign(const apt_str_t *body, const apt_str_t *boundary, apr_pool_t *pool)
int apt_bool_t
Definition: apt.h:57
apt_str_t body
Definition: apt_multipart_content.h:40
apt_bool_t apt_multipart_content_add(apt_multipart_content_t *multipart_content, const apt_content_part_t *content_part)
typedefAPT_BEGIN_EXTERN_C struct apt_multipart_content_t apt_multipart_content_t
Definition: apt_multipart_content.h:30
#define APT_BEGIN_EXTERN_C
Definition: apt.h:36
#define APT_DECLARE(type)
Definition: apt.h:53
Definition: apt_header_field.h:58
Definition: apt_string.h:36
apt_bool_t apt_multipart_content_get(apt_multipart_content_t *multipart_content, apt_content_part_t *content_part, apt_bool_t *is_final)
apt_str_t * length
Definition: apt_multipart_content.h:47
apt_multipart_content_t * apt_multipart_content_create(apr_size_t max_content_size, const apt_str_t *boundary, apr_pool_t *pool)
Header Field Declaration (RFC5322)
apt_str_t * apt_multipart_content_finalize(apt_multipart_content_t *multipart_content)
apt_str_t * id
Definition: apt_multipart_content.h:45