Skip to content

Commit

Permalink
init: init project layout
Browse files Browse the repository at this point in the history
  • Loading branch information
keyvchan committed Jul 22, 2022
1 parent 3f413bd commit 082c3e3
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CompileFlags:
Add: [-xc++, -Wall, -std=c++20]
Compiler: /usr/local/opt/llvm/bin/clang++
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
39 changes: 39 additions & 0 deletions x25.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <cstdint>
#include <vector>

namespace LAPB_TYPES {

// Address A/B
enum class LAPB_ADDRESS : uint8_t {
ADDRESS_A = 0x03,
ADDRESS_B = 0x01,
};

} // namespace LAPB_TYPES

namespace LAPB_FRAME {
// virtual class for LAPB frames
class lapb_frame {
private:
public:
LAPB_TYPES::LAPB_ADDRESS address; // Address of the field
std::uint8_t control;
std::vector<std::uint8_t> data;

// serialize the frame to a vector of bytes
virtual std::vector<std::uint8_t> serialize() = 0;
// deserialize the frame from a vector of bytes
virtual void deserialize(std::vector<std::uint8_t> &data) = 0;
};

class lapb_frame_I : public lapb_frame {};
class lapb_frame_S : public lapb_frame {};
class lapb_frame_U : public lapb_frame {};

class FRAME_SABM : public lapb_frame_S {};
class FRAME_DISC : public lapb_frame_S {};
class FRAME_FRMR : public lapb_frame_S {};
class FRAME_UA : public lapb_frame_U {};
class FRAME_DM : public lapb_frame_U {};

}; // namespace LAPB_FRAME

0 comments on commit 082c3e3

Please sign in to comment.