void NetInterface::handleConnectChallengeRequest(const NetAddress *addr, BitStream *stream) { char buf[256]; Net::addressToString(addr, buf); Con::printf("Got Connect challenge Request from %s", buf); if(!mAllowConnections) return; U32 connectSequence; stream->read(&connectSequence); if(!mRandomDataInitialized) initRandomData(); U32 addressDigest[4]; computeNetMD5(addr, connectSequence, addressDigest); BitStream *out = BitStream::getPacketStream(); out->write(U8(ConnectChallengeResponse)); out->write(connectSequence); out->write(addressDigest[0]); out->write(addressDigest[1]); out->write(addressDigest[2]); out->write(addressDigest[3]); BitStream::sendPacketStream(addr); }
void NetInterface::sendConnectAccept(NetConnection *conn) { BitStream *out = BitStream::getPacketStream(); out->write(U8(ConnectAccept)); out->write(conn->getSequence()); conn->writeConnectAccept(out); BitStream::sendPacketStream(conn->getNetAddress()); }
void NetInterface::sendConnectReject(NetConnection *conn, const char *reason) { if(!reason) return; // if the stream is NULL, we reject silently BitStream *out = BitStream::getPacketStream(); out->write(U8(ConnectReject)); out->write(conn->getSequence()); out->writeString(reason); BitStream::sendPacketStream(conn->getNetAddress()); }
void NetInterface::sendConnectChallengeRequest(NetConnection *conn) { Con::printf("Sending Connect challenge Request"); BitStream *out = BitStream::getPacketStream(); out->write(U8(ConnectChallengeRequest)); out->write(conn->getSequence()); conn->mConnectSendCount++; conn->mConnectLastSendTime = Platform::getVirtualMilliseconds(); BitStream::sendPacketStream(conn->getNetAddress()); }
void NetInterface::sendDisconnectPacket(NetConnection *conn, const char *reason) { Con::printf("Issuing Disconnect packet."); // send a disconnect packet... U32 connectSequence = conn->getSequence(); BitStream *out = BitStream::getPacketStream(); out->write(U8(Disconnect)); out->write(connectSequence); out->writeString(reason); BitStream::sendPacketStream(conn->getNetAddress()); }
void NetInterface::sendConnectRequest(NetConnection *conn) { BitStream *out = BitStream::getPacketStream(); out->write(U8(ConnectRequest)); out->write(conn->getSequence()); U32 addressDigest[4]; conn->getAddressDigest(addressDigest); out->write(addressDigest[0]); out->write(addressDigest[1]); out->write(addressDigest[2]); out->write(addressDigest[3]); out->writeString(conn->getClassName()); conn->writeConnectRequest(out); conn->mConnectSendCount++; conn->mConnectLastSendTime = Platform::getVirtualMilliseconds(); BitStream::sendPacketStream(conn->getNetAddress()); }