Azure SDK for Embedded C
Typedefs | Enumerations | Functions
az_result.h File Reference

Definition of az_result and helper functions. More...

#include <stdbool.h>
#include <stdint.h>
#include <azure/core/_az_cfg_prefix.h>
#include <azure/core/_az_cfg_suffix.h>

Go to the source code of this file.

Typedefs

typedef int32_t az_result
 The type represents the various success and error conditions. More...
 

Enumerations

enum  {
  AZ_HTTP_REQUEST_URL_BUFFER_SIZE = 2 * 1024, AZ_HTTP_REQUEST_BODY_BUFFER_SIZE = 1024, AZ_LOG_MESSAGE_BUFFER_SIZE = 1024 , AZ_IOT_DEFAULT_MQTT_CONNECT_PORT = 8883,
  AZ_IOT_DEFAULT_MQTT_CONNECT_KEEPALIVE_SECONDS = 240, AZ_HUB_CLIENT_DEFAULT_MQTT_TELEMETRY_QOS = 0
}
 
enum  
 
enum  az_result_core {
  AZ_OK = _az_RESULT_MAKE_SUCCESS(_az_FACILITY_CORE, 0), AZ_ERROR_CANCELED = _az_RESULT_MAKE_ERROR(_az_FACILITY_CORE, 0), AZ_ERROR_ARG = _az_RESULT_MAKE_ERROR(_az_FACILITY_CORE, 1), AZ_ERROR_NOT_ENOUGH_SPACE = _az_RESULT_MAKE_ERROR(_az_FACILITY_CORE, 2),
  AZ_ERROR_NOT_IMPLEMENTED = _az_RESULT_MAKE_ERROR(_az_FACILITY_CORE, 3), AZ_ERROR_ITEM_NOT_FOUND = _az_RESULT_MAKE_ERROR(_az_FACILITY_CORE, 4), AZ_ERROR_UNEXPECTED_CHAR = _az_RESULT_MAKE_ERROR(_az_FACILITY_CORE, 5), AZ_ERROR_UNEXPECTED_END = _az_RESULT_MAKE_ERROR(_az_FACILITY_CORE, 6),
  AZ_ERROR_NOT_SUPPORTED = _az_RESULT_MAKE_ERROR(_az_FACILITY_CORE, 7), AZ_ERROR_DEPENDENCY_NOT_PROVIDED = _az_RESULT_MAKE_ERROR(_az_FACILITY_CORE, 8), AZ_ERROR_OUT_OF_MEMORY = _az_RESULT_MAKE_ERROR(_az_FACILITY_PLATFORM, 1), AZ_ERROR_JSON_INVALID_STATE = _az_RESULT_MAKE_ERROR(_az_FACILITY_JSON, 1),
  AZ_ERROR_JSON_NESTING_OVERFLOW = _az_RESULT_MAKE_ERROR(_az_FACILITY_JSON, 2), AZ_ERROR_JSON_READER_DONE = _az_RESULT_MAKE_ERROR(_az_FACILITY_JSON, 3), AZ_ERROR_HTTP_INVALID_STATE = _az_RESULT_MAKE_ERROR(_az_FACILITY_HTTP, 1), AZ_ERROR_HTTP_PIPELINE_INVALID_POLICY = _az_RESULT_MAKE_ERROR(_az_FACILITY_HTTP, 2),
  AZ_ERROR_HTTP_INVALID_METHOD_VERB = _az_RESULT_MAKE_ERROR(_az_FACILITY_HTTP, 3), AZ_ERROR_HTTP_AUTHENTICATION_FAILED = _az_RESULT_MAKE_ERROR(_az_FACILITY_HTTP, 4), AZ_ERROR_HTTP_RESPONSE_OVERFLOW = _az_RESULT_MAKE_ERROR(_az_FACILITY_HTTP, 5), AZ_ERROR_HTTP_RESPONSE_COULDNT_RESOLVE_HOST = _az_RESULT_MAKE_ERROR(_az_FACILITY_HTTP, 6),
  AZ_ERROR_HTTP_CORRUPT_RESPONSE_HEADER = _az_RESULT_MAKE_ERROR(_az_FACILITY_HTTP, 7), AZ_ERROR_HTTP_END_OF_HEADERS = _az_RESULT_MAKE_ERROR(_az_FACILITY_HTTP, 8), AZ_ERROR_HTTP_ADAPTER = _az_RESULT_MAKE_ERROR(_az_FACILITY_HTTP, 9)
}
 The type represents the various az_result success and error conditions specific to SDK Core. More...
 

Functions

AZ_NODISCARD AZ_INLINE bool az_result_failed (az_result result)
 Checks whether the result provided indicates a failure. More...
 
AZ_NODISCARD AZ_INLINE bool az_result_succeeded (az_result result)
 Checks whether the result provided indicates a success. More...
 

Detailed Description

Definition of az_result and helper functions.

Note
You MUST NOT use any symbols (macros, functions, structures, enums, etc.) prefixed with an underscore ('_') directly in your application code. These symbols are part of Azure SDK's internal implementation; we do not document these symbols and they are subject to change in future versions of the SDK which would break your code.

Typedef Documentation

◆ az_result

typedef int32_t az_result

The type represents the various success and error conditions.

Note
See the following az_result values from various headers:

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
AZ_HTTP_REQUEST_URL_BUFFER_SIZE 

The maximum buffer size for a URL.

AZ_HTTP_REQUEST_BODY_BUFFER_SIZE 

The maximum buffer size for an HTTP request body.

AZ_LOG_MESSAGE_BUFFER_SIZE 

The maximum buffer size for a log message.

◆ az_result_core

The type represents the various az_result success and error conditions specific to SDK Core.

Enumerator
AZ_OK 

Success.

AZ_ERROR_CANCELED 

A context was canceled, and a function had to return before result was ready.

AZ_ERROR_ARG 

Input argument does not comply with the expected range of values.

AZ_ERROR_NOT_ENOUGH_SPACE 

The destination size is too small for the operation.

AZ_ERROR_NOT_IMPLEMENTED 

Requested functionality is not implemented.

AZ_ERROR_ITEM_NOT_FOUND 

Requested item was not found.

AZ_ERROR_UNEXPECTED_CHAR 

Input can't be successfully parsed.

AZ_ERROR_UNEXPECTED_END 

Unexpected end of the input data.

AZ_ERROR_NOT_SUPPORTED 

Not supported.

AZ_ERROR_DEPENDENCY_NOT_PROVIDED 

An external dependency required to perform the operation was not provided. The operation needs an implementation of the platform layer or an HTTP transport adapter.

AZ_ERROR_OUT_OF_MEMORY 

Dynamic memory allocation request was not successful.

AZ_ERROR_JSON_INVALID_STATE 

The kind of the token being read is not compatible with the expected type of the value.

AZ_ERROR_JSON_NESTING_OVERFLOW 

The JSON depth is too large.

AZ_ERROR_JSON_READER_DONE 

No more JSON text left to process.

AZ_ERROR_HTTP_INVALID_STATE 

The az_http_response instance is in an invalid state.

AZ_ERROR_HTTP_PIPELINE_INVALID_POLICY 

HTTP pipeline is malformed.

AZ_ERROR_HTTP_INVALID_METHOD_VERB 

Unknown HTTP method verb.

AZ_ERROR_HTTP_AUTHENTICATION_FAILED 

Authentication failed.

AZ_ERROR_HTTP_RESPONSE_OVERFLOW 

HTTP response overflow.

AZ_ERROR_HTTP_RESPONSE_COULDNT_RESOLVE_HOST 

Couldn't resolve host.

AZ_ERROR_HTTP_CORRUPT_RESPONSE_HEADER 

Error while parsing HTTP response header.

AZ_ERROR_HTTP_END_OF_HEADERS 

There are no more headers within the HTTP response payload.

AZ_ERROR_HTTP_ADAPTER 

Generic error in the HTTP transport adapter implementation.

Function Documentation

◆ az_result_failed()

AZ_NODISCARD AZ_INLINE bool az_result_failed ( az_result  result)

Checks whether the result provided indicates a failure.

Parameters
[in]resultResult value to check for failure.
Return values
trueThe operation that returned this result failed.
falseThe operation that returned this result was successful.

◆ az_result_succeeded()

AZ_NODISCARD AZ_INLINE bool az_result_succeeded ( az_result  result)

Checks whether the result provided indicates a success.

Parameters
[in]resultResult value to check for success.
Return values
<tt>true</tt>The operation that returned this result was successful.
<tt>false</tt>The operation that returned this result failed.