UniMRCP
1.2.0
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
libs
apr-toolkit
include
apt_multipart_content.h
Go to the documentation of this file.
1
/*
2
* Copyright 2008-2014 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
* $Id: apt_multipart_content.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
17
*/
18
19
#ifndef APT_MULTIPART_CONTENT_H
20
#define APT_MULTIPART_CONTENT_H
21
22
/**
23
* @file apt_multipart_content.h
24
* @brief Multipart Content Routine
25
*/
26
27
#include "
apt_header_field.h
"
28
29
APT_BEGIN_EXTERN_C
30
31
/** Opaque multipart content declaration */
32
typedef
struct
apt_multipart_content_t
apt_multipart_content_t
;
33
34
/** Content part declaration */
35
typedef
struct
apt_content_part_t
apt_content_part_t
;
36
37
/** Content part */
38
struct
apt_content_part_t
{
39
/** Header section */
40
apt_header_section_t
header
;
41
/** Body */
42
apt_str_t
body
;
43
44
/** Pointer to parsed content-type header field */
45
apt_str_t
*
type
;
46
/** Pointer to parsed content-id header field */
47
apt_str_t
*
id
;
48
/** Pointer to parsed content-length header field */
49
apt_str_t
*
length
;
50
};
51
52
/**
53
* Create an empty multipart content
54
* @param max_content_size the max size of the content (body)
55
* @param boundary the boundary to separate content parts
56
* @param pool the pool to allocate memory from
57
* @return an empty multipart content
58
*/
59
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);
60
61
/**
62
* Add content part to multipart content
63
* @param multipart_content the multipart content to add content part to
64
* @param content_part the content part to add
65
* @return TRUE on success
66
*/
67
APT_DECLARE
(
apt_bool_t
)
apt_multipart_content_add
(
apt_multipart_content_t
*multipart_content, const
apt_content_part_t
*content_part);
68
69
/**
70
* Add content part to multipart content by specified header fields and body
71
* @param multipart_content the multipart content to add content part to
72
* @param content_type the type of content part
73
* @param content_id the identifier of content part
74
* @param body the body of content part
75
* @return TRUE on success
76
*/
77
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);
78
79
/**
80
* Finalize multipart content generation
81
* @param multipart_content the multipart content to finalize
82
* @return generated multipart content
83
*/
84
APT_DECLARE
(
apt_str_t
*)
apt_multipart_content_finalize
(
apt_multipart_content_t
*multipart_content);
85
86
87
/**
88
* Assign body to multipart content to get (parse) each content part from
89
* @param body the body of multipart content to parse
90
* @param boundary the boundary to separate content parts
91
* @param pool the pool to allocate memory from
92
* @return multipart content with assigned body
93
*/
94
APT_DECLARE
(
apt_multipart_content_t
*)
apt_multipart_content_assign
(const
apt_str_t
*body, const
apt_str_t
*boundary, apr_pool_t *pool);
95
96
/**
97
* Get the next content part
98
* @param multipart_content the multipart content to get the next content part from
99
* @param content_part the parsed content part
100
* @param is_final indicates the final boundary is reached
101
* @return TRUE on success
102
*/
103
APT_DECLARE
(
apt_bool_t
)
apt_multipart_content_get
(
apt_multipart_content_t
*multipart_content,
apt_content_part_t
*content_part,
apt_bool_t
*is_final);
104
105
106
APT_END_EXTERN_C
107
108
#endif
/* APT_MULTIPART_CONTENT_H */
Generated on Sun Jul 6 2014 22:12:45 for UniMRCP by
1.8.3.1