//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: // //============================================================================= // Should move to common/networksystem #ifndef NETCHANNEL_H #define NETCHANNEL_H #ifdef _WIN32 #pragma once #endif #include "tier1/bitbuf.h" #include "tier1/netadr.h" #include "sm_Protocol.h" #include "tier1/utlvector.h" #include "networksystem/inetworksystem.h" #include "tier1/mempool.h" //----------------------------------------------------------------------------- // Forward declarations //----------------------------------------------------------------------------- class CUDPSocket; class CUtlBuffer; class CNetPacket; class CNetChannel; class INetChannel; // 0 == regular, 1 == file stream enum { FRAG_NORMAL_STREAM = 0, FRAG_FILE_STREAM, MAX_STREAMS }; #define NET_MAX_DATAGRAM_PAYLOAD 1400 #define NET_MAX_PAYLOAD_BITS 11 // 2^NET_MAX_PALYLOAD_BITS > NET_MAX_PAYLOAD #define DEFAULT_RATE 10000 #define SIGNON_TIME_OUT 120.0f #define CONNECTION_PROBLEM_TIME 15.0f #define MAX_RATE 50000 #define MIN_RATE 100 #define FRAGMENT_BITS 8 #define FRAGMENT_SIZE (1< m_ReliableDataBufferMP; // unreliable message buffer, cleared wich each packet bf_write m_StreamUnreliable; byte m_UnreliableDataBuffer[NET_MAX_DATAGRAM_PAYLOAD]; // don't use any vars below this (only in net_ws.cpp) CUDPSocket *m_pSocket; // NS_SERVER or NS_CLIENT index, depending on channel. int m_StreamSocket; // TCP socket handle unsigned int m_MaxReliablePayloadSize; // max size of reliable payload in a single packet // Address this channel is talking to. netadr_t remote_address; // For timeouts. Time last message was received. float last_received; // Time when channel was connected. float connect_time; // Bandwidth choke // Bytes per second int m_Rate; // If realtime > cleartime, free to send next packet float m_fClearTime; float m_Timeout; // in seconds char m_Name[32]; // channel name // packet history // netflow_t m_DataFlow[ MAX_FLOWS ]; INetworkMessageHandler *m_MessageHandler; // who registers and processes messages }; #endif // NETCHANNEL_H