Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
parser_url.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: MIT */
2
3/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to
7 * deal in the Software without restriction, including without limitation the
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 * sell copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23#ifndef ZEPHYR_INCLUDE_NET_HTTP_PARSER_URL_H_
24#define ZEPHYR_INCLUDE_NET_HTTP_PARSER_URL_H_
25
26#include <sys/types.h>
27#include <zephyr/types.h>
28#include <stddef.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
36 UF_SCHEMA = 0
37 , UF_HOST = 1
38 , UF_PORT = 2
39 , UF_PATH = 3
43 , UF_MAX = 7
44};
45
46/* Result structure for http_parser_url_fields().
47 *
48 * Callers should index into field_data[] with UF_* values iff field_set
49 * has the relevant (1 << UF_*) bit set. As a courtesy to clients (and
50 * because we probably have padding left over), we convert any port to
51 * a uint16_t.
52 */
54 uint16_t field_set; /* Bitmask of (1 << UF_*) values */
55 uint16_t port; /* Converted UF_PORT string */
56
57 struct {
58 uint16_t off; /* Offset into buffer in which field
59 * starts
60 */
61 uint16_t len; /* Length of run in buffer */
63};
64
65enum state parse_url_char(enum state s, const char ch);
66
67/* Initialize all http_parser_url members to 0 */
69
70/* Parse a URL; return nonzero on failure */
71int http_parser_parse_url(const char *buf, size_t buflen,
72 int is_connect, struct http_parser_url *u);
73
74#ifdef __cplusplus
75}
76#endif
77#endif
irp nz macro MOVR cc s mov cc s endm endr irp aw macro LDR aa s
Definition: asm-macro-32-bit-gnu.h:17
state
Definition: parser_state.h:29
void http_parser_url_init(struct http_parser_url *u)
http_parser_url_fields
Definition: parser_url.h:35
@ UF_FRAGMENT
Definition: parser_url.h:41
@ UF_PORT
Definition: parser_url.h:38
@ UF_MAX
Definition: parser_url.h:43
@ UF_PATH
Definition: parser_url.h:39
@ UF_SCHEMA
Definition: parser_url.h:36
@ UF_QUERY
Definition: parser_url.h:40
@ UF_USERINFO
Definition: parser_url.h:42
@ UF_HOST
Definition: parser_url.h:37
enum state parse_url_char(enum state s, const char ch)
int http_parser_parse_url(const char *buf, size_t buflen, int is_connect, struct http_parser_url *u)
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Definition: parser_url.h:53
uint16_t len
Definition: parser_url.h:61
uint16_t off
Definition: parser_url.h:58
uint16_t field_set
Definition: parser_url.h:54
uint16_t port
Definition: parser_url.h:55
struct http_parser_url::@298 field_data[UF_MAX]