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.

147 lines
4.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef VMPI_DEFS_H
  8. #define VMPI_DEFS_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. // This goes in front of all packets.
  13. #define VMPI_PROTOCOL_VERSION 5
  14. // This represents the protocol between the service and its UI.
  15. #define VMPI_SERVICE_UI_PROTOCOL_VERSION 1
  16. // NOTE: the service version (embedded in vmpi_service.exe as a resource) is the version
  17. // that is used to apply patches.
  18. #define VMPI_SERVICE_IDS_VERSION_STRING 102 // This matches IDS_VERSION_STRING in vmpi_service.exe.
  19. // Known packet IDs in various systems.
  20. #define VMPI_PACKETID_FILESYSTEM 0 // The file system reserves this packet ID.
  21. // All application traffic must set its first byte to something other
  22. // than this value.
  23. #define VMPI_SHARED_PACKET_ID 10
  24. // Turn this on, and the various service apps will log stuff.
  25. //#define VMPI_SERVICE_LOGS
  26. // This value is put in the RunningTimeMS until the job is finished. This is how
  27. // the job_search app knows if a job never finished.
  28. #define RUNNINGTIME_MS_SENTINEL 0xFEDCBAFD
  29. #define VMPI_SERVICE_NAME_INTERNAL "VMPI"
  30. #define VMPI_SERVICE_NAME "Valve MPI Service"
  31. // Stuff in the registry goes under here (in HKEY_LOCAL_MACHINE).
  32. #define VMPI_SERVICE_KEY "Software\\Valve\\VMPI"
  33. #define SERVICE_INSTALL_LOCATION_KEY "InstallLocation"
  34. // The VMPI service listens on one of these ports to talk to the UI.
  35. #define VMPI_SERVICE_FIRST_UI_PORT 23300
  36. #define VMPI_SERVICE_LAST_UI_PORT 23310
  37. // Port numbers that the master will use to broadcast unless -mpi_port is used.
  38. #define VMPI_MASTER_FIRST_PORT 23311
  39. #define VMPI_MASTER_LAST_PORT 23330
  40. // Packet IDs for vmpi_service to talk to UI clients.
  41. #define VMPI_SERVICE_TO_UI_CONSOLE_TEXT 0 // Print some text to the UI's console.
  42. #define VMPI_SERVICE_TO_UI_STATE 1 // Updates state reflecting whether it's idle, busy, etc.
  43. #define VMPI_SERVICE_TO_UI_PATCHING 2 // Updates state reflecting whether it's idle, busy, etc.
  44. #define VMPI_SERVICE_TO_UI_EXIT 3 // Updates state reflecting whether it's idle, busy, etc.
  45. // Application state.. these are communicated between the service and the UI.
  46. enum
  47. {
  48. VMPI_SERVICE_STATE_IDLE=0,
  49. VMPI_SERVICE_STATE_BUSY,
  50. VMPI_SERVICE_STATE_DISABLED
  51. };
  52. #define VMPI_SERVICE_DISABLE 2 // Stop waiting for jobs..
  53. #define VMPI_SERVICE_ENABLE 3
  54. #define VMPI_SERVICE_UPDATE_PASSWORD 4 // New password.
  55. #define VMPI_SERVICE_EXIT 5 // User chose "exit" from the menu. Kill the service.
  56. #define VMPI_SERVICE_SKIP_CSX_JOBS 6
  57. #define VMPI_SERVICE_SCREENSAVER_MODE 7
  58. // The worker service waits on this range of ports.
  59. #define VMPI_SERVICE_PORT 23397
  60. #define VMPI_LAST_SERVICE_PORT (VMPI_SERVICE_PORT + 15)
  61. #define VMPI_WORKER_PORT_FIRST 22340
  62. #define VMPI_WORKER_PORT_LAST 22350
  63. // The VMPI service downloader is still a worker but it uses this port range so the
  64. // master knows it's just downloading the exes.
  65. #define VMPI_SERVICE_DOWNLOADER_PORT_FIRST 22351
  66. #define VMPI_SERVICE_DOWNLOADER_PORT_LAST 22360
  67. // Give it a small range so they can have multiple masters running.
  68. #define VMPI_MASTER_PORT_FIRST 21140
  69. #define VMPI_MASTER_PORT_LAST 21145
  70. #define VMPI_MASTER_FILESYSTEM_BROADCAST_PORT 21146
  71. // Protocol.
  72. // The message format is:
  73. // - VMPI_PROTOCOL_VERSION
  74. // - null-terminated password string (or VMPI_PASSWORD_OVERRIDE followed by a zero to process it regardless of pw).
  75. // - packet ID
  76. // - payload
  77. #define VMPI_PASSWORD_OVERRIDE -111
  78. #define VMPI_MESSAGE_BASE 71
  79. // This is the broadcast message from the main (rank 0) process looking for workers.
  80. #define VMPI_LOOKING_FOR_WORKERS (VMPI_MESSAGE_BASE+0)
  81. // This is so an app can find out what machines are running the service.
  82. #define VMPI_PING_REQUEST (VMPI_MESSAGE_BASE+2)
  83. #define VMPI_PING_RESPONSE (VMPI_MESSAGE_BASE+3)
  84. // This tells the service to quit.
  85. #define VMPI_STOP_SERVICE (VMPI_MESSAGE_BASE+6)
  86. // This tells the service to kill any process it has running.
  87. #define VMPI_KILL_PROCESS (VMPI_MESSAGE_BASE+7)
  88. // This tells the service to patch itself.
  89. #define VMPI_SERVICE_PATCH (VMPI_MESSAGE_BASE+8)
  90. // Sent back to the master via UDP to tell it if its job has started and ended.
  91. #define VMPI_NOTIFY_START_STATUS (VMPI_MESSAGE_BASE+9)
  92. #define VMPI_NOTIFY_END_STATUS (VMPI_MESSAGE_BASE+10)
  93. #define VMPI_FORCE_PASSWORD_CHANGE (VMPI_MESSAGE_BASE+11)
  94. // These states are sent from the service to the services browser.
  95. #define VMPI_STATE_IDLE 0
  96. #define VMPI_STATE_BUSY 1
  97. #define VMPI_STATE_PATCHING 2
  98. #define VMPI_STATE_DISABLED 3
  99. #define VMPI_STATE_SCREENSAVER_DISABLED 4
  100. #define VMPI_STATE_DOWNLOADING 5
  101. #endif // VMPI_DEFS_H