6 #ifndef CRYPTOPP_SIMPLE_H
7 #define CRYPTOPP_SIMPLE_H
11 #if CRYPTOPP_MSC_VERSION
12 # pragma warning(push)
13 # pragma warning(disable: 4127 4189)
25 template <
class DERIVED,
class BASE>
29 Clonable * Clone()
const {
return new DERIVED(*
static_cast<const DERIVED *
>(
this));}
37 template <
class BASE,
class ALGORITHM_INFO=BASE>
41 static std::string CRYPTOPP_API StaticAlgorithmName() {
return ALGORITHM_INFO::StaticAlgorithmName();}
42 std::string AlgorithmName()
const {
return ALGORITHM_INFO::StaticAlgorithmName();}
86 bool IsolatedFlush(
bool hardFlush,
bool blocking)
87 {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking);
return false;}
97 bool Flush(
bool completeFlush,
int propagation=-1,
bool blocking=
true)
98 {
return ChannelFlush(
DEFAULT_CHANNEL, completeFlush, propagation, blocking);}
99 bool IsolatedFlush(
bool hardFlush,
bool blocking)
100 {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking);
CRYPTOPP_ASSERT(
false);
return false;}
101 bool ChannelFlush(
const std::string &channel,
bool hardFlush,
int propagation=-1,
bool blocking=
true)
103 if (hardFlush && !InputBufferIsEmpty())
104 throw CannotFlush(
"Unflushable<T>: this object has buffered input that cannot be flushed");
108 return attached && propagation ? attached->
ChannelFlush(channel, hardFlush, propagation-1, blocking) :
false;
113 virtual bool InputBufferIsEmpty()
const {
return false;}
138 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
139 {CRYPTOPP_UNUSED(inString); CRYPTOPP_UNUSED(length); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking);
throw InputRejected();}
144 bool IsolatedFlush(
bool hardFlush,
bool blocking)
145 {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking);
return false;}
146 bool IsolatedMessageSeriesEnd(
bool blocking)
147 {CRYPTOPP_UNUSED(blocking);
throw InputRejected();}
148 size_t ChannelPut2(
const std::string &channel,
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
149 {CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(inString); CRYPTOPP_UNUSED(length); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking);
throw InputRejected();}
150 bool ChannelMessageSeriesEnd(
const std::string& channel,
int messageEnd,
bool blocking)
151 {CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking);
throw InputRejected();}
165 virtual bool Flush(
bool hardFlush,
int propagation=-1,
bool blocking=
true) =0;
169 bool IsolatedFlush(
bool hardFlush,
bool blocking)
170 {CRYPTOPP_UNUSED(hardFlush); CRYPTOPP_UNUSED(blocking);
CRYPTOPP_ASSERT(
false);
return false;}
196 bool Flush(
bool hardFlush,
int propagation=-1,
bool blocking=
true)
197 {
return this->ChannelFlush(
DEFAULT_CHANNEL, hardFlush, propagation, blocking);}
198 bool MessageSeriesEnd(
int propagation=-1,
bool blocking=
true)
199 {
return this->ChannelMessageSeriesEnd(
DEFAULT_CHANNEL, propagation, blocking);}
200 byte * CreatePutSpace(
size_t &size)
202 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
203 {
return this->ChannelPut2(
DEFAULT_CHANNEL, inString, length, messageEnd, blocking);}
204 size_t PutModifiable2(
byte *inString,
size_t length,
int messageEnd,
bool blocking)
205 {
return this->ChannelPutModifiable2(
DEFAULT_CHANNEL, inString, length, messageEnd, blocking);}
209 byte * ChannelCreatePutSpace(
const std::string &channel,
size_t &size)
210 {CRYPTOPP_UNUSED(channel); size = 0;
return NULL;}
211 bool ChannelPutModifiable(
const std::string &channel,
byte *inString,
size_t length)
212 {this->ChannelPut(channel, inString, length);
return false;}
214 virtual size_t ChannelPut2(
const std::string &channel,
const byte *begin,
size_t length,
int messageEnd,
bool blocking) =0;
215 size_t ChannelPutModifiable2(
const std::string &channel,
byte *begin,
size_t length,
int messageEnd,
bool blocking)
216 {
return ChannelPut2(channel, begin, length, messageEnd, blocking);}
218 virtual bool ChannelFlush(
const std::string &channel,
bool hardFlush,
int propagation=-1,
bool blocking=
true) =0;
229 AutoSignaling(
int propagation=-1) : m_autoSignalPropagation(propagation) {}
231 void SetAutoSignalPropagation(
int propagation)
232 {m_autoSignalPropagation = propagation;}
233 int GetAutoSignalPropagation()
const
234 {
return m_autoSignalPropagation;}
237 int m_autoSignalPropagation;
244 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE
Store :
public AutoSignaling<InputRejecting<BufferedTransformation> >
252 m_messageEnd =
false;
253 StoreInitialize(parameters);
257 bool GetNextMessage();
261 virtual void StoreInitialize(
const NameValuePairs ¶meters) =0;
280 {CRYPTOPP_UNUSED(target); CRYPTOPP_UNUSED(transferBytes); CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(blocking); transferBytes = 0;
return 0;}
282 {CRYPTOPP_UNUSED(target); CRYPTOPP_UNUSED(begin); CRYPTOPP_UNUSED(end); CRYPTOPP_UNUSED(channel); CRYPTOPP_UNUSED(blocking);
return 0;}
295 {CRYPTOPP_UNUSED(params);}
296 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking)
297 {CRYPTOPP_UNUSED(inString); CRYPTOPP_UNUSED(length); CRYPTOPP_UNUSED(messageEnd); CRYPTOPP_UNUSED(blocking);
return 0;}
302 #if CRYPTOPP_MSC_VERSION
303 # pragma warning(pop)