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.

376 lines
12 KiB

  1. //====== Copyright 1996-2010, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose: The file defines our Google Protocol Buffers which are used in over
  4. // the wire messages between servers as well as between the TF GC and TF gameservers
  5. // and clients.
  6. //
  7. //=============================================================================
  8. // We care more about speed than code size
  9. option optimize_for = SPEED;
  10. // We don't use the service generation functionality
  11. option cc_generic_services = false;
  12. //
  13. // STYLE NOTES:
  14. //
  15. // Use CamelCase CMsgMyMessageName style names for messages.
  16. //
  17. // Use lowercase _ delimited names like my_steam_id for field names, this is non-standard for Steam,
  18. // but plays nice with the Google formatted code generation.
  19. //
  20. // Try not to use required fields ever. Only do so if you are really really sure you'll never want them removed.
  21. // Optional should be preffered as it will make versioning easier and cleaner in the future if someone refactors
  22. // your message and wants to remove or rename fields.
  23. //
  24. // Use fixed64 for JobId_t, GID_t, or SteamID. This is appropriate for any field that is normally
  25. // going to be larger than 2^56. Otherwise use int64 for 64 bit values that are frequently smaller
  26. // than 2^56 as it will safe space on the wire in those cases.
  27. //
  28. // Similar to fixed64, use fixed32 for RTime32 or other 32 bit values that are frequently larger than
  29. // 2^28. It will safe space in those cases, otherwise use int32 which will safe space for smaller values.
  30. // An exception to this rule for RTime32 is if the value will frequently be zero rather than set to an actual
  31. // time.
  32. //
  33. import "steammessages.proto";
  34. message CMsgSOIDOwner
  35. {
  36. optional uint32 type = 1;
  37. optional uint64 id = 2;
  38. }
  39. //
  40. // k_ESOMsg_Create
  41. // k_ESOMsg_Update
  42. // k_ESOMsg_Destroy
  43. //
  44. message CMsgSOSingleObject
  45. {
  46. optional fixed64 owner = 1; // the steam ID of the owner of this object
  47. optional int32 type_id = 2; // the shared object type ID of this object
  48. optional bytes object_data = 3; // the actual data for the object
  49. optional fixed64 version = 4; // version of the cache
  50. optional CMsgSOIDOwner owner_soid = 5; // The SOID that owns this object
  51. optional uint32 service_id = 6; // The service that sent this update
  52. };
  53. //
  54. // k_ESOMsg_UpdateMultiple
  55. //
  56. message CMsgSOMultipleObjects
  57. {
  58. message SingleObject
  59. {
  60. optional int32 type_id = 1; // the shared object type ID of this object
  61. optional bytes object_data = 2; // the actual data for the object
  62. };
  63. optional fixed64 owner = 1; // the steam ID of the owner of the objects
  64. repeated SingleObject objects = 2; // a list of types
  65. optional fixed64 version = 3; // version of the cache
  66. optional CMsgSOIDOwner owner_soid = 6; // The SOID that owns this object
  67. optional uint32 service_id = 7; // The service that sent this update
  68. };
  69. //
  70. // k_ESOMsg_CacheSubscribed
  71. //
  72. message CMsgSOCacheSubscribed
  73. {
  74. message SubscribedType
  75. {
  76. optional int32 type_id = 1; // ID of the type for these objects
  77. repeated bytes object_data = 2; // the data for all the objects of this type
  78. };
  79. optional fixed64 owner = 1; // the owner of this cache
  80. repeated SubscribedType objects = 2; // a list of types
  81. optional fixed64 version = 3; // version of the cache
  82. optional CMsgSOIDOwner owner_soid = 4; // The SOID that owns this object
  83. optional uint32 service_id = 5; // The service that is providing this SO cache information
  84. repeated uint32 service_list = 6; // Other services that are providing parts of this cache and need to to be received for it to be complete
  85. optional fixed64 sync_version = 7; // The unique ID of the sync to ensure all subscribes across services match. Ignored/not provided if no other GCs are involved
  86. };
  87. //
  88. // k_ESOMsg_CacheSubscribedUpToDate
  89. //
  90. message CMsgSOCacheSubscribedUpToDate
  91. {
  92. optional fixed64 version = 1; // version of the cache for this sub GC
  93. optional CMsgSOIDOwner owner_soid = 2; // The SOID that owns this object
  94. optional uint32 service_id = 3; // The service that is providing this SO cache information
  95. repeated uint32 service_list = 4; // Other services that are providing parts of this cache and need to to be received for it to be complete
  96. optional fixed64 sync_version = 5; // The unique ID of the sync to ensure all subscribes across services match. Ignored/not provided if no other GCs are involved
  97. };
  98. //
  99. // k_ESOMsg_CacheUnsubscribed
  100. //
  101. message CMsgSOCacheUnsubscribed
  102. {
  103. optional fixed64 owner = 1; // the owner of this cache
  104. };
  105. //
  106. // k_ESOMsg_CacheSubscriptionCheck
  107. //
  108. message CMsgSOCacheSubscriptionCheck
  109. {
  110. optional fixed64 owner = 1; // the owner of the cache
  111. optional fixed64 version = 2; // version of the cache
  112. optional CMsgSOIDOwner owner_soid = 3; // The SOID that owns this object
  113. optional uint32 service_id = 4; // The service associated with this version
  114. repeated uint32 service_list = 5; // The other services that need to provide information on this cache
  115. optional fixed64 sync_version = 6; // The unique ID of the sync to ensure all subscribes across services match. Ignored/not provided if no other GCs are involved
  116. };
  117. //
  118. // k_ESOMsg_CacheSubscriptionRefresh
  119. //
  120. message CMsgSOCacheSubscriptionRefresh
  121. {
  122. optional fixed64 owner = 1; // the owner of the cache
  123. optional CMsgSOIDOwner owner_soid = 2; // The SOID that owns this object
  124. };
  125. //
  126. // Stored in memcached for each SO Cache
  127. //
  128. message CMsgSOCacheVersion
  129. {
  130. optional fixed64 version = 1; // version of the cache
  131. };
  132. enum PartnerAccountType
  133. {
  134. //the default for users, which is an account not linked to a provider
  135. PARTNER_NONE = 0;
  136. //linked to a Perfect World account
  137. PARTNER_PERFECT_WORLD = 1;
  138. //linked to a Nexon account
  139. PARTNER_NEXON = 2;
  140. };
  141. message CMsgGCMultiplexMessage
  142. {
  143. optional uint32 msgtype = 1; // ID of the message being sent
  144. optional bytes payload = 2; // Serialized message to send
  145. repeated fixed64 steamids = 3; // Clients to send the message to
  146. };
  147. // k_EGCToGCMsgMasterAck
  148. message CGCToGCMsgMasterAck
  149. {
  150. optional uint32 dir_index = 1; // the index from the directory that this GC is responsible for
  151. optional string machine_name = 3; // the machine name that this GC is running on so that we can quickly see the universe configuration
  152. optional string process_name = 4; // the name of the process that this is running to ensure that it matches
  153. repeated uint32 type_instances = 5; // the list of type instances contained within this process, must match the master directory
  154. };
  155. // k_EGCToGCMsgMasterAck_Response
  156. message CGCToGCMsgMasterAck_Response
  157. {
  158. optional int32 eresult = 1 [default = 2]; // Is this GC what the master thinks it should be?
  159. };
  160. // k_EGCToGCMsgMasterStartupComplete
  161. message CGCToGCMsgMasterStartupComplete
  162. {
  163. message GCInfo
  164. {
  165. optional uint32 dir_index = 1;
  166. optional string machine_name = 2;
  167. };
  168. repeated GCInfo gc_info = 1;
  169. };
  170. // k_EGCToGCMsgRouted
  171. message CGCToGCMsgRouted
  172. {
  173. optional uint32 msg_type = 1; // the type of the contained message
  174. optional fixed64 sender_id = 2; // steam ID of the client that sent this. If nil, it came from the system instead.
  175. optional bytes net_message = 3; // the binary blob contents of the contained message
  176. };
  177. // k_EGCToGCMsgRoutedReply
  178. message CGCToGCMsgRoutedReply
  179. {
  180. optional uint32 msg_type = 1; // the type of the contained message
  181. optional bytes net_message = 2; // the binary blob contents of the contained message
  182. };
  183. // k_EMsgGCUpdateSubGCSessionInfo
  184. message CMsgGCUpdateSubGCSessionInfo
  185. {
  186. message CMsgUpdate
  187. {
  188. optional fixed64 steamid = 1;
  189. optional fixed32 ip = 2;
  190. optional bool trusted = 3;
  191. };
  192. repeated CMsgUpdate updates = 1; // the list of updates we should process (in order)
  193. }
  194. // k_EMsgGCRequestSubGCSessionInfo
  195. message CMsgGCRequestSubGCSessionInfo
  196. {
  197. optional fixed64 steamid = 1;
  198. }
  199. // k_EMsgGCRequestSubGCSessionInfoRespone
  200. message CMsgGCRequestSubGCSessionInfoResponse
  201. {
  202. optional fixed32 ip = 1;
  203. optional bool trusted = 2;
  204. }
  205. // k_EMsgGCToGCIncrementRecruitmentLevel
  206. message CMsgGCToGCIncrementRecruitmentLevel
  207. {
  208. optional fixed64 steamid = 1;
  209. }
  210. //
  211. // CMsgSOCacheHaveVersion
  212. //
  213. // An array of these is sent to indicate what SO cache versions we currently have
  214. //
  215. message CMsgSOCacheHaveVersion
  216. {
  217. optional CMsgSOIDOwner soid = 1; // ID of the cache we have
  218. optional fixed64 version = 2; // version stamp we have of this cache
  219. optional uint32 service_id = 3; // For partial caches, what service this version is associated with
  220. };
  221. // !FIXME! DOTAMERGE
  222. ////
  223. //// CMsgClientHello
  224. ////
  225. //message CMsgClientHello
  226. //{
  227. // optional uint32 version = 1;
  228. // repeated CMsgSOCacheHaveVersion socache_have_versions = 2;
  229. //
  230. // /// Game-specific value indicating what state the client is in,
  231. // /// and what sort of session is wants. This is used to decide
  232. // /// whether the client even needs a session, and if so, what
  233. // /// priority we should assign
  234. // optional uint32 client_session_need = 3;
  235. //
  236. // /// What special partner-specific launcher was used, if any?
  237. // optional PartnerAccountType client_launcher = 4;
  238. //
  239. // /// Secret Key used to gain elevated status with the GC
  240. // optional string secret_key = 5;
  241. //};
  242. //
  243. ////
  244. //// CMsgClientWelcome
  245. ////
  246. //message CMsgClientWelcome
  247. //{
  248. // optional uint32 version = 1;
  249. // optional bytes game_data = 2;
  250. //
  251. // // List of caches to which the client is now subscribed, but
  252. // // the GC thinks we don't have the latest data so it is included it here.
  253. // repeated CMsgSOCacheSubscribed outofdate_subscribed_caches = 3;
  254. //
  255. // // List of caches to which the client is now subscribed, and the
  256. // // GC thinks that we already have the latest version. (It is sending
  257. // // the version number just to make sure.)
  258. // repeated CMsgSOCacheSubscriptionCheck uptodate_subscribed_caches = 4;
  259. //
  260. // // location information
  261. // message Location
  262. // {
  263. // optional float latitude = 1;
  264. // optional float longitude = 2;
  265. // optional string country = 3;
  266. // }
  267. //
  268. // optional Location location = 5;
  269. //
  270. // optional bytes save_game_key = 6;
  271. //};
  272. /// Status of connection to GC.
  273. //
  274. // Don't change these values, as they need to be consistent across props, since they
  275. // are central to handshaking with clients old and new!
  276. enum GCConnectionStatus
  277. {
  278. GCConnectionStatus_HAVE_SESSION = 0; // You have a session. (The status of one or more services may have changed.)
  279. GCConnectionStatus_GC_GOING_DOWN = 1; // Notification that the entire GC system is going down.
  280. GCConnectionStatus_NO_SESSION = 2; // You don't have a session. Please send a hello message to initiate the session creation process.
  281. GCConnectionStatus_NO_SESSION_IN_LOGON_QUEUE = 3; // You don't have a session, but we have your info and will sign you on ASAP. No need to send it again.
  282. GCConnectionStatus_NO_STEAM = 4; // Client-side only value. We aren't connected to Steam.
  283. GCConnectionStatus_SUSPENDED = 5; // Client-side only value. We were told that we've been suspended from connecting to this GC. No need to try again later.
  284. };
  285. //
  286. // CMsgConnectionStatus
  287. //
  288. message CMsgConnectionStatus
  289. {
  290. optional GCConnectionStatus status = 1;
  291. optional uint32 client_session_need = 2; // The last client session need state we got from you.
  292. //
  293. // If they are in the queue, this tells them where they are.
  294. //
  295. optional int32 queue_position = 3; // your approximate position in the queue
  296. optional int32 queue_size = 4; // how many people are in the queue
  297. optional int32 wait_seconds = 5; // how long you've been waiting
  298. optional int32 estimated_wait_seconds_remaining = 6; // estimated time until you are logged on.
  299. // TODO: Here we could include a list of services
  300. // (perhaps just SO cache type ID's?) that
  301. // are currently known to be offline.
  302. };
  303. //k_EMsgGCToGCSOCacheSubscribe
  304. message CMsgGCToGCSOCacheSubscribe
  305. {
  306. message CMsgHaveVersions
  307. {
  308. optional uint32 service_id = 1;
  309. optional uint64 version = 2;
  310. };
  311. optional fixed64 subscriber = 1; // the ID of the user that is subscribing to a cache
  312. optional fixed64 subscribe_to = 2; // the ID of the cache that is being subscribed to
  313. optional fixed64 sync_version = 3; // the unique ID that is used to distinguish this synch across the various parts
  314. repeated CMsgHaveVersions have_versions = 4; // the version that the client has already (used to skip unnecessary sends)
  315. };
  316. //k_EMsgGCToGCSOCacheUnsubscribe
  317. message CMsgGCToGCSOCacheUnsubscribe
  318. {
  319. optional fixed64 subscriber = 1; // if 0, then this means unsubscribe everyone from the cache
  320. optional fixed64 unsubscribe_from = 2; // the cache we are unsubscribing from
  321. };
  322. // k_EMsgGCPingRequest
  323. // k_EMsgGCPingReply
  324. message CMsgGCClientPing
  325. {
  326. // Remember, if you need to associate ping replies with requests, consider using the JobID field
  327. };
  328. // Do not remove this comment due to a bug on the Mac OS X protobuf compiler