Joe-Palmer / rtmplite

Automatically exported from code.google.com/p/rtmplite
0 stars 0 forks source link

Group specification in RTMFP #67

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
First reported by john.berzy@gmail.com on Dec 27, 2011.

---
Hi,

Great job on describing the rtmfp protocol!

Do you have any plans to explore it further? I'd love to get an idea of the 
complexity of the network topology. One of the things I find most useful would 
be allowing the server to act like a peer in the mesh. That way it can use 
various features of the NetGroup i.e. Post, SendToNeighbor etc.  

I believe it's currently implemented in FMS 4.5 .

FYI, here is how to decode the groupspec string if that's useful in anyway.

let groupSpec = 
"G:01010102010321050a22aade0583f6f26b1d5edef57b27a92dec77fa22f5aef85b364528c2bb9
79f010d040
e616e73011b00"

let numBytes = groupSpec.Length
let bytes = 
    [| for i in 1..numBytes - 1 do
        if i % 2 = 0 then 
            let chars = groupSpec.Substring(i, 2) 
            yield  Byte.Parse(chars, System.Globalization.NumberStyles.HexNumber)
    |]

let reader = new BinaryReader(new MemoryStream(bytes))
let mutable length = reader.ReadByte() 
while(length > 0x00uy) do
    let marker = reader.ReadByte()
    match marker with
    |0x00uy ->
        printfn "routingEnabled"
    |0x01uy ->
        printfn "multicastEnabled"
    |0x02uy ->
        printfn "objectReplicationEnabled"
    |0x03uy ->
        printfn "postingEnabled"
    |0x05uy ->
        let hash = reader.ReadBytes(int length - 1)
        printfn "password sha256 hash of 'testpass22' %s" (Util.ByteToHex hash)  

    |0x0cuy ->
        printfn "serverChannelEnabled"
    |0x0duy ->
        printfn "peerToPeerDisabled"
    |0x0euy ->
        let ascii = new System.Text.ASCIIEncoding()
        let groupName = reader.ReadBytes(int length - 1) |> ascii.GetString
        printfn "groupName = %s" groupName
    |0x1buy ->
       printfn "ipMulticastMemberUpdatesEnabled"
    | _ ->
        printfn "unkown marker"
    length <- reader.ReadByte()

Thanks,
John

---
Hi John,

Thanks for your mail and sorry about the delay due to the holiday travel.

Yes, I definitely want to explore it further.

But I have to admit that I didn't understand  clearly what your code example is 
doing.

Thanks

---
Hi Kundan,

Thanks for the reply. Sorry about the code it's a little bit rough. 

The group id in the python implementation is actually the group spec. you can 
decode that to extract all the settings e.g. the group uri, peer2peerEnabled, 
routingEnabled etc.

Here is an example with the client code

 var groupspec:GroupSpecifier = new GroupSpecifier("myGroupTest");
 groupspec.postingEnabled = true;
 groupspec.routingEnabled = true;
 // allows you to discover neighbors on the same LAN
 groupspec.ipMulticastMemberUpdatesEnabled = true;
 groupspec.multicastEnabled = true;
 groupspec.objectReplicationEnabled = true;
 group = new NetGroup(connection, groupspec.groupspecWithAuthorizations());

encoding and decoding the groupspec would be required if you eventually want to 
create groups on the server instead of having them created via a client 
request.  I thought it might be useful if you're going to digg further in rtmfp.

Please let me know if you'd like any further clarification.

Thanks,
John

Original issue reported on code.google.com by kundan10 on 4 Jan 2012 at 7:15