PROTON-883: Wrap pn_transport_peek for Ruby. Returns an array consisting of the number of bytes returned an a String packed with the bytes in the buffer.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/585b306b Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/585b306b Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/585b306b Branch: refs/heads/cjansen-cpp-client Commit: 585b306bd22f500cdfc268c759ed2b9c7738940e Parents: ff159e8 Author: Darryl L. Pierce <[email protected]> Authored: Mon May 11 10:01:46 2015 -0400 Committer: Darryl L. Pierce <[email protected]> Committed: Tue May 19 08:06:49 2015 -0400 ---------------------------------------------------------------------- proton-c/bindings/ruby/ruby.i | 14 ++++++++++++++ 1 file changed, 14 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/585b306b/proton-c/bindings/ruby/ruby.i ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/ruby.i b/proton-c/bindings/ruby/ruby.i index e0ffb17..7380068 100644 --- a/proton-c/bindings/ruby/ruby.i +++ b/proton-c/bindings/ruby/ruby.i @@ -273,6 +273,20 @@ ssize_t pn_transport_input(pn_transport_t *transport, char *STRING, size_t LENGT %} %ignore pn_transport_output; +%rename(pn_transport_peek) wrap_pn_transport_peek; +%inline %{ + int wrap_pn_transport_peek(pn_transport_t *transport, char *OUTPUT, size_t *OUTPUT_SIZE) { + ssize_t sz = pn_transport_peek(transport, OUTPUT, OUTPUT_SIZE); + if(sz >= 0) { + *OUTPUT_SIZE = sz; + } else { + *OUTPUT_SIZE = 0; + } + return sz; + } +%} +%ignore pn_transport_peek; + %rename(pn_delivery) wrap_pn_delivery; %inline %{ pn_delivery_t *wrap_pn_delivery(pn_link_t *link, char *STRING, size_t LENGTH) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
