diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-18 18:49:01 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-18 18:49:01 -0800 |
| commit | 143b6322f8217cfdbef8f3171d55d10348d1be37 (patch) | |
| tree | 60eef8b31cf320c97c1affbbf80a968d6a63e583 /src/core/url.h | |
| parent | dd4695f9492b4f30978e9043d7d6925bfe15a715 (diff) | |
| download | nng-143b6322f8217cfdbef8f3171d55d10348d1be37.tar.gz nng-143b6322f8217cfdbef8f3171d55d10348d1be37.tar.bz2 nng-143b6322f8217cfdbef8f3171d55d10348d1be37.zip | |
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.
Diffstat (limited to 'src/core/url.h')
| -rw-r--r-- | src/core/url.h | 15 |
1 files changed, 15 insertions, 0 deletions
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); |
