From 143b6322f8217cfdbef8f3171d55d10348d1be37 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 18 Nov 2024 18:49:01 -0800 Subject: Introduce accessors for nng_url struct and make it opaque. This provides safety by ensuring that applications do not depend on the size or layout of nng_url itself. --- src/core/url.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/core/url.h') diff --git a/src/core/url.h b/src/core/url.h index 2eb3ed46..f8a141ac 100644 --- a/src/core/url.h +++ b/src/core/url.h @@ -13,6 +13,21 @@ #include "core/defs.h" +struct nng_url { + char *u_rawurl; // never NULL + 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 + uint16_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 int nni_url_asprintf(char **, const nng_url *); extern int nni_url_asprintf_port(char **, const nng_url *, int); -- cgit v1.2.3-70-g09d2