public pnAuthSession(pnAuthServer parent, Socket s, pnCli2Srv_Connect hdr) : base(s, hdr) { fParent = parent; fLog = plDebugLog.GetLog("AuthSrv"); fChallenge = BitConverter.ToUInt32(RNG.Random(4), 0); }
private void IAcceptConnection(Socket cli) { hsStream s = new hsStream(new NetworkStream(cli, false)); pnCli2Srv_Connect hdr = new pnCli2Srv_Connect(); hdr.Read(s); s.Close(); IAcceptConnection(cli, hdr); }
public void EatClient(Socket cli, pnCli2Srv_Connect hdr) { pnAuthSession ac = new pnAuthSession(this, cli, hdr); if (!ac.Initialize()) { cli.Close(); return; } lock (fSessions) fSessions.Add(ac); }
public void EatClient(Socket cli, pnCli2Srv_Connect hdr) { pnVaultSession vc = new pnVaultSession(this, cli, hdr); if (!vc.Initialize()) { cli.Close(); return; } lock (fSessions) { fSessions.Add(vc); } }
private void IAcceptConnection(Socket cli, pnCli2Srv_Connect hdr) { pnIniParser ini = pngIni.Ini; switch (hdr.fType) { case ENetProtocol.kConnTypeCliToAuth: if (!ITestClientBranchID(hdr)) { cli.Close(); break; } if (!ITestClientBuildID(hdr)) { cli.Close(); break; } if (!ITestClientGuid(hdr)) { cli.Close(); break; } fAuth.EatClient(cli, hdr); break; case ENetProtocol.kConnTypeCliToFile: throw new NotImplementedException(); case ENetProtocol.kConnTypeCliToGame: throw new NotImplementedException(); case ENetProtocol.kConnTypeCliToGate: throw new NotImplementedException(); case ENetProtocol.kConnTypeSrvToLookup: throw new NotImplementedException(); case ENetProtocol.kConnTypeSrvToVault: if (!ITestServerGuid(hdr)) { cli.Close(); break; } fVault.EatClient(cli, hdr); break; default: // Unknown protocol, boot the client on principle. cli.Close(); break; } }
public pnSynchSession(Socket s, pnCli2Srv_Connect hdr) : base(s, hdr) { fReceiveArgs.Completed +=new EventHandler<SocketAsyncEventArgs>(IReceive); fReceiveArgs.SetBuffer(new byte[0], 0, 0); }
public pnSession(Socket s, pnCli2Srv_Connect hdr) : base(s, hdr) { }
public pnVaultSession(pnVaultServer parent, Socket s, pnCli2Srv_Connect hdr) : base(s, hdr) { fParent = parent; fLog = plDebugLog.GetLog("VaultSrv"); }
public plNetServer(Socket client, pnCli2Srv_Connect hdr) { fSocket = client; fConnHdr = hdr; }
private bool ITestServerGuid(pnCli2Srv_Connect hdr) { Guid product = pngIni.Ini.GetGuid("Server.ProductID"); if (product != Guid.Empty) return hdr.fProductUuid == product; return true; }
private bool ITestClientBuildID(pnCli2Srv_Connect hdr) { int? buildID = pngIni.Ini.GetInteger("Client.BuildID"); if (buildID.HasValue) return hdr.fBuildID == buildID.Value; return true; }