2015-11-05 06:59:46 +00:00
|
|
|
#ifndef CRYPTOPP_FLTRIMPL_H
|
|
|
|
#define CRYPTOPP_FLTRIMPL_H
|
|
|
|
|
|
|
|
#define FILTER_BEGIN \
|
|
|
|
switch (m_continueAt) \
|
|
|
|
{ \
|
|
|
|
case 0: \
|
|
|
|
m_inputPosition = 0;
|
|
|
|
|
|
|
|
#define FILTER_END_NO_MESSAGE_END_NO_RETURN \
|
|
|
|
break; \
|
|
|
|
default: \
|
2016-09-16 15:27:15 +00:00
|
|
|
CRYPTOPP_ASSERT(false); \
|
2015-11-05 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define FILTER_END_NO_MESSAGE_END \
|
|
|
|
FILTER_END_NO_MESSAGE_END_NO_RETURN \
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
#define FILTER_END \
|
|
|
|
case -1: \
|
2017-03-01 11:10:06 +00:00
|
|
|
if (messageEnd && Output(-1, NULLPTR, 0, messageEnd, blocking)) \
|
2015-11-05 06:59:46 +00:00
|
|
|
return 1; \
|
|
|
|
FILTER_END_NO_MESSAGE_END
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define FILTER_OUTPUT3(site, statement, output, length, messageEnd, channel) \
|
|
|
|
{\
|
|
|
|
case site: \
|
2023-06-23 02:36:25 +00:00
|
|
|
(void) statement; \
|
2015-11-05 06:59:46 +00:00
|
|
|
if (Output(site, output, length, messageEnd, blocking, channel)) \
|
|
|
|
return STDMAX(size_t(1), length-m_inputPosition);\
|
|
|
|
}
|
|
|
|
|
|
|
|
#define FILTER_OUTPUT2(site, statement, output, length, messageEnd) \
|
|
|
|
FILTER_OUTPUT3(site, statement, output, length, messageEnd, DEFAULT_CHANNEL)
|
|
|
|
|
|
|
|
#define FILTER_OUTPUT(site, output, length, messageEnd) \
|
|
|
|
FILTER_OUTPUT2(site, 0, output, length, messageEnd)
|
|
|
|
|
|
|
|
#define FILTER_OUTPUT_BYTE(site, output) \
|
|
|
|
FILTER_OUTPUT(site, &(const byte &)(byte)output, 1, 0)
|
|
|
|
|
|
|
|
#define FILTER_OUTPUT2_MODIFIABLE(site, statement, output, length, messageEnd) \
|
|
|
|
{\
|
2017-07-17 08:48:28 +00:00
|
|
|
/* fall through */ \
|
2015-11-05 06:59:46 +00:00
|
|
|
case site: \
|
2023-06-23 02:36:25 +00:00
|
|
|
(void) statement; \
|
2015-11-05 06:59:46 +00:00
|
|
|
if (OutputModifiable(site, output, length, messageEnd, blocking)) \
|
|
|
|
return STDMAX(size_t(1), length-m_inputPosition);\
|
|
|
|
}
|
|
|
|
|
|
|
|
#define FILTER_OUTPUT_MODIFIABLE(site, output, length, messageEnd) \
|
|
|
|
FILTER_OUTPUT2_MODIFIABLE(site, 0, output, length, messageEnd)
|
|
|
|
|
|
|
|
#define FILTER_OUTPUT2_MAYBE_MODIFIABLE(site, statement, output, length, messageEnd, modifiable) \
|
|
|
|
{\
|
2017-07-17 08:48:28 +00:00
|
|
|
/* fall through */ \
|
2015-11-05 06:59:46 +00:00
|
|
|
case site: \
|
2023-06-23 02:36:25 +00:00
|
|
|
(void) statement; \
|
2015-11-05 06:59:46 +00:00
|
|
|
if (modifiable ? OutputModifiable(site, output, length, messageEnd, blocking) : Output(site, output, length, messageEnd, blocking)) \
|
|
|
|
return STDMAX(size_t(1), length-m_inputPosition);\
|
|
|
|
}
|
|
|
|
|
|
|
|
#define FILTER_OUTPUT_MAYBE_MODIFIABLE(site, output, length, messageEnd, modifiable) \
|
|
|
|
FILTER_OUTPUT2_MAYBE_MODIFIABLE(site, 0, output, length, messageEnd, modifiable)
|
|
|
|
|
|
|
|
#endif
|