This commit is contained in:
jebrando 2019-03-29 09:33:35 -07:00
Родитель 96af582be5
Коммит 06bbd48bde
2 изменённых файлов: 2 добавлений и 117 удалений

Просмотреть файл

@ -1,109 +1,3 @@
# IoTHub MQTT Backward Compatibility Requirements
## Overview
IoTHub MQTT Backward Compatibility test will test the mqtt protocol to be backward compatible with future versions.
## IoTHubClient_Auth_Create
```c
extern IOTHUB_AUTHORIZATION_HANDLE IoTHubClient_Auth_Create(const char* device_key, const char* device_id, const char* device_sas_token);
```
**SRS_IoTHub_Authorization_07_001: [**if `device_id` is NULL `IoTHubClient_Auth_Create`, shall return NULL.**]**
**SRS_IoTHub_Authorization_07_002: [**`IoTHubClient_Auth_Create` shall allocate a `IOTHUB_AUTHORIZATION_HANDLE` that is needed for subsequent calls. **]**
**SRS_IoTHub_Authorization_07_003: [** `IoTHubClient_Auth_Create` shall set the credential type to IOTHUB_CREDENTIAL_TYPE_DEVICE_KEY if the device_sas_token is NULL. **]**
**SRS_IoTHub_Authorization_07_020: [** else `IoTHubClient_Auth_Create` shall set the credential type to IOTHUB_CREDENTIAL_TYPE_SAS_TOKEN. **]**
**SRS_IoTHub_Authorization_07_024: [** if device_sas_token and device_key are NULL `IoTHubClient_Auth_Create` shall set the credential type to IOTHUB_CREDENTIAL_TYPE_UNKNOWN. **]**
**SRS_IoTHub_Authorization_07_004: [** If successful `IoTHubClient_Auth_Create` shall return a `IOTHUB_AUTHORIZATION_HANDLE` value. **]**
**SRS_IoTHub_Authorization_07_019: [** On error `IoTHubClient_Auth_Create` shall return NULL. **]**
## IoTHubClient_Auth_Destroy
```c
extern void IoTHubClient_Auth_Destroy(IOTHUB_AUTHORIZATION_HANDLE handle);
```
**SRS_IoTHub_Authorization_07_005: [** if `handle` is NULL `IoTHubClient_Auth_Destroy` shall do nothing. **]**
**SRS_IoTHub_Authorization_07_006: [** `IoTHubClient_Auth_Destroy` shall free all resources associated with the `IOTHUB_AUTHORIZATION_HANDLE` handle. **]**
## IoTHub_Auth_Get_Credential_Type
```c
extern IOTHUB_CREDENTIAL_TYPE IoTHub_Auth_Get_Credential_Type(IOTHUB_AUTHORIZATION_HANDLE handle);
```
**SRS_IoTHub_Authorization_07_007: [** if `handle` is NULL `IoTHub_Auth_Get_Credential_Type` shall return `IOTHUB_CREDENTIAL_TYPE_UNKNOWN`. **]**
**SRS_IoTHub_Authorization_07_008: [** `IoTHub_Auth_Get_Credential_Type` shall return the credential type that is associated with the given handle. **]**
## IoTHubClient_Auth_Get_SasToken
```c
extern char* IoTHubClient_Auth_Get_SasToken(IOTHUB_AUTHORIZATION_HANDLE handle, const char* scope, size_t expiry_time_relative_seconds);
```
**SRS_IoTHub_Authorization_07_009: [** if `handle` or `scope` are NULL, `IoTHubClient_Auth_Get_SasToken` shall return NULL. **]**
**SRS_IoTHub_Authorization_07_010: [** `IoTHubClient_Auth_Get_SasToken` shall construct the expiration time using the handle->token_expiry_time_sec added to epoch time. **]**
**SRS_IoTHub_Authorization_07_011: [** `IoTHubClient_Auth_Get_SasToken` shall call SASToken_CreateString to construct the sas token. **]**
**SRS_IoTHub_Authorization_07_020: [** If any error is encountered `IoTHubClient_Auth_Get_SasToken` shall return NULL. **]**
**SRS_IoTHub_Authorization_07_012: [** On success `IoTHubClient_Auth_Get_SasToken` shall allocate and return the sas token in a char*. **]**
**SRS_IoTHub_Authorization_07_021: [** If the device_sas_token is NOT NULL `IoTHubClient_Auth_Get_SasToken` shall return a copy of the device_sas_token. **]**
## IoTHubClient_Auth_Get_DeviceId
```c
extern const char* IoTHubClient_Auth_Get_DeviceId(IOTHUB_AUTHORIZATION_HANDLE handle);
```
**SRS_IoTHub_Authorization_07_013: [** if `handle` is NULL, `IoTHubClient_Auth_Get_DeviceId` shall return NULL. **]**
**SRS_IoTHub_Authorization_07_014: [** `IoTHubClient_Auth_Get_DeviceId` shall return the device_id associated with `handle`. **]**
## IoTHubClient_Auth_Get_ModuleId
```c
extern const char* IoTHubClient_Auth_Get_ModuleId(IOTHUB_AUTHORIZATION_HANDLE handle);
```
**SRS_IoTHub_Authorization_31_025: [** if `handle` is NULL, `IoTHubClient_Auth_Get_ModuleId` shall return NULL. **]**
**SRS_IoTHub_Authorization_31_026: [** `IoTHubClient_Auth_Get_ModuleId` shall return the module_id associated with `handle`. **]**
## IoTHubClient_Auth_Get_DeviceKey
```c
extern const char* IoTHubClient_Auth_Get_DeviceKey(IOTHUB_AUTHORIZATION_HANDLE handle);
```
**SRS_IoTHub_Authorization_07_022: [** if `handle` is NULL, `IoTHubClient_Auth_Get_DeviceKey` shall return NULL. **]**
**SRS_IoTHub_Authorization_07_023: [** `IoTHubClient_Auth_Get_DeviceKey` shall return the device_Key associated with `handle`. **]**
## IoTHubClient_Auth_Is_SasToken_Valid
```c
extern bool IoTHubClient_Auth_Is_SasToken_Valid(IOTHUB_AUTHORIZATION_HANDLE handle);
```
**SRS_IoTHub_Authorization_07_015: [** if `handle` is NULL, `IoTHubClient_Auth_Is_SasToken_Valid` shall return false. **]**
**SRS_IoTHub_Authorization_07_016: [** if credential type is not equal to IOTHUB_CREDENTIAL_TYPE_SAS_TOKEN `IoTHubClient_Auth_Is_SasToken_Valid` shall return true. **]**
**SRS_IoTHub_Authorization_07_017: [** If the sas_token is NULL `IoTHubClient_Auth_Is_SasToken_Valid` shall return false. **]**
**SRS_IoTHub_Authorization_07_018: [** otherwise `IoTHubClient_Auth_Is_SasToken_Valid` shall return the value returned by `SASToken_Validate`. **]**

Просмотреть файл

@ -13,15 +13,6 @@
#include <string.h>
#endif
#ifdef AZIOT_LINUX
#include <unistd.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#endif
#include "iothub.h"
#include "iothub_device_client_ll.h"
#include "iothub_client_options.h"
@ -378,7 +369,7 @@ static IOTHUB_DEVICE_CLIENT_LL_HANDLE create_device_client(BACK_COMPAT_INFO* bac
break;
}
}
// Always set the log trace option
// Always set the log trace option
if (result != NULL)
{
bool trace_on = true;
@ -390,7 +381,7 @@ static IOTHUB_DEVICE_CLIENT_LL_HANDLE create_device_client(BACK_COMPAT_INFO* bac
static int test_all_device_options(TEST_PROTOCOL_TYPE protocol_type, IOTHUB_DEVICE_CLIENT_LL_HANDLE device_client)
{
int result = 0;
size_t refresh_sas_token = 30 * 60;
size_t sas_token_refresh = 30 * 60;
tickcounter_ms_t msg_timeout = 2*60;