xref: /third_party/libcoap/examples/coap_list.h (revision c87c5fba)
1/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 * -*- */
2
3/* coap_list.h -- CoAP list structures
4 *
5 * Copyright (C) 2010,2011,2015 Olaf Bergmann <bergmann@tzi.org>
6 *
7 * SPDX-License-Identifier: BSD-2-Clause
8 *
9 * This file is part of the CoAP library libcoap. Please see README for terms of
10 * use.
11 */
12
13/*
14 * examples/coap_list.[ch] are DEPRECATED.  You should be using
15 * struct coap_optlist_t instead with the following functions which are a part
16 * of libcoap.
17 *
18 * coap_new_optlist()
19 * coap_insert_optlist()
20 * coap_delete_optlist()
21 * coap_add_optlist_pdu()
22 *
23 * See 'man coap_pdu_setup' for further information.
24 *
25 * examples/coap_list.[ch] files will be removed in a future release
26 * They are left here to support building backward compatibility of old versions
27 * of coap-client
28 */
29
30#ifndef COAP_LIST_H_
31#define COAP_LIST_H_
32
33#include <coap3/utlist.h>
34
35typedef struct coap_list_t {
36  struct coap_list_t *next;
37  char data[];
38} coap_list_t;
39
40/**
41 * Adds node to given queue, ordered by specified order function. Returns 1
42 * when insert was successful, 0 otherwise.
43 */
44int coap_insert(coap_list_t **queue, coap_list_t *node);
45
46/* destroys specified node */
47int coap_delete(coap_list_t *node);
48
49/* removes all items from given queue and frees the allocated storage */
50void coap_delete_list(coap_list_t *queue);
51
52#endif /* COAP_LIST_H_ */
53