libcoap  4.0.3
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
uri.h
Go to the documentation of this file.
1 /* uri.h -- helper functions for URI treatment
2  *
3  * Copyright (C) 2010,2011 Olaf Bergmann <bergmann@tzi.org>
4  *
5  * This file is part of the CoAP library libcoap. Please see
6  * README for terms of use.
7  */
8 
9 #ifndef _COAP_URI_H_
10 #define _COAP_URI_H_
11 
12 #include "hashkey.h"
13 #include "str.h"
14 
18 typedef struct {
20  unsigned short port;
21  str path;
24 } coap_uri_t;
25 
35 coap_uri_t *coap_new_uri(const unsigned char *uri, unsigned int length);
36 
42 
53 int coap_hash_path(const unsigned char *path, size_t len, coap_key_t key);
54 
78 typedef struct {
79  size_t n;
80  unsigned char separator;
81  unsigned char *delim;
82  size_t dlen;
83  unsigned char *pos;
84  size_t segment_length;
86 
100 coap_parse_iterator_init(unsigned char *s, size_t n,
101  unsigned char separator,
102  unsigned char *delim, size_t dlen,
104 
116 unsigned char *coap_parse_next(coap_parse_iterator_t *pi);
117 
134 int
135 coap_split_uri(unsigned char *str_var, size_t len, coap_uri_t *uri);
136 
150 int coap_split_path(const unsigned char *s, size_t length,
151  unsigned char *buf, size_t *buflen);
152 
168 int coap_split_query(const unsigned char *s, size_t length,
169  unsigned char *buf, size_t *buflen);
170 
173 #endif /* _COAP_URI_H_ */