Initial commit
diff --git a/model/sync-seq-no.h b/model/sync-seq-no.h
new file mode 100644
index 0000000..1461acb
--- /dev/null
+++ b/model/sync-seq-no.h
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2012 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ * 卞超轶 Chaoyi Bian <bcy@pku.edu.cn>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef SYNC_SEQ_NO_H
+#define SYNC_SEQ_NO_H
+
+namespace ns3
+{
+
+namespace Sync
+{
+
+/**
+ * @brief Sequence number abstraction
+ *
+ *
+ */
+struct SeqNo
+{
+public:
+ /**
+ * @brief Constructor with just sequence number. Session assumed to be zero
+ * @param seq Sequence number
+ */
+ SeqNo (uint32_t seq)
+ : m_session (0)
+ , m_seq (seq)
+ { }
+
+ /**
+ * @brief Constructor with session and sequence id
+ * @param session Session ID
+ * @param seq Sequence number
+ */
+ SeqNo (uint32_t session, uint32_t seq)
+ : m_session (session)
+ , m_seq (seq)
+ { }
+
+ /**
+ * @brief Session ID (e.g., after crash, application will choose new session ID.
+ *
+ * Note that session IDs for the same name should always increase. So, the good choice
+ * for the session ID is client's timestamp
+ */
+ uint32_t m_session;
+
+ /**
+ * @brief Sequence number
+ *
+ * Sequence number for a session always starts with 0 and goes to max value.
+ *
+ * For now, wrapping sequence number after max to zero is not supported
+ */
+ uint32_t m_seq;
+
+ /**
+ * @brief Compare if one sequence number is lower
+ * @param seq Another sequence number to compare with
+ *
+ * tuple (session1, seq1) is less than (session2, seq2) in two cases:
+ * 1. session1 < session2
+ * 2. session1 == session2 and seq1 < seq2
+ */
+ bool
+ operator < (const SeqNo &seq) const
+ {
+ return m_session < seq.m_session || (m_session == seq.m_session && m_seq < seq.m_seq);
+ }
+
+ /**
+ * @brief Compare if two sequence numbers are equal
+ * @param seq Another sequence number to compare with
+ */
+ bool
+ operator == (const SeqNo &seq) const
+ {
+ return m_session == seq.m_session && m_seq == seq.m_seq;
+ }
+};
+
+} // Sync
+
+} // ns3
+
+#endif // SYNC_SEQ_NO_H