monotone

monotone Mtn Source Tree

Root/botan/pipe.h

1/*************************************************
2* Pipe Header File *
3* (C) 1999-2007 The Botan Project *
4*************************************************/
5
6#ifndef BOTAN_PIPE_H__
7#define BOTAN_PIPE_H__
8
9#include <botan/data_src.h>
10#include <botan/filter.h>
11#include <iosfwd>
12
13namespace Botan {
14
15/*************************************************
16* Pipe *
17*************************************************/
18class Pipe : public DataSource
19 {
20 public:
21 static const u32bit LAST_MESSAGE, DEFAULT_MESSAGE;
22
23 void write(const byte[], u32bit);
24 void write(const MemoryRegion<byte>&);
25 void write(const std::string&);
26 void write(DataSource&);
27 void write(byte);
28
29 void process_msg(const byte[], u32bit);
30 void process_msg(const MemoryRegion<byte>&);
31 void process_msg(const std::string&);
32 void process_msg(DataSource&);
33
34 u32bit remaining(u32bit = DEFAULT_MESSAGE) const;
35
36 u32bit read(byte[], u32bit);
37 u32bit read(byte[], u32bit, u32bit);
38 u32bit read(byte&, u32bit = DEFAULT_MESSAGE);
39
40 SecureVector<byte> read_all(u32bit = DEFAULT_MESSAGE);
41 std::string read_all_as_string(u32bit = DEFAULT_MESSAGE);
42
43 u32bit peek(byte[], u32bit, u32bit) const;
44 u32bit peek(byte[], u32bit, u32bit, u32bit) const;
45 u32bit peek(byte&, u32bit, u32bit = DEFAULT_MESSAGE) const;
46
47 u32bit default_msg() const { return default_read; }
48 void set_default_msg(u32bit);
49 u32bit message_count() const;
50 bool end_of_data() const;
51
52 void start_msg();
53 void end_msg();
54
55 void prepend(Filter*);
56 void append(Filter*);
57 void pop();
58 void reset();
59
60 Pipe(Filter* = 0, Filter* = 0, Filter* = 0, Filter* = 0);
61 Pipe(Filter*[], u32bit);
62 ~Pipe();
63 private:
64 Pipe(const Pipe&) : DataSource() {}
65 Pipe& operator=(const Pipe&) { return (*this); }
66 void init();
67 void destruct(Filter*);
68 void find_endpoints(Filter*);
69 void clear_endpoints(Filter*);
70
71 u32bit get_message_no(const std::string&, u32bit) const;
72
73 Filter* pipe;
74 class Output_Buffers* outputs;
75 u32bit default_read;
76 bool inside_msg;
77 };
78
79/*************************************************
80* I/O Operators for Pipe *
81*************************************************/
82std::ostream& operator<<(std::ostream&, Pipe&);
83std::istream& operator>>(std::istream&, Pipe&);
84
85}
86
87#endif
88
89#if defined(BOTAN_EXT_PIPE_UNIXFD_IO)
90 #include <botan/fd_unix.h>
91#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status