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)
32
33#define GENERATE_GOLIOTH_STATUS_ENUM(code) code,
38
44const char *golioth_status_to_str(enum golioth_status status);
45
49#define GOLIOTH_STATUS_RETURN_IF_ERROR(expr) \
50 do \
51 { \
52 enum golioth_status status = (expr); \
53 if (status != GOLIOTH_OK) \
54 { \
55 return status; \
56 } \
57 } while (0)
58
59#ifdef __cplusplus
60}
61#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)