/usr/include/modglue/pipe.hh is in libmodglue1-dev 1.17-2.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | /*
$Id: pipe.hh,v 1.16 2006/03/10 14:23:23 kp229 Exp $
Pipe class (generalises Unix standard pipes and the pipe() call)
Copyright (C) 2001-2009 Kasper Peeters <kasper.peeters@aei.mpg.de>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef pipe_hh_
#define pipe_hh_
#include <cstdio>
#include <string>
#include <string.h>
#include <sigc++/sigc++.h>
#include <iostream>
namespace modglue {
class pipebuf;
class ext_process;
class pipe {
public:
virtual ~pipe();
std::string name(void) const;
int fd(void) const;
int fd_external(void) const;
bool is_broken(void) const; // ie. is the other end closed?
void open(int fd=-1, int fd_external=-1);
void set_unix_style(void);
void set_blocking();
void close(void);
void close_external(void);
void first_read_after_select();
void send_with_ack(const char *, int length);
int read_with_ack(char *, int maxlen);
ext_process *process;
protected:
pipe(const std::string& name);
virtual void do_fcntl_(void) const=0;
int read_nonblocking_(char *data, int maxlen); // returns as 'read'
int send_blocking_(const char *data, int len); // returns as 'write'
int fd_, fd_external_;
bool broken_;
bool first_read_after_select_;
bool unix_style_pipe_; // uni-directional, no acknowledgement
bool make_blocking_;
private:
std::string name_;
};
class pipebuf : public std::streambuf {
public:
pipebuf(pipe *);
~pipebuf();
void put_buffer(void);
void put_char(int);
protected:
int overflow(int=EOF);
int underflow();
int sync();
int flushbuffer(void);
private:
pipe *pipe_;
static const int bufsiz = 1024;
static const int putbackarea = 8;
char i_buf[bufsiz]; // input buffer;
char o_buf[bufsiz]; // output buffer
};
class opipe : public pipe, public std::ostream {
public:
opipe(const std::string& name);
private:
virtual void do_fcntl_(void) const;
};
class ipipe : /* public sigc::object, */ public pipe, public std::istream {
public:
ipipe(const std::string& name);
sigc::signal1<bool, ipipe&> receiver;
private:
virtual void do_fcntl_(void) const;
};
// sockets are always bidirectional... How is this going to fit in?
//class server_isocket : public ipipe {
// public:
//};
//
//class server_osocket : public ipipe {
// public:
//};
//
//class client_isocket : public ipipe {
// public:
//};
//
//class client_osocket : public opipe {
// public:
//};
};
#endif
|