Qore DataStreamUtil Module Reference  1.1
 All Namespaces Functions Variables Groups Pages
DataStreamUtil.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
2 // @file DataStreamUtil.qm Qore user module implementing support for the DataStream protocol: YAML-encoded HTTP chunked transfers where each chunk is a unique data entity
3 
4 /* DataStreamUtil.qm Copyright (C) 2014 - 2017 Qore Technologies, s.r.o.
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23 */
24 
25 // this module requires Qore 0.8.123or better
26 
27 // require type definitions everywhere
28 
29 // enable all warnings
30 
31 
32 
33 
34 // do not use $ signs in declarations
35 
36 
37 /* Version History: see docs below
38 */
39 
305 namespace DataStreamUtil {
308 
311  const DataStreamContentType = "DataStream-Content-Type";
313 
315  const DataStreamContentEncoding = "DataStream-Content-Encoding";
316 
318  const DataStreamAccept = "DataStream-Accept";
319 
321  const DataStreamAcceptEncoding = "DataStream-Accept-Encoding";
322 
324  const DataStreamError = "DataStream-Error";
325 
328  "gzip": True,
329  "bzip2": True,
330  "deflate": True,
331  "identity": True,
332  );
334 
335  const DataStreamDeserializeYaml = (
336  "code": "yaml",
337  "in": \parse_yaml(),
338  );
339 
340  const DataStreamDeserializeXmlRpc = (
341  "code": "xml",
342  "in": \parse_xmlrpc_value(),
343  );
344 
345  const DataStreamDeserializationSupport = (
346  MimeTypeYamlRpc: DataStreamDeserializeYaml,
347  MimeTypeYaml: DataStreamDeserializeYaml,
348  MimeTypeJson: (
349  "code": "json",
350  "in": \parseJSON(),
351  ),
352  MimeTypeXml: DataStreamDeserializeXmlRpc,
353  MimeTypeXmlApp: DataStreamDeserializeXmlRpc,
354  );
355 
357 
374  *code ds_get_content_decode(*string ce);
375 
376 
378 
393  *code ds_get_content_encode(*string ce);
394 
395 
397 
413  code ds_get_send(code scb, *code enc_func);
414 
415 
417 
434  code ds_get_recv(code rcb, code ecb, *code bcb);
435 
436 
438 
455  nothing ds_set_chunked_headers(reference<hash> hdr, *string content_encoding, *softbool req);
456 
457 
459 
473  nothing ds_set_non_chunked_headers(reference<hash> hdr, *string content_encoding, *softbool req);
474 
475 
477 
486  string ds_get_ds_accept_enc_header(*string ae);
487 
488 };
489 
490 // private namespace for non-exported definitions
491 namespace DataStreamUtilPrivate {
492  // private function
493  ds_do_request_headers(reference<hash> hdr);
494 
495 };
string ds_get_ds_accept_enc_header(*string ae)
returns the &quot;DataStream-Accept-Encoding&quot; header value corresponding to the &quot;Accept-Encoding&quot; header p...
const DataStreamAcceptEncoding
HTTP header for the data stream Accept-Encoding header equivalent where each HTTP chunk is encoded/de...
Definition: DataStreamUtil.qm.dox.h:321
*code ds_get_content_encode(*string ce)
returns a call reference (or nothing) based on an optional &quot;Content-Encoding&quot; header value for encodi...
nothing ds_set_chunked_headers(reference< hash > hdr, *string content_encoding, *softbool req)
sets up HTTP headers for DataStream chunked data transfers
const DataStreamContentEncoding
HTTP header for the data stream Content-Encoding header equivalent where each HTTP chunk is encoded/d...
Definition: DataStreamUtil.qm.dox.h:315
const DataStreamContentType
HTTP header for the data stream Content-Type header equivalent where each HTTP chunk is encoded/decod...
Definition: DataStreamUtil.qm.dox.h:312
const DataStreamError
HTTP trailer to be sent after chunked data has been transferred in case of an error on the sending si...
Definition: DataStreamUtil.qm.dox.h:324
code ds_get_recv(code rcb, code ecb, *code bcb)
returns a call reference useful for receiving HTTP chunked data with Qore methods taking receive call...
const DataStreamContentEncodingHash
supported values for the DataStream-Accept-Encoding header
Definition: DataStreamUtil.qm.dox.h:327
nothing ds_set_non_chunked_headers(reference< hash > hdr, *string content_encoding, *softbool req)
sets up HTTP headers for DataStream non-chunked data transfers
*code ds_get_content_decode(*string ce)
returns a call reference (or nothing) based on an optional &quot;Content-Encoding&quot; header value for decodi...
code ds_get_send(code scb, *code enc_func)
returns a call reference useful for sending HTTP chunked data with Qore methods taking send callbacks...
const DataStreamAccept
HTTP header for the data stream Accept header equivalent where each HTTP chunk is encoded/decoded sep...
Definition: DataStreamUtil.qm.dox.h:318