3 #ifndef CRYPTOPP_QUEUE_H
4 #define CRYPTOPP_QUEUE_H
9 NAMESPACE_BEGIN(CryptoPP)
23 lword MaxRetrievable()
const
24 {
return CurrentSize();}
25 bool AnyRetrievable()
const
29 byte * CreatePutSpace(
size_t &size);
30 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking);
32 size_t Get(byte &outByte);
33 size_t Get(byte *outString,
size_t getMax);
35 size_t Peek(byte &outByte)
const;
36 size_t Peek(byte *outString,
size_t peekMax)
const;
38 size_t TransferTo2(BufferedTransformation &target, lword &transferBytes,
const std::string &channel=DEFAULT_CHANNEL,
bool blocking=
true);
39 size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX,
const std::string &channel=DEFAULT_CHANNEL,
bool blocking=
true)
const;
42 void SetNodeSize(
size_t nodeSize);
44 lword CurrentSize()
const;
49 void Unget(byte inByte);
50 void Unget(
const byte *inString,
size_t length);
52 const byte * Spy(
size_t &contiguousSize)
const;
54 void LazyPut(
const byte *inString,
size_t size);
55 void LazyPutModifiable(byte *inString,
size_t size);
56 void UndoLazyPut(
size_t size);
57 void FinalizeLazyPut();
60 bool operator==(
const ByteQueue &rhs)
const;
61 bool operator!=(
const ByteQueue &rhs)
const {
return !operator==(rhs);}
62 byte operator[](lword i)
const;
69 : m_queue(queue) {Initialize();}
71 lword GetCurrentPosition() {
return m_position;}
73 lword MaxRetrievable()
const
74 {
return m_queue.CurrentSize() - m_position;}
78 size_t Get(byte &outByte);
79 size_t Get(byte *outString,
size_t getMax);
81 size_t Peek(byte &outByte)
const;
82 size_t Peek(byte *outString,
size_t peekMax)
const;
84 size_t TransferTo2(BufferedTransformation &target, lword &transferBytes,
const std::string &channel=DEFAULT_CHANNEL,
bool blocking=
true);
85 size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX,
const std::string &channel=DEFAULT_CHANNEL,
bool blocking=
true)
const;
89 const ByteQueueNode *m_node;
92 const byte *m_lazyString;
99 void CleanupUsedNodes();
105 ByteQueueNode *m_head, *m_tail;
108 bool m_lazyStringModifiable;
116 : m_bq(bq) {bq.LazyPut(inString, size);}
118 {
try {m_bq.FinalizeLazyPut();}
catch(...) {}}
130 :
LazyPutter(bq) {bq.LazyPutModifiable(inString, size);}