| 47 | }; |
| 48 | |
| 49 | class CNetwork |
| 50 | { |
| 51 | private: |
| 52 | struct CSlot |
| 53 | { |
| 54 | CNetworkClient m_Connection; |
| 55 | }; |
| 56 | |
| 57 | NETSOCKET m_Socket; |
| 58 | class CNetBan *m_pNetBan; |
| 59 | CSlot m_aSlots[NET_MAX_CLIENTS]; |
| 60 | |
| 61 | NETFUNC_NEWCLIENT m_pfnNewClient; |
| 62 | NETFUNC_DELCLIENT m_pfnDelClient; |
| 63 | void *m_UserPtr; |
| 64 | |
| 65 | public: |
| 66 | void SetCallbacks(NETFUNC_NEWCLIENT pfnNewClient, NETFUNC_DELCLIENT pfnDelClient, void *pUser); |
| 67 | |
| 68 | // |
| 69 | bool Open(NETADDR BindAddr, CNetBan *pNetBan); |
| 70 | int Close(); |
| 71 | |
| 72 | // |
| 73 | int Recv(char *pLine, int MaxLength, int *pClientID = 0); |
| 74 | int Send(int ClientID, const char *pLine); |
| 75 | int Update(); |
| 76 | |
| 77 | // |
| 78 | int AcceptClient(NETSOCKET Socket, const NETADDR *pAddr); |
| 79 | int Drop(int ClientID, const char *pReason); |
| 80 | |
| 81 | // status requests |
| 82 | const NETADDR *ClientAddr(int ClientID) const { return m_aSlots[ClientID].m_Connection.PeerAddress(); } |
| 83 | const NETSOCKET *Socket() const { return &m_Socket; } |
| 84 | class CNetBan *NetBan() const { return m_pNetBan; } |
| 85 | }; |
| 86 | |
| 87 | #endif |
nothing calls this directly
no outgoing calls
no test coverage detected