Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Data Structures

struct  net_url_field
 A component of a URL, located in the string it was parsed from. More...
struct  net_url
 The components of a URL. More...

Functions

int net_url_parse (const char *url, struct net_url *out)
 Split a URL into its components.
bool net_url_scheme_is (const struct net_url *url, const char *scheme)
 Compare the scheme of a URL, ignoring case.
bool net_url_has_port (const struct net_url *url)
 Check whether a URL names a port.
int net_url_field_copy (const struct net_url *url, const struct net_url_field *field, char *dst, size_t dst_len)
 Copy a component into a NUL-terminated buffer.
int net_url_target_copy (const struct net_url *url, char *dst, size_t dst_len)
 Copy the request target of a URL into a NUL-terminated buffer.

Detailed Description

Since
4.6
Version
0.1.0

Function Documentation

◆ net_url_field_copy()

int net_url_field_copy ( const struct net_url * url,
const struct net_url_field * field,
char * dst,
size_t dst_len )

#include <zephyr/net/url.h>

Copy a component into a NUL-terminated buffer.

An absent component yields an empty string.

Parameters
urlParsed URL.
fieldComponent of url to copy.
dstDestination buffer.
dst_lenSize of dst.
Return values
0Success.
-ENOBUFSThe component and its terminator do not fit in dst.

◆ net_url_has_port()

bool net_url_has_port ( const struct net_url * url)

#include <zephyr/net/url.h>

Check whether a URL names a port.

Parameters
urlParsed URL.
Returns
true when the URL has a port.

◆ net_url_parse()

int net_url_parse ( const char * url,
struct net_url * out )

#include <zephyr/net/url.h>

Split a URL into its components.

The components are offsets into url, which must stay valid and unchanged while out is used.

Parameters
urlNUL-terminated URL.
outComponents of the URL.
Return values
0Success.
-EINVALurl or out is NULL, or url is not a URL.

◆ net_url_scheme_is()

bool net_url_scheme_is ( const struct net_url * url,
const char * scheme )

#include <zephyr/net/url.h>

Compare the scheme of a URL, ignoring case.

Parameters
urlParsed URL.
schemeScheme to compare with, without the "://".
Returns
true when the URL has scheme as scheme.

◆ net_url_target_copy()

int net_url_target_copy ( const struct net_url * url,
char * dst,
size_t dst_len )

#include <zephyr/net/url.h>

Copy the request target of a URL into a NUL-terminated buffer.

The request target is the path followed by "?" and the query when there is one, as sent in an HTTP request line. An empty path is written as "/".

Parameters
urlParsed URL.
dstDestination buffer.
dst_lenSize of dst.
Return values
0Success.
-ENOBUFSThe target and its terminator do not fit in dst.