Summary Files Commits Branches @commit @diff @stats
path: root / src / message.h
diff options
context:
space:
mode:
1 files changed, 31 insertions, 0 deletions
-rw-r--r--src/message.h31
diff --git a/src/message.h b/src/message.h
new file mode 100644
index 0000000..c988059
--- /dev/null
+++ b/src/message.h
@@ -0,0 +1,31 @@
+#ifndef ISO_TP_MESSAGE
+#define ISO_TP_MESSAGE
+
+#include <ostream>
+#include "frame.h"
+
+class Message {
+ unsigned int can_id;
+ unsigned int size;
+ unsigned int received;
+ unsigned char* msg;
+
+public:
+ Message() = default;
+ Message(unsigned int can_id, const Frame& first_frame);
+ Message(const Message& rhs);
+
+ ~Message() {
+ delete[] this->msg;
+ }
+
+ void receive_frame(const Frame& f);
+
+ bool expects_more_frames() const;
+
+ friend std::ostream& operator<<(std::ostream& os, const Message& m);
+};
+
+std::ostream& operator<<(std::ostream& os, const Message& m);
+
+#endif /* ISO_TP_MESSAGE */