UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
uri.hpp
Go to the documentation of this file.
1#ifndef COMPA_GENLIB_NET_URI_HPP
2#define COMPA_GENLIB_NET_URI_HPP
3/* *****************************************************************************
4 *
5 * Copyright (c) 2000-2003 Intel Corporation
6 * All rights reserved.
7 * Copyright (C) 2021+ GPL 3 and higher by Ingo Höft, <Ingo@Hoeft-online.de>
8 * Redistribution only with this Copyright remark. Last modified: 2026-04-01
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
12 *
13 * - Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * - Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * - Neither name of Intel Corporation nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
26 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
30 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 * ****************************************************************************/
40#include <membuffer.hpp>
41#include <UPnPsdk/uri.hpp>
42
44#include <cstring>
46
51struct URL_list {
52 size_t size;
53 char* URLs;
59};
60
84 memptr* a_url_list,
86 URL_list* a_out);
87
100int copy_URL_list(
102 URL_list* in,
104 URL_list* out);
105
112void free_URL_list(
114 URL_list* list);
115
116#if defined(DEBUG) || defined(DOXYGEN_RUN)
119void print_uri(uri_type* in
120);
121#else
122#define print_uri(in) \
123 do { \
124 } while (0)
125#endif
126
127#if defined(DEBUG) || defined(DOXYGEN_RUN)
130void print_token( //
131 token* in
132);
133#else
134#define print_token(in) \
135 do { \
136 } while (0)
137#endif
138
150 token* in1,
152 const char* in2);
153
162int token_cmp(
164 token* in1,
166 token* in2);
167
191char* resolve_rel_url(
193 char* a_base_url,
195 char* a_rel_url);
196
204 char* in,
206 token* out,
208 int max_size);
209
210#endif /* COMPA_GENLIB_NET_URI_HPP */
int parse_token(char *in, token *out, int max_size)
char * URLs
Definition uri.hpp:53
int copy_URL_list(URL_list *in, URL_list *out)
Copies one URL_list into another.
Definition uri.cpp:180
uri_type * parsedURLs
Definition uri.hpp:57
int token_cmp(token *in1, token *in2)
Compares two tokens.
Definition uri.cpp:265
size_t size
Number of urls (not characters).
Definition uri.hpp:52
int token_string_casecmp(token *in1, const char *in2)
Compares buffer in the token object with the buffer in in2 case insensitive.
Definition uri.cpp:251
char * resolve_rel_url(char *a_base_url, char *a_rel_url)
Resolves a relative url with a base url.
Definition uri.cpp:275
void print_uri(uri_type *in)
Function useful in debugging for printing a parsed uri.
Definition uri.cpp:233
void print_token(token *in)
Function useful in debugging for printing a token.
Definition uri.cpp:240
int create_url_list(memptr *a_url_list, URL_list *a_out)
Function to parse the Callback header value in subscription requests.
Definition uri.cpp:89
void free_URL_list(URL_list *list)
Frees the memory associated with a URL_list.
Definition uri.cpp:221
Represents a list of URLs as in the "callback" header of SUBSCRIBE message in GENA.
Definition uri.hpp:51
Manage Uniform Resource Identifier (URI) as specified with RFC 3986.
Represents a URI used in parse_uri and elsewhere.
Definition uri.hpp:64
Buffer used in parsing http messages, urls, etc. Generally this simply holds a pointer into a larger ...
Definition uri.hpp:48
Manage blocks of dynamically allocated memory.
pointer to a chunk of memory.
Definition membuffer.hpp:50