public static byte[] HandleMessage(ClientInfo client, byte[] data) { List <byte[]> msgs; Log.WriteLine(1, "[DO] Handling DO_FetchRequestMessage..."); MemoryStream m = new MemoryStream(data); m.Seek(3, 0); uint dupObj = Helper.ReadU32(m); switch (dupObj) { case 0x5C00001: msgs = new List <byte[]>(); if (!client.bootStrapDone) { foreach (DupObj obj in DO_Session.DupObjs) { msgs.Add(DO_CreateDuplicaMessage.Create(obj, 2)); } client.bootStrapDone = true; } msgs.Add(DO_MigrationMessage.Create(client.callCounterDO_RMC++, new DupObj(DupObjClass.Station, 1), new DupObj(DupObjClass.Station, client.stationID), new DupObj(DupObjClass.Station, client.stationID), 3, new List <uint>() { new DupObj(DupObjClass.Station, client.stationID) })); return(DO_BundleMessage.Create(client, msgs)); default: Log.WriteLine(1, "[DO] Handling DO_FetchRequest unknown dupObj 0x" + dupObj.ToString("X8") + "!"); return(new byte[0]); } }
public static byte[] HandleMessage(ClientInfo client, byte[] data, byte sessionID) { Log.WriteLine(1, "[DO] Handling DO_JoinRequestMessage..."); SendConnectionRequest(client, sessionID); List <byte[]> msgs = new List <byte[]>(); InitSession(client); DupObj clientStation = new DupObj(DupObjClass.Station, client.stationID, 1); Payload_Station ps = new Payload_Station(); ps.connectionInfo.m_strStationURL1 = "prudp:/address=255.0.0.0;port=4"; ps.stationState = STATIONSTATE.JoiningSession; clientStation.Payload = ps; DO_Session.DupObjs.Add(clientStation); msgs.Add(DO_JoinResponseMessage.Create(1, new DupObj(DupObjClass.Station, client.stationID, 1))); msgs.Add(DO_CreateAndPromoteDuplicaMessage.Create(client.callCounterDO_RMC++, clientStation, 2)); msgs.Add(DO_MigrationMessage.Create(client.callCounterDO_RMC++, new DupObj(DupObjClass.Station, 1), new DupObj(DupObjClass.Station, client.stationID), new DupObj(DupObjClass.Station, client.stationID), 3, new List <uint>())); clientStation.Master.ID = client.stationID; return(DO_BundleMessage.Create(client, msgs)); }