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#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 STATUS(GOLIOTH_ERR_NACK) \
25 STATUS(GOLIOTH_ERR_BAD_REQUEST)
26
27#define GENERATE_GOLIOTH_STATUS_ENUM(code) code,
32
38const char *golioth_status_to_str(enum golioth_status status);
39
43#define GOLIOTH_STATUS_RETURN_IF_ERROR(expr) \
44 do \
45 { \
46 enum golioth_status status = (expr); \
47 if (status != GOLIOTH_OK) \
48 { \
49 return status; \
50 } \
51 } while (0)
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)