Qore DataStreamUtil Module Reference  1.0
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 - 2015 Qore Technologies, sro
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.12 or 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 
299 namespace DataStreamUtil {
302 
305  const DataStreamContentType = "DataStream-Content-Type";
307 
309  const DataStreamContentEncoding = "DataStream-Content-Encoding";
310 
312  const DataStreamAccept = "DataStream-Accept";
313 
315  const DataStreamAcceptEncoding = "DataStream-Accept-Encoding";
316 
318  const DataStreamError = "DataStream-Error";
319 
322  "gzip": True,
323  "bzip2": True,
324  "deflate": True,
325  "identity": True,
326  );
328 
329  const DataStreamDeserializeYaml = (
330  "code": "yaml",
331  "in": \parse_yaml(),
332  );
333 
334  const DataStreamDeserializeXmlRpc = (
335  "code": "xml",
336  "in": \parse_xmlrpc_value(),
337  );
338 
339  const DataStreamDeserializationSupport = (
340  MimeTypeYamlRpc: DataStreamDeserializeYaml,
341  MimeTypeYaml: DataStreamDeserializeYaml,
342  MimeTypeJson: (
343  "code": "json",
344  "in": \parseJSON(),
345  ),
346  MimeTypeXml: DataStreamDeserializeXmlRpc,
347  MimeTypeXmlApp: DataStreamDeserializeXmlRpc,
348  );
349 
351 
368  *code ds_get_content_decode(*string ce);
369 
370 
372 
387  *code ds_get_content_encode(*string ce);
388 
389 
391 
407  code ds_get_send(code scb, *code enc_func);
408 
409 
411 
428  code ds_get_recv(code rcb, code ecb, *code bcb);
429 
430 
432 
449  nothing ds_set_chunked_headers(reference hdr, *string content_encoding, *softbool req);
450 
451 
453 
467  nothing ds_set_non_chunked_headers(reference hdr, *string content_encoding, *softbool req);
468 
469 
471 
480  string ds_get_ds_accept_enc_header(*string ae);
481 
482 };
483 
484 // private namespace for non-exported definitions
485 namespace DataStreamUtilPrivate {
486  // private function
487  ds_do_request_headers(reference hdr);
488 
489 };
string ds_get_ds_accept_enc_header(*string ae)
returns the "DataStream-Accept-Encoding" header value corresponding to the "Accept-Encoding" 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:315
*code ds_get_content_encode(*string ce)
returns a call reference (or nothing) based on an optional "Content-Encoding" header value for encodi...
Definition: DataStreamUtil.qm.dox.h:485
const DataStreamContentEncoding
HTTP header for the data stream Content-Encoding header equivalent where each HTTP chunk is encoded/d...
Definition: DataStreamUtil.qm.dox.h:309
const DataStreamContentType
HTTP header for the data stream Content-Type header equivalent where each HTTP chunk is encoded/decod...
Definition: DataStreamUtil.qm.dox.h:306
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:318
nothing ds_set_non_chunked_headers(reference hdr, *string content_encoding, *softbool req)
sets up HTTP headers for DataStream non-chunked data transfers
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...
the DataStreamUtil namespace contains all the public objects in the DataStreamUtil module ...
Definition: DataStreamUtil.qm.dox.h:300
const DataStreamContentEncodingHash
supported values for the DataStream-Accept-Encoding header
Definition: DataStreamUtil.qm.dox.h:321
nothing ds_set_chunked_headers(reference hdr, *string content_encoding, *softbool req)
sets up HTTP headers for DataStream chunked data transfers
*code ds_get_content_decode(*string ce)
returns a call reference (or nothing) based on an optional "Content-Encoding" 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:312