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.

63 lines
2.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Interface to unified messages client
  4. //
  5. // You should not need to use this interface except if your product is using a language other than C++.
  6. // Contact your Steam Tech contact for more details.
  7. //
  8. //=============================================================================
  9. #ifndef ISTEAMUNIFIEDMESSAGES_H
  10. #define ISTEAMUNIFIEDMESSAGES_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. typedef uint64 ClientUnifiedMessageHandle;
  15. class ISteamUnifiedMessages
  16. {
  17. public:
  18. static const ClientUnifiedMessageHandle k_InvalidUnifiedMessageHandle = 0;
  19. // Sends a service method (in binary serialized form) using the Steam Client.
  20. // Returns a unified message handle (k_InvalidUnifiedMessageHandle if could not send the message).
  21. virtual ClientUnifiedMessageHandle SendMethod( const char *pchServiceMethod, const void *pRequestBuffer, uint32 unRequestBufferSize, uint64 unContext ) = 0;
  22. // Gets the size of the response and the EResult. Returns false if the response is not ready yet.
  23. virtual bool GetMethodResponseInfo( ClientUnifiedMessageHandle hHandle, uint32 *punResponseSize, EResult *peResult ) = 0;
  24. // Gets a response in binary serialized form (and optionally release the corresponding allocated memory).
  25. virtual bool GetMethodResponseData( ClientUnifiedMessageHandle hHandle, void *pResponseBuffer, uint32 unResponseBufferSize, bool bAutoRelease ) = 0;
  26. // Releases the message and its corresponding allocated memory.
  27. virtual bool ReleaseMethod( ClientUnifiedMessageHandle hHandle ) = 0;
  28. // Sends a service notification (in binary serialized form) using the Steam Client.
  29. // Returns true if the notification was sent successfully.
  30. virtual bool SendNotification( const char *pchServiceNotification, const void *pNotificationBuffer, uint32 unNotificationBufferSize ) = 0;
  31. };
  32. #define STEAMUNIFIEDMESSAGES_INTERFACE_VERSION "STEAMUNIFIEDMESSAGES_INTERFACE_VERSION001"
  33. // callbacks
  34. #if defined( VALVE_CALLBACK_PACK_SMALL )
  35. #pragma pack( push, 4 )
  36. #elif defined( VALVE_CALLBACK_PACK_LARGE )
  37. #pragma pack( push, 8 )
  38. #else
  39. #error isteamclient.h must be included
  40. #endif
  41. struct SteamUnifiedMessagesSendMethodResult_t
  42. {
  43. enum { k_iCallback = k_iClientUnifiedMessagesCallbacks + 1 };
  44. ClientUnifiedMessageHandle m_hHandle; // The handle returned by SendMethod().
  45. uint64 m_unContext; // Context provided when calling SendMethod().
  46. EResult m_eResult; // The result of the method call.
  47. uint32 m_unResponseSize; // The size of the response.
  48. };
  49. #pragma pack( pop )
  50. #endif // ISTEAMUNIFIEDMESSAGES_H