Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CBaseClientState::SendConnectPacket (int challengeNr, int authProtocol, int keySize, const char *encryptionKey, uint64 unGSSteamID, bool bGSSecure )
- {
- COM_TimestampedLog( "SendConnectPacket" );
- netadr_t adr;
- char szServerName[MAX_OSPATH];
- const char *CDKey = "NOCDKEY";
- Q_strncpy(szServerName, m_szRetryAddress, MAX_OSPATH);
- if ( !NET_StringToAdr (szServerName, &adr) )
- {
- ConMsg ("Bad server address (%s)\n", szServerName );
- Disconnect();
- // Host_Disconnect(); MOTODO
- return;
- }
- if ( adr.GetPort() == (unsigned short)0 )
- {
- adr.SetPort( PORT_SERVER );
- }
- char msg_buffer[MAX_ROUTABLE_PAYLOAD];
- bf_write msg( msg_buffer, sizeof(msg_buffer) );
- msg.WriteLong( CONNECTIONLESS_HEADER );
- msg.WriteByte( C2S_CONNECT );
- msg.WriteLong( PROTOCOL_VERSION );
- msg.WriteLong( authProtocol );
- msg.WriteLong( challengeNr );
- msg.WriteString( GetClientName() ); // Name
- msg.WriteString( password.GetString() ); // password
- switch ( authProtocol )
- {
- // Fall through, bogus protocol type, use CD key hash.
- case PROTOCOL_HASHEDCDKEY: CDKey = GetCDKeyHash();
- msg.WriteString( CDKey ); // cdkey
- break;
- case PROTOCOL_STEAM: if (!PrepareSteamConnectResponse( keySize, encryptionKey, unGSSteamID, bGSSecure, adr, msg ))
- {
- return;
- }
- break;
- default: Host_Error( "Unexepected authentication protocol %i!\n", authProtocol );
- return;
- }
- // Mark time of this attempt for retransmit requests
- m_flConnectTime = net_time;
- // remember challengenr for TCP connection
- m_nChallengeNr = challengeNr;
- // Send protocol and challenge value
- NET_SendPacket( NULL, m_Socket, adr, msg.GetData(), msg.GetNumBytesWritten() );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement