HDLC-Daemon
FrameParser.h
Go to the documentation of this file.
1 
37 #ifndef HDLC_FRAME_PARSER_H
38 #define HDLC_FRAME_PARSER_H
39 
40 #include <vector>
41 #include "HdlcFrame.h"
42 class ProtocolState;
43 
44 class FrameParser {
45 public:
46  FrameParser(ProtocolState& a_ProtocolState);
47  void Reset();
48  void AddReceivedRawBytes(const unsigned char* a_Buffer, size_t a_Bytes);
49 
50 private:
51  // Interal helpers
52  size_t AddChunk(const unsigned char* a_Buffer, size_t a_Bytes);
53  bool RemoveEscapeCharacters();
54  HdlcFrame DeserializeFrame(const std::vector<unsigned char> &a_UnescapedBuffer) const;
55 
56  // Members
57  ProtocolState& m_ProtocolState;
58 
59  enum { max_length = 1024 };
60  std::vector<unsigned char> m_Buffer;
61  bool m_bStartTokenSeen;
62 };
63 
64 #endif // HDLC_FRAME_PARSER_H
Copyright (c) 2016, Florian Evers, florian-evers@gmx.de All rights reserved.
FrameParser(ProtocolState &a_ProtocolState)
Definition: FrameParser.cpp:41
void AddReceivedRawBytes(const unsigned char *a_Buffer, size_t a_Bytes)
Definition: FrameParser.cpp:53
void Reset()
Definition: FrameParser.cpp:45