monotone

monotone Mtn Source Tree

Root/botan/pipe.h

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

Archive Download this file

Branches

Tags

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