1 #ifndef pfodSecurityClient_h
2 #define pfodSecurityClient_h
53 #define pfod_MAYBE_UNUSED(x) (void)(x)
68 size_t write(
const uint8_t *buffer,
size_t size);
94 void connect(Stream* io_arg,
const __FlashStringHelper *hexKeyPgr);
110 void startAuthorization();
111 void closeConnectionAddEOF();
112 void resetKeepAliveTimer();
113 const static size_t MAX_CLIENT_CMD_LEN = 256 + 8 + 2;
114 const static size_t MAX_SERVER_RESPONSE_LEN = 1024 + 8 + 2;
115 const static size_t TX_BUFFER_SIZE = MAX_CLIENT_CMD_LEN;
116 const static size_t RX_BUFFER_SIZE = MAX_SERVER_RESPONSE_LEN;
117 uint8_t tx_buffer[TX_BUFFER_SIZE];
118 uint8_t rx_buffer[RX_BUFFER_SIZE];
119 uint8_t rx_temp_buffer[RX_BUFFER_SIZE];
120 uint8_t rx_raw_data_buffer[RX_BUFFER_SIZE];
125 void clearTxRxBuffers();
126 uint16_t keepAliveIntervalValue;
127 uint16_t keepAliveInterval;
128 unsigned long keepAliveTimer;
129 bool setKeepAliveIntervalCalled;
131 size_t writeToIO(uint8_t b);
139 unsigned long responseTimer;
140 unsigned long responseTimeout;
141 unsigned long responseTimeoutValue;
142 void restartResponseTimer();
143 void stopResponseTimer();
144 bool waitingForResponse;
146 void setAuthorizeState(
int auth);
148 bool collectCheckHash(uint8_t b);
149 void handleChallengeResponse();
152 byte msgHashBytes[Msg_Hash_Size + 1];
153 byte incomingHashBytes[Msg_Hash_Size + 1];
155 uint32_t outMsgCount;
156 uint8_t outputParserState;
157 boolean initialization;
158 const __FlashStringHelper *hexKeyPgr;
160 bool connectionClosed;
161 bool closingConnectionOut;
162 bool closingConnectionIn;
166 unsigned long timerDebug_ms;
167 unsigned long idleTimeout;
168 unsigned long idleConnectionTimerStart;
169 unsigned long idleConnectionTimer;
170 bool setIdleTimeoutCalled;
171 void startIdleConnectionTimer();
172 void stopIdleConnectionTimer();
pfod_Base for Arduino Base class for all pfod_Base_xxxx classes The subclasses pfod_Base_xxx must ove...
pfodMACClient for Arduino Updates power cycles, builds the Challenge, keeps track in message counts a...
static const uint8_t challengeByteSize
static const uint8_t msgHashByteSize
pfodRingBuffer for Arduino Implements a ring buffer implementation of an Arduino Stream upto 32K buff...
void connect(pfod_Base *_pfodBase)
void connect(pfod_Base *_pfodBase, const __FlashStringHelper *hexKeyPgr)
void setIdleTimeout(unsigned long timeout_in_seconds)
void connect(Stream *io_arg)
initialize the Security parser args io_arg the Stream pointer to read and write to for pfod messages
Stream * getRawDataStream()
void connect(Stream *io_arg, const __FlashStringHelper *hexKeyPgr)
void setResponseTimeout(unsigned long timeout_mS)
void setKeepAliveInterval(uint16_t _interval_mS)
void setDebugStream(Print *debugOut)
size_t write(const uint8_t *buffer, size_t size)