ISerializer.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Copyright (C) 2011-2016 Intel Corporation. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * * Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in
  12. * the documentation and/or other materials provided with the
  13. * distribution.
  14. * * Neither the name of Intel Corporation nor the names of its
  15. * contributors may be used to endorse or promote products derived
  16. * from this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. *
  30. */
  31. #ifndef __AE_SERIALIZER_H_
  32. #define __AE_SERIALIZER_H_
  33. struct AEMessage;
  34. class AEInitQuoteRequest;
  35. class AEInitQuoteResponse;
  36. class AEGetQuoteRequest;
  37. class AEGetQuoteResponse;
  38. class AEGetLaunchTokenRequest;
  39. class AEGetLaunchTokenResponse;
  40. class AECreateSessionRequest;
  41. class AECreateSessionResponse;
  42. class AEInvokeServiceRequest;
  43. class AEInvokeServiceResponse;
  44. class AEExchangeReportRequest;
  45. class AEExchangeReportResponse;
  46. class AECloseSessionRequest;
  47. class AECloseSessionResponse;
  48. class AEGetPsCapRequest;
  49. class AEGetPsCapResponse;
  50. class AEReportAttestationRequest;
  51. class AEReportAttestationResponse;
  52. class IAERequest;
  53. class IAEResponse;
  54. class ISerializer{
  55. public:
  56. //request serializers
  57. virtual AEMessage* serialize(AEInitQuoteRequest* request) = 0;
  58. virtual AEMessage* serialize(AEGetQuoteRequest* request) = 0;
  59. virtual AEMessage* serialize(AEGetLaunchTokenRequest* request) = 0;
  60. virtual AEMessage* serialize(AECreateSessionRequest* request) = 0;
  61. virtual AEMessage* serialize(AEInvokeServiceRequest* request) = 0;
  62. virtual AEMessage* serialize(AEExchangeReportRequest* request) = 0;
  63. virtual AEMessage* serialize(AECloseSessionRequest* request) = 0;
  64. virtual AEMessage* serialize(AEGetPsCapRequest* request) = 0;
  65. virtual AEMessage* serialize(AEReportAttestationRequest* request) = 0;
  66. //response serializers
  67. virtual AEMessage* serialize(AEInitQuoteResponse* response) = 0;
  68. virtual AEMessage* serialize(AEGetQuoteResponse* response) = 0;
  69. virtual AEMessage* serialize(AEGetLaunchTokenResponse* response) = 0;
  70. virtual AEMessage* serialize(AECreateSessionResponse* response) = 0;
  71. virtual AEMessage* serialize(AEInvokeServiceResponse* response) = 0;
  72. virtual AEMessage* serialize(AEExchangeReportResponse* response) = 0;
  73. virtual AEMessage* serialize(AECloseSessionResponse* response) = 0;
  74. virtual AEMessage* serialize(AEGetPsCapResponse* response) = 0;
  75. virtual AEMessage* serialize(AEReportAttestationResponse* response) = 0;
  76. //request inflater -> will inflate request objects by unmarshaling communication level data (this will be used by server)
  77. virtual IAERequest* inflateRequest(AEMessage* message) = 0;
  78. //response inflater -> will inflate response objects with data by unmarshaling communication level data
  79. virtual bool inflateResponse(AEMessage* message, AEInitQuoteResponse* response) = 0;
  80. virtual bool inflateResponse(AEMessage* message, AEGetQuoteResponse* response) = 0;
  81. virtual bool inflateResponse(AEMessage* message, AEGetLaunchTokenResponse* response) = 0;
  82. virtual bool inflateResponse(AEMessage* message, AECreateSessionResponse* response) = 0;
  83. virtual bool inflateResponse(AEMessage* message, AEInvokeServiceResponse* response) = 0;
  84. virtual bool inflateResponse(AEMessage* message, AEExchangeReportResponse* response) = 0;
  85. virtual bool inflateResponse(AEMessage* message, AECloseSessionResponse* response) = 0;
  86. virtual bool inflateResponse(AEMessage* message, AEGetPsCapResponse* response) = 0;
  87. virtual bool inflateResponse(AEMessage* message, AEReportAttestationResponse* response) = 0;
  88. virtual ~ISerializer() {}
  89. };
  90. #endif