source: azure_iot_hub_f767zi/trunk/azure_iot_sdk/provisioning_client/inc/azure_prov_client/internal/iothub_auth_client.h@ 457

Last change on this file since 457 was 457, checked in by coas-nagasima, 4 years ago

ファイルを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 2.1 KB
Line 
1// Copyright (c) Microsoft. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
4#ifndef DEVICE_AUTH_H
5#define DEVICE_AUTH_H
6
7#ifdef __cplusplus
8extern "C" {
9#include <cstdint>
10#include <cstddef>
11#else
12#include <stdint.h>
13#include <stddef.h>
14#endif /* __cplusplus */
15
16#include "umock_c/umock_c_prod.h"
17#include "azure_macro_utils/macro_utils.h"
18
19typedef struct IOTHUB_SECURITY_INFO_TAG* IOTHUB_SECURITY_HANDLE;
20
21#define DEVICE_AUTH_TYPE_VALUES \
22 AUTH_TYPE_UNKNOWN, \
23 AUTH_TYPE_SAS, \
24 AUTH_TYPE_X509, \
25 AUTH_TYPE_SYMM_KEY
26
27MU_DEFINE_ENUM_WITHOUT_INVALID(DEVICE_AUTH_TYPE, DEVICE_AUTH_TYPE_VALUES);
28
29typedef struct DEVICE_AUTH_SAS_INFO_TAG
30{
31 uint64_t expiry_seconds;
32 const char* token_scope;
33 const char* key_name;
34} DEVICE_AUTH_SAS_INFO;
35
36typedef struct DEVICE_AUTH_SAS_RESULT_TAG
37{
38 const char* sas_token;
39} DEVICE_AUTH_SAS_RESULT;
40
41typedef struct DEVICE_AUTH_X509_RESULT_TAG
42{
43 const char* x509_cert;
44 const char* x509_alias_key;
45} DEVICE_AUTH_X509_RESULT;
46
47typedef struct DEVICE_AUTH_CREDENTIAL_INFO_TAG
48{
49 DEVICE_AUTH_TYPE dev_auth_type;
50 DEVICE_AUTH_SAS_INFO sas_info;
51} DEVICE_AUTH_CREDENTIAL_INFO;
52
53typedef struct CREDENTIAL_RESULT_TAG
54{
55 DEVICE_AUTH_TYPE dev_auth_type;
56 union
57 {
58 DEVICE_AUTH_SAS_RESULT sas_result;
59 DEVICE_AUTH_X509_RESULT x509_result;
60 } auth_cred_result;
61} CREDENTIAL_RESULT;
62
63
64MOCKABLE_FUNCTION(, IOTHUB_SECURITY_HANDLE, iothub_device_auth_create);
65MOCKABLE_FUNCTION(, void, iothub_device_auth_destroy, IOTHUB_SECURITY_HANDLE, handle);
66MOCKABLE_FUNCTION(, DEVICE_AUTH_TYPE, iothub_device_auth_get_type, IOTHUB_SECURITY_HANDLE, handle);
67MOCKABLE_FUNCTION(, CREDENTIAL_RESULT*, iothub_device_auth_generate_credentials, IOTHUB_SECURITY_HANDLE, handle, const DEVICE_AUTH_CREDENTIAL_INFO*, dev_auth_cred);
68
69#ifdef USE_EDGE_MODULES
70MOCKABLE_FUNCTION(, char*, iothub_device_auth_get_trust_bundle, IOTHUB_SECURITY_HANDLE, handle);
71#endif
72
73
74#ifdef __cplusplus
75}
76#endif /* __cplusplus */
77
78#endif // DEVICE_AUTH
Note: See TracBrowser for help on using the repository browser.