Removed Common

Change-Id: I01ea8f07220375c2ad9bc0092281d4f27c642303
diff --git a/aos/messages/message.h b/aos/messages/message.h
new file mode 100644
index 0000000..2a8604b
--- /dev/null
+++ b/aos/messages/message.h
@@ -0,0 +1,57 @@
+#ifndef AOS_MESSAGE_H_
+#define AOS_MESSAGE_H_
+
+#include "aos/time/time.h"
+
+namespace aos {
+
+struct MessageType;
+
+// This class is a base class for all messages sent over queues.
+// All of the methods are overloaded in (generated) subclasses to do the same
+// thing for the whole thing.
+class Message {
+ public:
+  // The time that the message was sent at.
+  monotonic_clock::time_point sent_time;
+
+  Message() : sent_time(monotonic_clock::min_time) {}
+
+  // Zeros out the time.
+  void Zero();
+  // Returns the size of the common fields.
+  static size_t Size() { return sizeof(sent_time); }
+
+  // Deserializes the common fields from the buffer.
+  size_t Deserialize(const char *buffer);
+  // Serializes the common fields into the buffer.
+  size_t Serialize(char *buffer) const;
+
+  // Populates sent_time with the current time.
+  void SetTimeToNow() {
+    if (sent_time == monotonic_clock::min_time) {
+      sent_time = monotonic_clock::now();
+    }
+  }
+
+  // Writes the contents of the message to the provided buffer.
+  size_t Print(char *buffer, int length) const;
+
+  // Compares two messages for equality, excluding their sent_time.
+  bool EqualsNoTime(const Message & /*other*/) const { return true; }
+
+  static const MessageType *GetType();
+};
+
+// Specializations for the Builders will be automatically generated in the .q.h
+// header files with all of the handy builder methods.
+template <class T>
+class MessageBuilder {
+ public:
+  typedef T Message;
+  bool Send();
+};
+
+}  // namespace aos
+
+#endif  // AOS_MESSAGE_H_