Golioth Firmware SDK
golioth_status.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 Golioth, Inc.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #pragma once
7 
9 #define FOREACH_GOLIOTH_STATUS(STATUS) \
10  STATUS(GOLIOTH_OK) /* 0 */ \
11  STATUS(GOLIOTH_ERR_FAIL) \
12  STATUS(GOLIOTH_ERR_DNS_LOOKUP) \
13  STATUS(GOLIOTH_ERR_NOT_IMPLEMENTED) \
14  STATUS(GOLIOTH_ERR_MEM_ALLOC) \
15  STATUS(GOLIOTH_ERR_NULL) /* 5 */ \
16  STATUS(GOLIOTH_ERR_INVALID_FORMAT) \
17  STATUS(GOLIOTH_ERR_SERIALIZE) \
18  STATUS(GOLIOTH_ERR_IO) \
19  STATUS(GOLIOTH_ERR_TIMEOUT) \
20  STATUS(GOLIOTH_ERR_QUEUE_FULL) /* 10 */ \
21  STATUS(GOLIOTH_ERR_NOT_ALLOWED) \
22  STATUS(GOLIOTH_ERR_INVALID_STATE) \
23  STATUS(GOLIOTH_ERR_NO_MORE_DATA)
24 
25 #define GENERATE_GOLIOTH_STATUS_ENUM(code) code,
26 typedef enum {
29 
36 
40 #define GOLIOTH_STATUS_RETURN_IF_ERROR(expr) \
41  do { \
42  golioth_status_t status = (expr); \
43  if (status != GOLIOTH_OK) { \
44  return status; \
45  } \
46  } while (0)
const char * golioth_status_to_str(golioth_status_t status)
golioth_status_t
#define FOREACH_GOLIOTH_STATUS(STATUS)
Status code enum used throughout Golioth SDK.
Definition: golioth_status.h:9
#define GENERATE_GOLIOTH_STATUS_ENUM(code)