7 #ifndef CRYPTOPP_QUEUE_H 8 #define CRYPTOPP_QUEUE_H 28 {
return CurrentSize();}
33 byte * CreatePutSpace(
size_t &size);
34 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking);
36 size_t Get(byte &outByte);
37 size_t Get(byte *outString,
size_t getMax);
39 size_t Peek(byte &outByte)
const;
40 size_t Peek(byte *outString,
size_t peekMax)
const;
42 size_t TransferTo2(BufferedTransformation &target, lword &transferBytes,
const std::string &channel=
DEFAULT_CHANNEL,
bool blocking=
true);
43 size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX,
const std::string &channel=
DEFAULT_CHANNEL,
bool blocking=
true)
const;
46 void SetNodeSize(
size_t nodeSize);
48 lword CurrentSize()
const;
53 void Unget(byte inByte);
54 void Unget(
const byte *inString,
size_t length);
56 const byte * Spy(
size_t &contiguousSize)
const;
58 void LazyPut(
const byte *inString,
size_t size);
59 void LazyPutModifiable(byte *inString,
size_t size);
60 void UndoLazyPut(
size_t size);
61 void FinalizeLazyPut();
64 bool operator==(
const ByteQueue &rhs)
const;
65 bool operator!=(
const ByteQueue &rhs)
const {
return !operator==(rhs);}
66 byte operator[](lword i)
const;
73 : m_queue(queue), m_node(NULL), m_position(0), m_offset(0), m_lazyString(NULL), m_lazyLength(0)
76 lword GetCurrentPosition() {
return m_position;}
79 {
return m_queue.CurrentSize() - m_position;}
83 size_t Get(byte &outByte);
84 size_t Get(byte *outString,
size_t getMax);
86 size_t Peek(byte &outByte)
const;
87 size_t Peek(byte *outString,
size_t peekMax)
const;
89 size_t TransferTo2(BufferedTransformation &target, lword &transferBytes,
const std::string &channel=
DEFAULT_CHANNEL,
bool blocking=
true);
90 size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX,
const std::string &channel=
DEFAULT_CHANNEL,
bool blocking=
true)
const;
94 const ByteQueueNode *m_node;
97 const byte *m_lazyString;
104 void CleanupUsedNodes();
110 ByteQueueNode *m_head, *m_tail;
113 bool m_lazyStringModifiable;
121 : m_bq(bq) {bq.LazyPut(inString, size);}
123 {
try {m_bq.FinalizeLazyPut();}
catch(
const Exception&) {assert(0);}}
135 :
LazyPutter(bq) {bq.LazyPutModifiable(inString, size);}
142 template<>
inline void swap(CryptoPP::ByteQueue &a, CryptoPP::ByteQueue &b)
Base class for all exceptions thrown by Crypto++.
use this to make sure LazyPut is finalized in event of exception
Classes providing simple keying interfaces.
Abstract base classes that provide a uniform interface to this library.
like LazyPutter, but does a LazyPutModifiable instead
lword MaxRetrievable() const
Provides the number of bytes ready for retrieval.
const std::string DEFAULT_CHANNEL
Default channel for BufferedTransformation.
lword MaxRetrievable() const
Provides the number of bytes ready for retrieval.
bool AnyRetrievable() const
Determines whether bytes are ready for retrieval.
Crypto++ library namespace.
Base class for bufferless filters.
Interface for retrieving values given their names.