Botan::Chain Class Reference

#include <basefilt.h>

Inheritance diagram for Botan::Chain:

Botan::Fanout_Filter Botan::Filter

List of all members.

Public Member Functions

virtual bool attachable ()
 Chain (Filter *filter_arr[], u32bit length)
 Chain (Filter *=0, Filter *=0, Filter *=0, Filter *=0)
virtual void end_msg ()
std::string name () const
virtual void start_msg ()
void write (const byte input[], u32bit length)

Protected Member Functions

void attach (Filter *f)
void incr_owns ()
void send (const MemoryRegion< byte > &in)
void send (byte in)
void send (const byte in[], u32bit length)
void set_next (Filter *f[], u32bit n)
void set_port (u32bit n)


Detailed Description

This class represents Filter chains. A Filter chain is an ordered concatenation of Filters, the input to a Chain sequentially passes through all the Filters contained in the Chain.

Definition at line 31 of file basefilt.h.


Constructor & Destructor Documentation

Botan::Chain::Chain ( Filter f1 = 0,
Filter f2 = 0,
Filter f3 = 0,
Filter f4 = 0 
)

Construct a chain of up to four filters. The filters are set up in the same order as the arguments.

Definition at line 22 of file basefilt.cpp.

References Botan::Fanout_Filter::attach(), and Botan::Fanout_Filter::incr_owns().

00023    {
00024    if(f1) { attach(f1); incr_owns(); }
00025    if(f2) { attach(f2); incr_owns(); }
00026    if(f3) { attach(f3); incr_owns(); }
00027    if(f4) { attach(f4); incr_owns(); }
00028    }

Botan::Chain::Chain ( Filter filter_arr[],
u32bit  length 
)

Construct a chain from range of filters

Parameters:
filter_arr the list of filters
length how many filters

Definition at line 33 of file basefilt.cpp.

References Botan::Fanout_Filter::attach(), and Botan::Fanout_Filter::incr_owns().

00034    {
00035    for(u32bit j = 0; j != count; ++j)
00036       if(filters[j])
00037          {
00038          attach(filters[j]);
00039          incr_owns();
00040          }
00041    }


Member Function Documentation

void Botan::Fanout_Filter::attach ( Filter f  )  [inline, protected, inherited]

Attach another filter to this one

Parameters:
f filter to attach

Reimplemented from Botan::Filter.

Definition at line 136 of file filter.h.

Referenced by Chain().

00136 { Filter::attach(f); }

virtual bool Botan::Filter::attachable (  )  [inline, virtual, inherited]

Check whether this filter is an attachable filter.

Returns:
true if this filter is attachable, false otherwise

Reimplemented in Botan::DataSink, and Botan::SecureQueue.

Definition at line 50 of file filter.h.

00050 { return true; }

virtual void Botan::Filter::end_msg (  )  [inline, virtual, inherited]

void Botan::Fanout_Filter::incr_owns (  )  [inline, protected, inherited]

Increment the number of filters past us that we own

Definition at line 130 of file filter.h.

Referenced by Chain().

00130 { ++filter_owns; }

std::string Botan::Chain::name (  )  const [virtual]

Returns:
descriptive name for this filter

Implements Botan::Filter.

Definition at line 43 of file basefilt.cpp.

00044    {
00045    return "Chain";
00046    }

void Botan::Filter::send ( const MemoryRegion< byte > &  in  )  [inline, protected, inherited]

Parameters:
in some input for the filter

Definition at line 68 of file filter.h.

References Botan::MemoryRegion< T >::begin(), Botan::Filter::send(), and Botan::MemoryRegion< T >::size().

Referenced by Botan::Filter::send().

00068 { send(in.begin(), in.size()); }

void Botan::Filter::send ( byte  in  )  [inline, protected, inherited]

Parameters:
in some input for the filter

Definition at line 63 of file filter.h.

References Botan::Filter::send().

Referenced by Botan::Filter::send().

00063 { send(&in, 1); }

void Botan::Filter::send ( const byte  in[],
u32bit  length 
) [protected, inherited]

Parameters:
in some input for the filter
length the length of in

Definition at line 28 of file filter.cpp.

References Botan::MemoryRegion< T >::append(), Botan::MemoryRegion< T >::destroy(), Botan::MemoryRegion< T >::size(), and Botan::Filter::write().

Referenced by Botan::Zlib_Decompression::end_msg(), Botan::Zlib_Compression::end_msg(), Botan::PK_Verifier_Filter::end_msg(), Botan::PK_Signer_Filter::end_msg(), Botan::PK_Decryptor_Filter::end_msg(), Botan::PK_Encryptor_Filter::end_msg(), Botan::Hex_Encoder::end_msg(), Botan::Bzip_Decompression::end_msg(), Botan::Bzip_Compression::end_msg(), Botan::Base64_Decoder::end_msg(), Botan::Base64_Encoder::end_msg(), Botan::MAC_Filter::end_msg(), Botan::Hash_Filter::end_msg(), Botan::Zlib_Compression::flush(), Botan::Bzip_Compression::flush(), Botan::Zlib_Decompression::write(), Botan::Zlib_Compression::write(), Botan::Bzip_Decompression::write(), Botan::Bzip_Compression::write(), and Botan::StreamCipher_Filter::write().

00029    {
00030    bool nothing_attached = true;
00031    for(u32bit j = 0; j != total_ports(); ++j)
00032       if(next[j])
00033          {
00034          if(write_queue.size())
00035             next[j]->write(write_queue, write_queue.size());
00036          next[j]->write(input, length);
00037          nothing_attached = false;
00038          }
00039 
00040    if(nothing_attached)
00041       write_queue.append(input, length);
00042    else
00043       write_queue.destroy();
00044    }

void Botan::Fanout_Filter::set_next ( Filter filters[],
u32bit  count 
) [inline, protected, inherited]

Parameters:
filters the filters to set
count number of items in filters

Reimplemented from Botan::Filter.

Definition at line 134 of file filter.h.

Referenced by Botan::Fork::Fork(), and Botan::SecureQueue::SecureQueue().

00134 { Filter::set_next(f, n); }

void Botan::Fanout_Filter::set_port ( u32bit  new_port  )  [inline, protected, inherited]

Set the active port

Parameters:
new_port the new value

Reimplemented from Botan::Filter.

Reimplemented in Botan::Fork.

Definition at line 132 of file filter.h.

Referenced by Botan::Fork::set_port().

00132 { Filter::set_port(n); }

virtual void Botan::Filter::start_msg (  )  [inline, virtual, inherited]

Start a new message. Must be closed by end_msg() before another message can be started.

Reimplemented in Botan::Bzip_Compression, Botan::Bzip_Decompression, Botan::EAX_Base, Botan::Zlib_Compression, Botan::Zlib_Decompression, Botan::PBE_PKCS5v15, and Botan::PBE_PKCS5v20.

Definition at line 38 of file filter.h.

00038 {}

void Botan::Chain::write ( const byte  input[],
u32bit  length 
) [inline, virtual]

Write a portion of a message to this filter.

Parameters:
input the input as a byte array
length the length of the byte array input

Implements Botan::Filter.

Definition at line 34 of file basefilt.h.

00034 { send(input, length); }


The documentation for this class was generated from the following files:

Generated on Tue Jun 29 08:56:42 2010 for Botan by  doxygen 1.5.8