Botan 1.10.17

basefilt.cpp
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 #include <botan/basefilt.h>
9 #include <botan/key_filt.h>
10
11 namespace Botan {
12
13 void Keyed_Filter::set_iv(const InitializationVector& iv)
14 {
15 if(iv.length() != 0)
16 throw Invalid_IV_Length(name(), iv.length());
17 }
18
19 /*
20 * Chain Constructor
21 */
22 Chain::Chain(Filter* f1, Filter* f2, Filter* f3, Filter* f4)
23 {
24 if(f1) { attach(f1); incr_owns(); }
25 if(f2) { attach(f2); incr_owns(); }
26 if(f3) { attach(f3); incr_owns(); }
27 if(f4) { attach(f4); incr_owns(); }
28 }
29
30 /*
31 * Chain Constructor
32 */
33 Chain::Chain(Filter* filters[], size_t count)
34 {
35 for(size_t j = 0; j != count; ++j)
36 if(filters[j])
37 {
38 attach(filters[j]);
39 incr_owns();
40 }
41 }
42
43 std::string Chain::name() const
44 {
45 return "Chain";
46 }
47
48 /*
49 * Fork Constructor
50 */
51 Fork::Fork(Filter* f1, Filter* f2, Filter* f3, Filter* f4)
52 {
53 Filter* filters[4] = { f1, f2, f3, f4 };
54 set_next(filters, 4);
55 }
56
57 /*
58 * Fork Constructor
59 */
60 Fork::Fork(Filter* filters[], size_t count)
61 {
62 set_next(filters, count);
63 }
64
65 std::string Fork::name() const
66 {
67 return "Fork";
68 }
69
70 }
Botan::OctetString
Definition: symkey.h:19
Botan::Fanout_Filter::attach
void attach(Filter *f)
Definition: filter.h:146
Botan::Fork::Fork
Fork(Filter *, Filter *, Filter *=0, Filter *=0)
Definition: basefilt.cpp:51
Botan::Fanout_Filter::set_next
void set_next(Filter *f[], size_t n)
Definition: filter.h:144
Botan::Keyed_Filter::set_iv
virtual void set_iv(const InitializationVector &iv)
Definition: basefilt.cpp:13
Botan::Invalid_IV_Length
Definition: exceptn.h:78
Botan::Filter
Definition: filter.h:19
Botan::Chain::name
std::string name() const
Definition: basefilt.cpp:43
Botan::Fanout_Filter::incr_owns
void incr_owns()
Definition: filter.h:140
Botan::Fork::name
std::string name() const
Definition: basefilt.cpp:65
Botan
Definition: algo_base.h:14
Botan::OctetString::length
size_t length() const
Definition: symkey.h:25
Botan::Filter::name
virtual std::string name() const =0
Botan::Chain::Chain
Chain(Filter *=0, Filter *=0, Filter *=0, Filter *=0)
Definition: basefilt.cpp:22