UniMRCP  1.3.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
apt_text_message.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_text_message.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
17  */
18 
19 #ifndef APT_TEXT_MESSAGE_H
20 #define APT_TEXT_MESSAGE_H
21 
22 /**
23  * @file apt_text_message.h
24  * @brief Text Message Interface (RFC5322)
25  */
26 
27 #include "apt_header_field.h"
28 #include "apt_text_stream.h"
29 
31 
32 /** Status of text message processing (parsing/generation) */
33 typedef enum {
34  APT_MESSAGE_STATUS_COMPLETE,
35  APT_MESSAGE_STATUS_INCOMPLETE,
36  APT_MESSAGE_STATUS_INVALID
38 
39 
40 /** Opaque text message parser */
42 /** Vtable of text message parser */
44 
45 /** Opaque text message generator */
47 /** Vtable of text message generator */
49 
50 /** Temporary context associated with message and used for its parsing or generation */
52 
53 /** Create message parser */
55 
56 /** Parse message by raising corresponding event handlers */
58 
59 /** Get external object associated with parser */
61 
62 /** Set verbose mode for the parser */
64 
65 
66 /** Create message generator */
68 
69 /** Generate message */
71 
72 /** Get external object associated with generator */
74 
75 /** Set verbose mode for the parser */
77 
78 
79 /** Parse individual header field (name-value pair) */
81 
82 /** Generate individual header field (name-value pair) */
84 
85 /** Parse header section */
87 
88 /** Generate header section */
90 
91 
92 /** Temporary context associated with message and used for its parsing or generation */
94  /** Context or ptotocol specific message */
95  void *message;
96  /** Header section of the message */
98  /** Body or content of the message */
100 };
101 
102 /** Vtable of text message parser */
104  /** Start new message parsing by associating corresponding context and reading its start-line if applicable */
105  apt_bool_t (*on_start)(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool);
106  /** Header section handler is invoked when entire header section has been read and parsed into header fields */
108  /** Body handler is invoked when entire body has been read */
110 };
111 
112 /** Vtable of text message generator */
114  /** Start message generation by associating corresponding context and generating message start-line if applicable */
116  /** Header section handler is invoked to notify header section has been generated */
118  /** Body handler is invoked to notify body has been generated */
120 };
121 
122 
124 
125 #endif /* APT_TEXT_MESSAGE_H */