PSDAService.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Copyright (C) 2011-2018 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 _PSDA_SERVICE_H_
  32. #define _PSDA_SERVICE_H_
  33. #include "AEClass.h"
  34. #include "jhi.h"
  35. #define PSDA_SUCCESS 0
  36. #define PSDA_INVALID_COMMAND 1
  37. #define PSDA_BAD_PARAMETER 2
  38. #define PSDA_INTERNAL_ERROR 3
  39. #define PSDA_INVALID_SESSION_STATE 4
  40. #define PSDA_INTEGRITY_ERROR 5
  41. #define PSDA_SEQNO_CHECK_FAIL 6
  42. #define PSDA_LT_PAIRING_NOT_EXIST 7
  43. #define PSDA_NOT_PROVISIONED 8
  44. #define PSDA_PROTOCOL_NOT_SUPPORTED 9
  45. #define PSDA_PLATFORM_KEYS_REVOKED 10
  46. #define PSDA_PERSISTENT_DATA_WRITE_THROTTLED 11
  47. typedef enum _session_loss_retry_flag_t
  48. {
  49. NO_RETRY_ON_SESSION_LOSS = 0,
  50. AUTO_RETRY_ON_SESSION_LOSS,
  51. } session_loss_retry_flag_t;
  52. class PSDAService : public Singleton<PSDAService>
  53. {
  54. public:
  55. PSDAService(void);
  56. ~PSDAService(void);
  57. bool start_service();
  58. void stop_service();
  59. bool is_session_active();
  60. ae_error_t send_and_recv(
  61. INT32 nCommandId,
  62. JVM_COMM_BUFFER* pComm,
  63. INT32* responseCode,
  64. session_loss_retry_flag_t flag);
  65. JHI_HANDLE jhi_handle;
  66. JHI_SESSION_HANDLE psda_session_handle;
  67. UINT32 csme_gid;
  68. unsigned psda_svn;
  69. private:
  70. bool install_psda();
  71. bool start_service_internal();
  72. bool save_current_psda_svn();
  73. };
  74. #endif