Botan  1.10.9
basefilt.h
Go to the documentation of this file.
1 /*
2 * Basic Filters
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_BASEFILT_H__
9 #define BOTAN_BASEFILT_H__
10 
11 #include <botan/filter.h>
12 
13 namespace Botan {
14 
15 /**
16 * BitBucket is a filter which simply discards all inputs
17 */
18 struct BOTAN_DLL BitBucket : public Filter
19  {
20  void write(const byte[], size_t) {}
21 
22  std::string name() const { return "BitBucket"; }
23  };
24 
25 /**
26 * This class represents Filter chains. A Filter chain is an ordered
27 * concatenation of Filters, the input to a Chain sequentially passes
28 * through all the Filters contained in the Chain.
29 */
30 
31 class BOTAN_DLL Chain : public Fanout_Filter
32  {
33  public:
34  void write(const byte input[], size_t length) { send(input, length); }
35 
36  std::string name() const;
37 
38  /**
39  * Construct a chain of up to four filters. The filters are set
40  * up in the same order as the arguments.
41  */
42  Chain(Filter* = 0, Filter* = 0, Filter* = 0, Filter* = 0);
43 
44  /**
45  * Construct a chain from range of filters
46  * @param filter_arr the list of filters
47  * @param length how many filters
48  */
49  Chain(Filter* filter_arr[], size_t length);
50  };
51 
52 /**
53 * This class represents a fork filter, whose purpose is to fork the
54 * flow of data. It causes an input message to result in n messages at
55 * the end of the filter, where n is the number of forks.
56 */
57 class BOTAN_DLL Fork : public Fanout_Filter
58  {
59  public:
60  void write(const byte input[], size_t length) { send(input, length); }
61  void set_port(size_t n) { Fanout_Filter::set_port(n); }
62 
63  std::string name() const;
64 
65  /**
66  * Construct a Fork filter with up to four forks.
67  */
68  Fork(Filter*, Filter*, Filter* = 0, Filter* = 0);
69 
70  /**
71  * Construct a Fork from range of filters
72  * @param filter_arr the list of filters
73  * @param length how many filters
74  */
75  Fork(Filter* filter_arr[], size_t length);
76  };
77 
78 }
79 
80 #endif
void set_port(size_t n)
Definition: filter.h:142
std::string name() const
Definition: basefilt.h:22
BigInt n
Definition: numthry.cpp:26
void write(const byte input[], size_t length)
Definition: basefilt.h:34
unsigned char byte
Definition: types.h:22
void write(const byte[], size_t)
Definition: basefilt.h:20
void set_port(size_t n)
Definition: basefilt.h:61
void write(const byte input[], size_t length)
Definition: basefilt.h:60