# # add_file "WhyThisWay" # # add_file "netxx_pipe.cc" # # add_file "netxx_pipe.hh" # # patch "WhyThisWay" # from [] # to [a06584df677024f251abc89365d3c18b1b8ef418] # # patch "netxx_pipe.cc" # from [] # to [d34d5a637aa3e2a1036637db2ddd8e99fe7c8822] # # patch "netxx_pipe.hh" # from [] # to [d34d5a637aa3e2a1036637db2ddd8e99fe7c8822] # =============================================== --- WhyThisWay +++ WhyThisWay a06584df677024f251abc89365d3c18b1b8ef418 @@ -0,0 +1,6 @@ +Netxx::Socket's read and write methods are not virtual +Netxx::Socket calls WSASetup on Windows unconditionally. This is not needed +for pipes. So a Pipe is not a Socket ... + +Trying to derive from StreamBase ... +... should be possible if we modify the Probe(Info) code =============================================== --- netxx_pipe.cc +++ netxx_pipe.cc d34d5a637aa3e2a1036637db2ddd8e99fe7c8822 @@ -0,0 +1,24 @@ +// -*- mode: C++; c-file-style: "gnu"; indent-tabs-mode: nil -*- +// copyright (C) 2005 Christof Petig +// all rights reserved. +// licensed to the public under the terms of the GNU GPL (>= 2) +// see the file COPYING for details + +#include + +namespace Netxx { + +class PipeStream : public StreamBase { + int readfd, writefd; +public: + explicit PipeStream (int readfd, int writefd); +// explicit PipeStream (const std::string &cmd, const std::vector &args); + virtual signed_size_type read (void *buffer, size_type length); + virtual signed_size_type write (const void *buffer, size_type length); + virtual void close (void); + virtual socket_type get_socketfd (void) const; + virtual const ProbeInfo* get_probe_info (void) const; + int get_readfd(void) const { return readfd; } + int get_writefd(void) const { return writefd; } +}; +} =============================================== --- netxx_pipe.hh +++ netxx_pipe.hh d34d5a637aa3e2a1036637db2ddd8e99fe7c8822 @@ -0,0 +1,24 @@ +// -*- mode: C++; c-file-style: "gnu"; indent-tabs-mode: nil -*- +// copyright (C) 2005 Christof Petig +// all rights reserved. +// licensed to the public under the terms of the GNU GPL (>= 2) +// see the file COPYING for details + +#include + +namespace Netxx { + +class PipeStream : public StreamBase { + int readfd, writefd; +public: + explicit PipeStream (int readfd, int writefd); +// explicit PipeStream (const std::string &cmd, const std::vector &args); + virtual signed_size_type read (void *buffer, size_type length); + virtual signed_size_type write (const void *buffer, size_type length); + virtual void close (void); + virtual socket_type get_socketfd (void) const; + virtual const ProbeInfo* get_probe_info (void) const; + int get_readfd(void) const { return readfd; } + int get_writefd(void) const { return writefd; } +}; +}