Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

161 lines
5.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Holds all the protocol bits and defines used in tracker networking
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef TRACKERPROTOCOL_H
  8. #define TRACKERPROTOCOL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. // failed return versions of the messages are the TMSG_FAIL_OFFSET + 10000
  13. #define TMSG_FAIL_OFFSET 10000
  14. //-----------------------------------------------------------------------------
  15. // Purpose: List of all the tracker messages used
  16. // msgID's are 32bits big
  17. //-----------------------------------------------------------------------------
  18. enum TrackerMsgID_t
  19. {
  20. // generic messages
  21. TMSG_NONE = 0, // no message id
  22. TMSG_ACK = 1, // packet acknowledgement
  23. // server -> Client messages
  24. TSVC_BASE = 1000,
  25. TSVC_CHALLENGE,
  26. TSVC_LOGINOK,
  27. TSVC_LOGINFAIL,
  28. TSVC_DISCONNECT,
  29. TSVC_FRIENDS,
  30. TSVC_FRIENDUPDATE,
  31. TSVC_HEARTBEAT,
  32. TSVC_PINGACK, // acknowledgement of TCLS_PING packet
  33. TSVC_FRIENDINFO,
  34. TSVC_USERVALID,
  35. TSVC_FRIENDSFOUND,
  36. TSVC_NOFRIENDS,
  37. TSVC_MESSAGE, // message passed through from another client
  38. TSVC_GAMEINFO, // information about a friends' game
  39. TSVC_AUTHREQUEST, // a user requesting auth from the receiving user
  40. TSVC_CONNECTIONKEEPALIVE, // information that an attemption connect is taking time, and the user should wait
  41. TSVC_ROUTEMESSAGEFAILED, // chat message failed to be routed through the servers
  42. TSVC_REDIRECTLOGIN, // tells the client to redirect their login attempt to a different server
  43. // Client -> server messages
  44. TCLS_BASE = 2000,
  45. TCLS_LOGIN, // login message
  46. TCLS_RESPONSE, // response to login challenge
  47. TCLS_PING,
  48. TCLS_FRIENDSEARCH,
  49. TCLS_HEARTBEAT,
  50. TCLS_AUTHUSER,
  51. TCLS_REQAUTH,
  52. TCLS_FRIENDINFO, // friend info request
  53. TCLS_SETINFO,
  54. TCLS_ROUTETOFRIEND, // generic reroute of a message to a friend
  55. // Client -> Client messages
  56. TCL_BASE = 3000,
  57. TCL_MESSAGE, // chat text message
  58. TCL_USERBLOCK, // soon to be obselete
  59. TCL_ADDEDTOCHAT,
  60. TCL_CHATADDUSER,
  61. TCL_CHATUSERLEAVE,
  62. TCL_TYPINGMESSAGE,
  63. TCL_FRIENDNETMESSAGE,
  64. // server -> server messages
  65. TSV_BASE = 4000,
  66. TSV_WHOISPRIMARY,
  67. TSV_PRIMARYSRV,
  68. TSV_REQUESTINFO,
  69. TSV_TOPOLOGYINFO,
  70. TSV_REQUESTTOPOLOGYINFO,
  71. TSV_SERVERPING,
  72. TSV_MONITORINFO,
  73. TSV_LOCKUSERRANGE,
  74. TSV_UNLOCKUSERRANGE,
  75. TSV_REDIRECTTOUSER,
  76. TSV_FORCEDISCONNECTUSER,
  77. TSV_USERCHECKMESSAGES,
  78. TSV_USERAUTHREQUEST,
  79. TSV_USERSTATUSCHANGED,
  80. TSV_USERRELOADFRIENDSLIST,
  81. TSV_REGISTERSERVERINNETWORK,
  82. TSV_SERVERSHUTTINGDOWN,
  83. TSV_UPDATEACTIVEUSERRANGESTATUS,
  84. // game server -> Client
  85. TCLG_BASE = 5000,
  86. // common msg failed ID's
  87. TSVC_HEARTBEAT_FAIL = TSVC_HEARTBEAT + TMSG_FAIL_OFFSET,
  88. TCLS_HEARTBEAT_FAIL = TCLS_HEARTBEAT + TMSG_FAIL_OFFSET,
  89. TCL_MESSAGE_FAIL = TCL_MESSAGE + TMSG_FAIL_OFFSET,
  90. };
  91. //-----------------------------------------------------------------------------
  92. // Purpose: List of reasons explaining to user why they have been disconnected
  93. // from the friends network
  94. //-----------------------------------------------------------------------------
  95. enum TrackerLogoffReason_t
  96. {
  97. TRACKER_LOGOFF_NOREASON,
  98. // server reasons for disconnecting user
  99. TRACKER_LOGOFF_LOGGEDINELSEWHERE, // user has logged into friends at a different location
  100. TRACKER_LOGOFF_SERVERWORK, // server needs to do work (like lock the user range)
  101. TRACKER_LOGOFF_SERVERSHUTDOWN, // server has been shutdown
  102. TRACKER_LOGOFF_TIMEDOUT, // user hasn't heartbeat'd to server recently enough
  103. TRACKER_LOGOFF_REQUESTED, // user has requested to logoff
  104. TRACKER_LOGOFF_FIREWALL, // users' firewall won't allow enough packets through
  105. TRACKER_LOGOFF_NOTCONNECTED, // user sent server a packet that implied they think they're logged in but they're not
  106. TRACKER_LOGOFF_INVALIDSTEAMTICKET, // users steam ticket is invalid
  107. // client reasons for being disconnected
  108. TRACKER_LOGOFF_JOINEDGAME, // user has logged off because they joined a game
  109. TRACKER_LOGOFF_CONNECTIONTIMEOUT, // user connection has timed out
  110. TRACKER_LOGOFF_SERVERMESSAGEFAIL, // a message to the server was not successfully transmitted
  111. TRACKER_LOGOFF_TOOMANYATTEMPTS, // too many login attempts have been performed
  112. TRACKER_LOGOFF_OFFLINE, // steam is in offline mode so don't try to connect
  113. };
  114. //-----------------------------------------------------------------------------
  115. // Purpose: List of all the reasons a login attempt may fail
  116. //-----------------------------------------------------------------------------
  117. enum TrackerLoginFailReason_t
  118. {
  119. TRACKER_LOGINFAIL_NOREASON = 0,
  120. TRACKER_LOGINFAIL_NOSUCHUSER = -2,
  121. TRACKER_LOGINFAIL_ALREADLOGGEDIN = -3,
  122. TRACKER_LOGINFAIL_INVALIDSTEAMTICKET = -4,
  123. TRACKER_LOGINFAIL_BUILDOUTOFDATE = -5,
  124. TRACKER_LOGINFAIL_PLATFORMOUTOFDATE = -6,
  125. };
  126. //-----------------------------------------------------------------------------
  127. // Purpose: Holds basic status for a friend
  128. //-----------------------------------------------------------------------------
  129. struct FriendStatus_t
  130. {
  131. unsigned int friendID;
  132. int status;
  133. unsigned int sessionID;
  134. unsigned int ip;
  135. unsigned int port;
  136. unsigned int serverID;
  137. };
  138. #endif // TRACKERPROTOCOL_H