Loading...
Searching...
No Matches
lc.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 HAW Hamburg
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
49#ifndef NET_CORD_LC_H
50#define NET_CORD_LC_H
51
52#include "net/sock/udp.h"
53#include "net/nanocoap.h"
54#include "clif.h"
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
63enum {
69};
70
74enum {
77};
78
82typedef struct {
84 char *res_lookif;
85 char *ep_lookif;
86 unsigned res_last_page;
87 unsigned ep_last_page;
89
98
110
126int cord_lc_rd_init(cord_lc_rd_t *rd, void *buf, size_t maxlen,
127 const sock_udp_ep_t *remote);
128
154ssize_t cord_lc_raw(const cord_lc_rd_t *rd, unsigned content_format,
155 unsigned lookup_type, cord_lc_filter_t *filters,
156 void *result, size_t maxlen);
157
182 cord_lc_filter_t *filters, void *buf, size_t maxlen,
183 unsigned type);
184
206static inline ssize_t cord_lc_res(cord_lc_rd_t *rd, cord_lc_res_t *resource,
207 cord_lc_filter_t *filters, void *buf,
208 size_t maxlen)
209{
210 return _lookup_result(rd, resource, filters, buf, maxlen, CORD_LC_RES);
211}
212
234static inline ssize_t cord_lc_ep(cord_lc_rd_t *rd, cord_lc_ep_t *endpoint,
235 cord_lc_filter_t *filters, void *buf,
236 size_t maxlen)
237{
238 return _lookup_result(rd, endpoint, filters, buf, maxlen, CORD_LC_EP);
239}
240
241#ifdef __cplusplus
242}
243#endif
244
245#endif /* NET_CORD_LC_H */
CoRE Link Format encoding and decoding library public definitions.
ssize_t _lookup_result(cord_lc_rd_t *rd, cord_lc_res_t *result, cord_lc_filter_t *filters, void *buf, size_t maxlen, unsigned type)
Get one resource from RD server.
static ssize_t cord_lc_res(cord_lc_rd_t *rd, cord_lc_res_t *resource, cord_lc_filter_t *filters, void *buf, size_t maxlen)
Get one resource from RD server.
Definition lc.h:206
int cord_lc_rd_init(cord_lc_rd_t *rd, void *buf, size_t maxlen, const sock_udp_ep_t *remote)
Discover the lookup interfaces of a RD server.
ssize_t cord_lc_raw(const cord_lc_rd_t *rd, unsigned content_format, unsigned lookup_type, cord_lc_filter_t *filters, void *result, size_t maxlen)
Raw lookup for registered resources/endpoints at a RD server.
static ssize_t cord_lc_ep(cord_lc_rd_t *rd, cord_lc_ep_t *endpoint, cord_lc_filter_t *filters, void *buf, size_t maxlen)
Get one endpoint from RD server.
Definition lc.h:234
struct cord_lc_filter cord_lc_filter_t
Filters to use for a lookup.
@ CORD_LC_RES
Resource lookup type.
Definition lc.h:75
@ CORD_LC_EP
Endpoint lookup type.
Definition lc.h:76
@ CORD_LC_TIMEOUT
no response from the network
Definition lc.h:65
@ CORD_LC_NORSC
lookup interface not found
Definition lc.h:68
@ CORD_LC_OVERFLOW
internal buffers can not handle input
Definition lc.h:67
@ CORD_LC_OK
everything went as expected
Definition lc.h:64
@ CORD_LC_ERR
internal error or invalid reply
Definition lc.h:66
nanocoap API
UDP sock definitions.
Common IP-based transport layer end point.
Definition sock.h:215
Link format attribute descriptor.
Definition clif.h:137
Link format descriptor.
Definition clif.h:147
Filters to use for a lookup.
Definition lc.h:105
struct cord_lc_filter * next
Next set of filters.
Definition lc.h:108
size_t len
No.
Definition lc.h:107
clif_attr_t * array
Array of filter(s)
Definition lc.h:106
Information about RD server and its lookup interface resources.
Definition lc.h:82
unsigned res_last_page
Page of last resource lookup.
Definition lc.h:86
const sock_udp_ep_t * remote
Remote endpoint of RD server.
Definition lc.h:83
char * res_lookif
Resource lookup interface.
Definition lc.h:84
unsigned ep_last_page
Page of last endpoint lookup.
Definition lc.h:87
char * ep_lookif
Endpoint lookup interface.
Definition lc.h:85
Result of lookup.
Definition lc.h:93
size_t max_attrs
Max parameters at params.
Definition lc.h:96
clif_attr_t * attrs
Array of Link Format parameters.
Definition lc.h:95
clif_t link
Resource link.
Definition lc.h:94