lpa.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. /* Copyright (C) 2016 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef __LPA_H__
  13. #define __LPA_H__
  14. #include "osi_api.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #define LPA_VERSION_STR "2.2.0"
  19. //macro
  20. #define LPA_SUCCESS 0
  21. #define LPA_FAILURE 1
  22. //typedef
  23. typedef void (*lpad_callback)(void *ctx, uint8_t nStatus, void *pData, CFW_SIM_ID nSimId);
  24. //APP
  25. typedef struct
  26. {
  27. uint8_t nStatus;
  28. char *pDes;
  29. } LPA_DOWNLOADD_RESULT_T;
  30. uint32_t lpa_app_download(void *ctx, char *pSmdpAddress, lpad_callback callback, CFW_SIM_ID nSimId);
  31. //ES9+
  32. typedef struct
  33. {
  34. uint8_t *pTransactionId;
  35. uint8_t *pServerSigned1;
  36. uint8_t *pServerSignature1;
  37. uint8_t *pEuiccCiPKIdToBeUsed;
  38. uint8_t *pServerCertificate;
  39. } RSP_INITIATEAUTHENTICATION_T;
  40. typedef struct
  41. {
  42. uint8_t *pTransactionId;
  43. uint8_t *pProfileMetadata;
  44. uint8_t *pSmdpSigned2;
  45. uint8_t *pSmdpSignature2;
  46. uint8_t *pSmdpCertificate;
  47. } RSP_AUTHENTICATE_CLIENT_T;
  48. typedef struct
  49. {
  50. uint8_t *pTransactionId;
  51. uint8_t *pBoundProfilePackage;
  52. } RSP_GET_BOUND_PROFILE_PACKAGE_T;
  53. uint32_t lpdd_InitiateAuthentication(void *ctx, uint8_t *pEuiccChallenge, uint8_t *pEuiccInfo1, char *pSmdpAddress, lpad_callback callback, CFW_SIM_ID nSimId);
  54. uint32_t lpdd_AuthenticateClient(void *ctx, uint8_t *pAuthenticateServerResponse, lpad_callback callback, CFW_SIM_ID nSimId);
  55. uint32_t lpdd_GetBoundProfilePackage(void *ctx, uint8_t *pPrepareDownloadResponse, lpad_callback callback, CFW_SIM_ID nSimId);
  56. uint32_t lpdd_HandleNotification(void *ctx, uint8_t *pPendingNotification, lpad_callback callback, CFW_SIM_ID nSimId);
  57. //ES10a
  58. typedef struct
  59. {
  60. char *pDefaultDpAddress;
  61. char *pRootDsAddress;
  62. } EUICC_CONFIGURED_ADDRESS_T;
  63. uint32_t ldsd_GetEUICCConfiguredAddress(void *ctx, lpad_callback callback, CFW_SIM_ID nSimId);
  64. uint32_t ldsd_SetDefaultDpAddress(void *ctx, uint8_t *pAddress, int8_t nLen, lpad_callback callback, CFW_SIM_ID nSimId);
  65. //ES10b
  66. typedef enum
  67. {
  68. NOTIFICATION_INSTALL = 0x01,
  69. NOTIFICATION_ENABLE = 0x02,
  70. NOTIFICATION_DISABLE = 0x4,
  71. NOTIFICATION_DELETE = 0x08,
  72. } NOTIFICATION_EVENT_E;
  73. typedef struct
  74. {
  75. uint8_t nSeqNumber;
  76. uint8_t seqNumber[10];
  77. } LPA_LIST_NOTIFICATION_SEQ_T;
  78. uint32_t lpdd_PrepareDownload(void *ctx, RSP_AUTHENTICATE_CLIENT_T *pServerData, lpad_callback callback, CFW_SIM_ID nSimId);
  79. uint32_t lpdd_LoadBoundProfilePackage(void *ctx, uint8_t *pBoundProfilePackage, lpad_callback callback, CFW_SIM_ID nSimId);
  80. uint32_t lpdd_GetEUICCChallenge(void *ctx, lpad_callback callback, CFW_SIM_ID nSimId);
  81. uint32_t lpdd_GetEUICCInfo1(void *ctx, lpad_callback callback, CFW_SIM_ID nSimId);
  82. uint32_t lpdd_GetEUICCInfo2(void *ctx, lpad_callback callback, CFW_SIM_ID nSimId);
  83. uint32_t lpdd_ListNotification(void *ctx, NOTIFICATION_EVENT_E event, lpad_callback callback, CFW_SIM_ID nSimId);
  84. uint32_t lpdd_RetrieveNotification(void *ctx, uint8_t nSeq, lpad_callback callback, CFW_SIM_ID nSimId);
  85. uint32_t lpdd_RemoveNotificationFromList(void *ctx, uint8_t nSeq, lpad_callback callback, CFW_SIM_ID nSimId);
  86. uint32_t lpdd_AuthenticateServer(void *ctx, RSP_INITIATEAUTHENTICATION_T *pServerData, lpad_callback callback, CFW_SIM_ID nSimId);
  87. uint32_t lpdd_GetRat(void *ctx, lpad_callback callback, CFW_SIM_ID nSimId);
  88. //ES10c
  89. #define LPA_EID_LENGTH 16
  90. typedef struct
  91. {
  92. uint8_t NotificationEvent;
  93. uint8_t *notificationAddress;
  94. } LPA_NOTIFICATION_CONFIGURATION_INFORMATION_T;
  95. #define LPA_GID_LENGTH 16
  96. typedef struct
  97. {
  98. uint8_t nLen;
  99. uint8_t gid[LPA_GID_LENGTH];
  100. } LPA_GID_T;
  101. typedef struct
  102. {
  103. uint8_t mccMnc[3];
  104. LPA_GID_T gid1;
  105. LPA_GID_T gid2;
  106. } LPA_OPERATOR_ID_T;
  107. typedef struct
  108. {
  109. uint8_t pprUpdateControl;
  110. uint8_t ppr1; //if allow disable
  111. uint8_t ppr2; //if allow delete
  112. } LPA_PPR_IDS_T;
  113. #define LPA_ICCID_LENGTH 10
  114. #define LPA_AID_LENGTH 16
  115. #define LPA_PROFILE_NICK_NAME_LENGTH 64
  116. #define LPA_SERVICE_PROVIDER_NAME_LENGTH 32
  117. #define LPA_PROFILE_NAME_LENGTH 32
  118. #define LPA_NOTIFICATION_CONFIGURATION_INFO_NUM 5
  119. #define LPA_DP_PROPRITARY_DATA_LENGTH 128
  120. typedef struct
  121. {
  122. uint8_t bIccid;
  123. uint8_t iccid[LPA_ICCID_LENGTH];
  124. uint8_t bIsDpAid;
  125. uint8_t isdpAid[LPA_AID_LENGTH];
  126. uint8_t bProfileState;
  127. uint8_t profileState;
  128. uint8_t bProfileNickName;
  129. uint8_t profileNickname[LPA_PROFILE_NICK_NAME_LENGTH + 2];
  130. uint8_t bServiceProviderName;
  131. uint8_t serviceProviderName[LPA_SERVICE_PROVIDER_NAME_LENGTH + 2];
  132. uint8_t bProfileName;
  133. uint8_t profileName[LPA_PROFILE_NAME_LENGTH + 2];
  134. uint8_t bIconType;
  135. uint8_t iconType; //0:jpg;1:png
  136. uint8_t bPIcon;
  137. uint8_t *pIcon;
  138. uint8_t bProfileClass;
  139. uint8_t profileClass; //0:test;1:provisioning;2:operational
  140. uint8_t bNotificationConfigurationInfo;
  141. LPA_NOTIFICATION_CONFIGURATION_INFORMATION_T notificationConfigurationInfo[LPA_NOTIFICATION_CONFIGURATION_INFO_NUM];
  142. uint8_t bProfileOwner;
  143. LPA_OPERATOR_ID_T profileOwner;
  144. uint8_t bDpProprietaryData;
  145. uint8_t dpProprietaryData[LPA_DP_PROPRITARY_DATA_LENGTH];
  146. uint8_t bProfilePolicyRules;
  147. LPA_PPR_IDS_T profilePolicyRules;
  148. } LPA_PROFILE_INFO_T;
  149. #define LPA_MAX_PROFILE_NUM 5
  150. typedef struct
  151. {
  152. uint8_t nProfofileInfo;
  153. LPA_PROFILE_INFO_T *pProfileInfo[LPA_MAX_PROFILE_NUM];
  154. } LPA_PROFILE_INFO_LIST_T;
  155. uint32_t luid_GetProfilesInfo(void *ctx, lpad_callback callback, CFW_SIM_ID nSimId);
  156. uint32_t luid_EnableProfile(void *ctx, uint8_t bIccid, uint8_t *pData, uint8_t refreshFlag, lpad_callback callback, CFW_SIM_ID nSimId);
  157. uint32_t luid_DisableProfile(void *ctx, uint8_t bIccid, uint8_t *pData, uint8_t refreshFlag, lpad_callback callback, CFW_SIM_ID nSimId);
  158. uint32_t luid_DeleteProfile(void *ctx, uint8_t bIccid, uint8_t *pData, lpad_callback callback, CFW_SIM_ID nSimId);
  159. uint32_t luid_eUICCMemoryReset(void *ctx, uint8_t bOperationalProfiles, uint8_t bFieldLoadedTestProfiles, uint8_t bDefaultSmdpAddress, lpad_callback callback, CFW_SIM_ID nSimId);
  160. uint32_t luid_GetEID(void *ctx, lpad_callback callback, CFW_SIM_ID nSimId);
  161. uint32_t luid_SetNickname(void *ctx, void *pIccid, char *pNickname, lpad_callback callback, CFW_SIM_ID nSimId);
  162. //Gaurdian
  163. #define LPA_GUARDIAN_APP_EVENT_PATH "esim_uni_plus_server/api/event"
  164. #define LPA_GUARDIAN_APP_UPDATE_PATH "esim_uni_plus_server/api/updata"
  165. void lpa_guardian_set_app_id(const char *pAppId);
  166. void lpa_guardian_set_app_secret(const char *pAppSecret);
  167. void lpa_guardian_set_app_url(const char *pAppUrl);
  168. uint32_t lpa_guardian_start(void *ctx, lpad_callback callback, CFW_SIM_ID nSim);
  169. //internal other module
  170. void lpas_handle_cfw_event(const osiEvent_t *event);
  171. #ifdef __cplusplus
  172. }
  173. #endif
  174. #endif