Golioth Firmware SDK
Loading...
Searching...
No Matches
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
7#ifdef __cplusplus
8extern "C"
9{
10#endif
11
12#pragma once
13
15#define FOREACH_GOLIOTH_STATUS(STATUS) \
16 STATUS(GOLIOTH_OK) /* 0 */ \
17 STATUS(GOLIOTH_ERR_FAIL) \
18 STATUS(GOLIOTH_ERR_DNS_LOOKUP) \
19 STATUS(GOLIOTH_ERR_NOT_IMPLEMENTED) \
20 STATUS(GOLIOTH_ERR_MEM_ALLOC) \
21 STATUS(GOLIOTH_ERR_NULL) /* 5 */ \
22 STATUS(GOLIOTH_ERR_INVALID_FORMAT) \
23 STATUS(GOLIOTH_ERR_SERIALIZE) \
24 STATUS(GOLIOTH_ERR_IO) \
25 STATUS(GOLIOTH_ERR_TIMEOUT) \
26 STATUS(GOLIOTH_ERR_QUEUE_FULL) /* 10 */ \
27 STATUS(GOLIOTH_ERR_NOT_ALLOWED) \
28 STATUS(GOLIOTH_ERR_INVALID_STATE) \
29 STATUS(GOLIOTH_ERR_NO_MORE_DATA) \
30 STATUS(GOLIOTH_ERR_NACK) \
31 STATUS(GOLIOTH_ERR_BAD_REQUEST) /* 15 */ \
32 STATUS(GOLIOTH_ERR_INVALID_BLOCK_SIZE) \
33 STATUS(GOLIOTH_ERR_COAP_RESPONSE)
34
35#define GENERATE_GOLIOTH_STATUS_ENUM(code) code,
40
46const char *golioth_status_to_str(enum golioth_status status);
47
51#define GOLIOTH_STATUS_RETURN_IF_ERROR(expr) \
52 do \
53 { \
54 enum golioth_status status = (expr); \
55 if (status != GOLIOTH_OK) \
56 { \
57 return status; \
58 } \
59 } while (0)
60
61#ifdef __cplusplus
62}
63#endif
golioth_status
#define FOREACH_GOLIOTH_STATUS(STATUS)
Status code enum used throughout Golioth SDK.
#define GENERATE_GOLIOTH_STATUS_ENUM(code)
const char * golioth_status_to_str(enum golioth_status status)