summaryrefslogtreecommitdiff
path: root/ace/TMCast/Protocol.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'ace/TMCast/Protocol.hpp')
-rw-r--r--ace/TMCast/Protocol.hpp107
1 files changed, 107 insertions, 0 deletions
diff --git a/ace/TMCast/Protocol.hpp b/ace/TMCast/Protocol.hpp
new file mode 100644
index 00000000000..d5ae6a50cd6
--- /dev/null
+++ b/ace/TMCast/Protocol.hpp
@@ -0,0 +1,107 @@
+// file : TMCast/Protocol.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef TMCAST_PROTOCOL_HPP
+#define TMCAST_PROTOCOL_HPP
+
+namespace TMCast
+{
+ namespace Protocol
+ {
+ //
+ //
+ //
+ unsigned long const MEMBER_ID_LENGTH = 38;
+
+ struct MemberId
+ {
+ char id[MEMBER_ID_LENGTH];
+ /*
+ unsigned long ip;
+ unsigned short port;
+ */
+ };
+
+ //
+ //
+ //
+ typedef unsigned short TransactionId;
+
+
+
+ typedef unsigned char TransactionStatus;
+
+ TransactionStatus const TS_BEGIN = 1;
+ TransactionStatus const TS_COMMIT = 2;
+ TransactionStatus const TS_ABORT = 3;
+ TransactionStatus const TS_COMMITED = 4;
+ TransactionStatus const TS_ABORTED = 5;
+
+ struct Transaction
+ {
+ TransactionId id;
+ TransactionStatus status;
+ };
+
+ // Transaction List (TL)
+
+ // unsigned long const TL_LENGTH = 1;
+
+ // typedef Transaction TransactionList[TL_LENGTH];
+
+
+ //
+ //
+ //
+ struct MessageHeader
+ {
+ unsigned long length;
+
+ unsigned long check_sum;
+
+ MemberId member_id;
+
+ Transaction current;
+
+ //TransactionList transaction_list;
+ };
+
+
+ //
+ //
+ //
+
+ unsigned long const MAX_MESSAGE_SIZE = 768;
+
+ unsigned long const
+ MAX_PAYLOAD_SIZE = MAX_MESSAGE_SIZE - sizeof (MessageHeader);
+
+ // Protocol timing
+ //
+ //
+
+ unsigned long const SYNC_PERIOD = 30000; // in mks
+
+ unsigned short const VOTING_FRAME = 4; // in SYNC_PERIOD's
+ unsigned short const SEPARATION_FRAME = 5; // in SYNC_PERIOD's
+
+ // FATAL_SILENCE_FRAME in SYNC_PERIOD's
+ // Generally it's a good idea to set it to < VOTING_FRAME + SEPARATION_FRAME
+ //
+
+ short const FATAL_SILENCE_FRAME = VOTING_FRAME + SEPARATION_FRAME - 2;
+
+ // short const FATAL_SILENCE_FRAME = 10000;
+
+ // Helpers
+
+ // std::string
+ // tslabel (Protocol::TransactionStatus s);
+
+ // std::ostream&
+ // operator << (std::ostream& o, Transaction const& t);
+ }
+}
+
+#endif // TMCAST_PROTOCOL_HPP