1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
//
// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
// file was obtained (LICENSE.txt). A copy of the license may also be
// found online at https://opensource.org/licenses/MIT.
//
#ifndef CORE_URL_H
#define CORE_URL_H
#include "defs.h"
struct nng_url {
const char *u_scheme; // never NULL
const char *u_userinfo; // will be NULL if not specified
char *u_hostname; // name only, will be "" if not specified
uint32_t u_port; // port, may be zero for schemes that do not use
char *u_path; // path, will be "" if not specified
char *u_query; // without '?', will be NULL if not specified
char *u_fragment; // without '#', will be NULL if not specified
// these members are private
char *u_buffer;
size_t u_bufsz;
char u_static[NNG_MAXADDRLEN]; // Most URLs fit within this
};
extern uint16_t nni_url_default_port(const char *);
extern nng_err nni_url_asprintf(char **, const nng_url *);
extern nng_err nni_url_asprintf_port(char **, const nng_url *, int);
extern size_t nni_url_decode(uint8_t *, const char *, size_t);
extern nng_err nni_url_to_address(nng_sockaddr *, const nng_url *);
extern nng_err nni_url_parse_inline(nng_url *, const char *);
extern nng_err nni_url_clone_inline(nng_url *, const nng_url *);
extern void nni_url_fini(nng_url *);
extern nng_err nni_url_canonify_uri(char *);
#endif // CORE_URL_H
|