浏览代码

Protocol messages for bridging. GitHub issue #68

Adam Ierymenko 11 年之前
父节点
当前提交
fb31f93c52
共有 4 个文件被更改,包括 24 次插入8 次删除
  1. 1 1
      node/Packet.cpp
  2. 19 2
      node/Packet.hpp
  3. 3 4
      node/PacketDecoder.cpp
  4. 1 1
      node/PacketDecoder.hpp

+ 1 - 1
node/Packet.cpp

@@ -42,7 +42,7 @@ const char *Packet::verbString(Verb v)
 		case VERB_WHOIS: return "WHOIS";
 		case VERB_RENDEZVOUS: return "RENDEZVOUS";
 		case VERB_FRAME: return "FRAME";
-		case VERB_BRIDGED_FRAME: return "BRIDGED_FRAME";
+		case VERB_EXT_FRAME: return "EXT_FRAME";
 		case VERB_MULTICAST_FRAME: return "MULTICAST_FRAME";
 		case VERB_MULTICAST_LIKE: return "MULTICAST_LIKE";
 		case VERB_NETWORK_MEMBERSHIP_CERTIFICATE: return "NETWORK_MEMBERSHIP_CERTIFICATE";

+ 19 - 2
node/Packet.hpp

@@ -497,8 +497,22 @@ public:
 		 */
 		VERB_FRAME = 6,
 
-		/* TODO: not implemented yet */
-		VERB_BRIDGED_FRAME = 7,
+		/*
+		 * An ethernet frame to or from specified MAC addresses:
+		 *   <[8] 64-bit network ID>
+		 *   <[6] destination MAC or all zero for destination node>
+		 *   <[6] source MAC or all zero for node of origin>
+		 *   <[2] 16-bit ethertype>
+		 *   <[...] ethernet payload>
+		 *
+		 * Extended frames include full MAC addressing and are used for bridged
+		 * configurations. Theoretically they could carry multicast as well but
+		 * currently they're not used for that.
+		 *
+		 * ERROR may be generated if a membership certificate is needed for a
+		 * closed network. Payload will be network ID.
+		 */
+		VERB_EXT_FRAME = 7,
 
 		/* A multicast frame:
 		 *   <[2] 16-bit propagation depth or 0xffff for "do not forward">
@@ -543,6 +557,9 @@ public:
 		 * set in the bloom filter and addresses outside the propagation restrict
 		 * prefix.
 		 *
+		 * Active bridges on a network are always added as next hops for all
+		 * multicast and broadcast traffic, as if they "like" all groups.
+		 *
 		 * Algorithm for setting bits in bloom filter:
 		 *
 		 * (1) Place the address in the least significant 40 bits of a 64-bit int.

+ 3 - 4
node/PacketDecoder.cpp

@@ -97,8 +97,8 @@ bool PacketDecoder::tryDecode(const RuntimeEnvironment *_r)
 				return _doRENDEZVOUS(_r,peer);
 			case Packet::VERB_FRAME:
 				return _doFRAME(_r,peer);
-			case Packet::VERB_BRIDGED_FRAME:
-				return _doBRIDGED_FRAME(_r,peer);
+			case Packet::VERB_EXT_FRAME:
+				return _doEXT_FRAME(_r,peer);
 			case Packet::VERB_MULTICAST_FRAME:
 				return _doMULTICAST_FRAME(_r,peer);
 			case Packet::VERB_MULTICAST_LIKE:
@@ -455,9 +455,8 @@ bool PacketDecoder::_doFRAME(const RuntimeEnvironment *_r,const SharedPtr<Peer>
 	return true;
 }
 
-bool PacketDecoder::_doBRIDGED_FRAME(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer)
+bool PacketDecoder::_doEXT_FRAME(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer)
 {
-	// TODO: bridging is not implemented yet
 	return true;
 }
 

+ 1 - 1
node/PacketDecoder.hpp

@@ -117,7 +117,7 @@ private:
 	bool _doWHOIS(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);
 	bool _doRENDEZVOUS(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);
 	bool _doFRAME(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);
-	bool _doBRIDGED_FRAME(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);
+	bool _doEXT_FRAME(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);
 	bool _doMULTICAST_FRAME(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);
 	bool _doMULTICAST_LIKE(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);
 	bool _doNETWORK_MEMBERSHIP_CERTIFICATE(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);