~francis-aspl/vortexlibrary/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
/* 
 *  LibVortex:  A BEEP (RFC3080/RFC3081) implementation.
 *  Copyright (C) 2020 Advanced Software Production Line, S.L.
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public License
 *  as published by the Free Software Foundation; either version 2.1
 *  of the License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this program; if not, write to the Free
 *  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 *  02111-1307 USA
 *  
 *  You may find a copy of the license under this software is released
 *  at COPYING file. This is LGPL software: you are welcome to develop
 *  proprietary applications using this library without any royalty or
 *  fee but returning back any change, improvement or addition in the
 *  form of source code, project image, documentation patches, etc.
 *
 *  For commercial support on build BEEP enabled solutions contact us:
 *          
 *      Postal address:
 *         Advanced Software Production Line, S.L.
 *         C/ Antonio Suarez Nº 10, 
 *         Edificio Alius A, Despacho 102
 *         Alcalá de Henares 28802 (Madrid)
 *         Spain
 *
 *      Email address:
 *         info@aspl.es - http://www.aspl.es/vortex
 */
#ifndef __VORTEX_FRAME_FACTORY_H__
#define __VORTEX_FRAME_FACTORY_H__

#include <vortex.h>

/**
 * \addtogroup vortex_frame
 * @{
 */

char  *        vortex_frame_build_up_from_params (VortexFrameType   type,
						  int               channel,
						  int               msgno,
						  axl_bool          more,
						  unsigned int      seqno,
						  int               size,
						  int               ansno,
						  const void      * payload);

char  *        vortex_frame_build_up_from_params_s (VortexFrameType   type,
						    int               channel,
						    int               msgno,
						    axl_bool          more,
						    unsigned int      seqno,
						    int               size,
						    int               ansno,
						    const char   *    content_type,
						    const char   *    transfer_encoding,
						    const void   *    payload,
						    int    *          frame_size);

char  * vortex_frame_build_up_from_params_s_buffer (VortexFrameType   type,
 						    int               channel,
 						    int               msgno,
 						    axl_bool          more,
 						    unsigned int      seqno,
 						    int               size,
 						    int               ansno,
 						    const char   *    content_type,
 						    const char   *    transfer_encoding,
 						    const void   *    payload,
 						    int    *          frame_size,
 						    char         *    buffer,
 						    int               buffer_size);

char  *        vortex_frame_seq_build_up_from_params (int           channel_num,
						      unsigned int  ackno,
						      int           window_size);

char  * vortex_frame_seq_build_up_from_params_buffer (int    channel_num,
 						      int    ackno,
 						      int    window_size, 
 						      char * buffer,
 						      int    buffer_size,
 						      int  * result_size);
 

VortexFrame * vortex_frame_create               (VortexCtx       * ctx,
						 VortexFrameType   type,
						 int               channel,
						 int               msgno,
						 axl_bool          more,
						 unsigned int      seqno,
						 int               size,
						 int               ansno,
						 const void      * payload);

VortexFrame * vortex_frame_create_full          (VortexCtx       * ctx,
						 VortexFrameType   type,
						 int               channel,
						 int               msgno,
						 axl_bool          more,
						 unsigned int      seqno,
						 int               size,
						 int               ansno,
						 const char      * content_type,
						 const char      * transfer_encoding,
						 const void      * payload);

VortexFrame * vortex_frame_create_full_ref      (VortexCtx       * ctx,
						 VortexFrameType   type,
						 int               channel,
						 int               msgno,
						 axl_bool          more,
						 unsigned int      seqno,
						 int               size,
						 int               ansno,
						 const char      * content_type,
						 const char      * transfer_encoding,
						 void            * payload);

VortexFrame * vortex_frame_copy                 (VortexFrame      * frame);

char  *       vortex_frame_get_raw_frame         (VortexFrame * frame);

VortexFrame * vortex_frame_get_next              (VortexConnection * connection);

axl_bool      vortex_frame_send_raw              (VortexConnection * connection, 
						  const char       * a_frame, 
						  int                frame_size);

int           vortex_frame_receive_raw           (VortexConnection * connection, 
						  char  * buffer, int  maxlen);

int           vortex_frame_readline              (VortexConnection * connection, 
						  char             * buffer, 
						  int                maxlen);

axl_bool      vortex_frame_ref                   (VortexFrame * frame);

void          vortex_frame_unref                 (VortexFrame * frame);

int           vortex_frame_ref_count             (VortexFrame * frame);

void          vortex_frame_free                  (VortexFrame * frame);

VortexFrame * vortex_frame_join                  (VortexFrame * a, 
						  VortexFrame * b);

VortexFrame * vortex_frame_join_extending       (VortexFrame * a, 
						 VortexFrame * b);

axl_bool      vortex_frame_are_joinable          (VortexFrame * a, 
						  VortexFrame * b);

axl_bool      vortex_frame_are_equal             (VortexFrame * a, 
						  VortexFrame * b);

int           vortex_frame_get_id                (VortexFrame * frame);

VortexFrameType vortex_frame_get_type            (VortexFrame * frame);

const char  * vortex_frame_get_content_type      (VortexFrame * frame);

const char  * vortex_frame_get_transfer_encoding (VortexFrame * frame);

int           vortex_frame_get_mime_header_size  (VortexFrame * frame);

int           vortex_frame_get_channel           (VortexFrame * frame);

VortexChannel * vortex_frame_get_channel_ref     (VortexFrame * frame);

void          vortex_frame_set_channel_ref       (VortexFrame * frame, 
						  VortexChannel * channel);

int           vortex_frame_get_msgno             (VortexFrame * frame);

axl_bool      vortex_frame_get_more_flag         (VortexFrame * frame);

unsigned int  vortex_frame_get_seqno             (VortexFrame * frame);

int           vortex_frame_get_ansno             (VortexFrame * frame);
  
const char * vortex_frame_get_ok_message         (void);
  
int           vortex_frame_get_payload_size      (VortexFrame * frame);

const void *  vortex_frame_get_payload           (VortexFrame * frame);

VortexCtx   * vortex_frame_get_ctx               (VortexFrame * frame);

int           vortex_frame_get_content_size      (VortexFrame * frame);
  
const char *  vortex_frame_get_content           (VortexFrame * frame);
 
char        * vortex_frame_get_error_message     (const char  * code, 
						  const char  * error_content,
						  const char  * xml_lang);

axl_bool      vortex_frame_is_error_message      (VortexFrame * frame,
						  char  ** code,
						  char  ** message);

char        * vortex_frame_get_start_message     (int              channel_num,
						  const char     * serverName, 
						  const char     * profile,  
						  VortexEncoding   encoding,
						  const char     * content_profile,
						  int              profile_content_size);

char        * vortex_frame_get_start_rpy_message (const char  * profile, 
						  const char  * profile_content);

char        * vortex_frame_get_close_message     (int           number,
						  const char  * code,
						  const char  * xml_lang,
						  const char  * close_content);

axl_bool      vortex_frame_is_mime_message       (VortexFrame * frame);

axl_bool      vortex_frame_mime_process          (VortexFrame * frame);

void          vortex_frame_set_mime_header       (VortexFrame * frame,
						  const char  * mime_header,
						  const char  * mime_header_content);

/** 
 * @brief Allows to get the content of the first MIME header found,
 * located by the header_name provided.
 *
 * This parameter only provides access to the first MIME header. In
 * the case you are accessing a MIME header that could be defined
 * several times, use \ref vortex_frame_get_mime_header combined with
 * \ref vortex_frame_mime_header_next.
 * 
 * @param frame The frame where the content of the first MIME header
 * will be returned.
 *
 * @param header_name The MIME header name to lookup. See \ref
 * vortex_frame_get_mime_header for recognized values.
 * 
 * @return A reference to the content of the MIME header or NULL if
 * nothing is found.
 */
#define VORTEX_FRAME_GET_MIME_HEADER(frame, header_name) ((vortex_frame_get_mime_header (frame, header_name)) ? vortex_frame_mime_header_content (vortex_frame_get_mime_header (frame, header_name)) : NULL)

VortexMimeHeader *  vortex_frame_get_mime_header       (VortexFrame * frame,
							const char  * mime_header);

const char       * vortex_frame_mime_header_name       (VortexMimeHeader * header);

const char       * vortex_frame_mime_header_content    (VortexMimeHeader * header);

VortexMimeHeader * vortex_frame_mime_header_next       (VortexMimeHeader * header);

int                vortex_frame_mime_header_count      (VortexMimeHeader * header);

axl_bool           vortex_frame_mime_status_is_available  (VortexFrame * frame);

/* @} */

#endif