Qore DataStreamUtil Module Reference  1.1
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 - 2019 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 DataStreamDeserializeXml = (
341  "code": "xml",
342  "in": hash<auto> (string xml) {
343  try {
344  return parse_xmlrpc_value(xml);
345  } catch ();
346 
347  },
348  );
349 
350  const DataStreamDeserializationSupport = (
351  MimeTypeYamlRpc: DataStreamDeserializeYaml,
352  MimeTypeYaml: DataStreamDeserializeYaml,
353  MimeTypeJson: (
354  "code": "json",
355  "in": \parseJSON(),
356  ),
357  MimeTypeXml: DataStreamDeserializeXml,
358  MimeTypeXmlApp: DataStreamDeserializeXml,
359  );
360 
362 
379  *code ds_get_content_decode(*string ce);
380 
381 
383 
398  *code ds_get_content_encode(*string ce);
399 
400 
402 
418  code ds_get_send(code scb, *code enc_func);
419 
420 
422 
439  code ds_get_recv(code rcb, code ecb, *code bcb);
440 
441 
443 
460  nothing ds_set_chunked_headers(reference<hash<auto>> hdr, *string content_encoding, *softbool req);
461 
462 
464 
478  nothing ds_set_non_chunked_headers(reference<hash<auto>> hdr, *string content_encoding, *softbool req);
479 
480 
482 
491  string ds_get_ds_accept_enc_header(*string ae);
492 
493 }
494 
495 // private namespace for non-exported definitions
496 namespace DataStreamUtilPrivate {
497  // private function
498  ds_do_request_headers(reference<hash<auto>> hdr);
499 
500 }
DataStreamUtil::DataStreamAccept
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
DataStreamUtil::DataStreamError
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
DataStreamUtil::ds_get_content_encode
*code ds_get_content_encode(*string ce)
returns a call reference (or nothing) based on an optional "Content-Encoding" header value for encodi...
DataStreamUtil::ds_get_send
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...
DataStreamUtil::ds_set_non_chunked_headers
nothing ds_set_non_chunked_headers(reference< hash< auto >> hdr, *string content_encoding, *softbool req)
sets up HTTP headers for DataStream non-chunked data transfers
DataStreamUtil::DataStreamContentType
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
DataStreamUtil::DataStreamContentEncodingHash
const DataStreamContentEncodingHash
supported values for the DataStream-Accept-Encoding header
Definition: DataStreamUtil.qm.dox.h:327
DataStreamUtil
the DataStreamUtil namespace contains all the public objects in the DataStreamUtil module
Definition: DataStreamUtil.qm.dox.h:306
DataStreamUtil::ds_set_chunked_headers
nothing ds_set_chunked_headers(reference< hash< auto >> hdr, *string content_encoding, *softbool req)
sets up HTTP headers for DataStream chunked data transfers
DataStreamUtil::DataStreamAcceptEncoding
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
DataStreamUtil::ds_get_ds_accept_enc_header
string ds_get_ds_accept_enc_header(*string ae)
returns the "DataStream-Accept-Encoding" header value corresponding to the "Accept-Encoding" header p...
DataStreamUtil::ds_get_recv
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...
DataStreamUtil::ds_get_content_decode
*code ds_get_content_decode(*string ce)
returns a call reference (or nothing) based on an optional "Content-Encoding" header value for decodi...
DataStreamUtil::DataStreamContentEncoding
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