aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/nng/nng.h35
1 files changed, 21 insertions, 14 deletions
diff --git a/include/nng/nng.h b/include/nng/nng.h
index 47260b8d..8b56d15a 100644
--- a/include/nng/nng.h
+++ b/include/nng/nng.h
@@ -1082,20 +1082,7 @@ enum nng_errno_enum {
// URL support. We frequently want to process a URL, and these methods
// give us a convenient way of doing so.
-typedef 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
-} nng_url;
+typedef struct nng_url nng_url;
// nng_url_parse parses a URL string into a structured form.
// Note that the u_port member will be filled out with a numeric
@@ -1114,6 +1101,26 @@ NNG_DECL int nng_url_clone(nng_url **, const nng_url *);
// snprintf.
NNG_DECL int nng_url_sprintf(char *, size_t, const nng_url *);
+NNG_DECL const char *nng_url_scheme(const nng_url *);
+
+// Port (TCP) for a URL, can be zero for ports are not used by the scheme.
+NNG_DECL uint16_t nng_url_port(const nng_url *);
+
+// hostname part of URL, can be NULL if irerelvant to scheme
+const char *nng_url_hostname(const nng_url *);
+
+// user info part (thing before '@') of URL, NULL if absent.
+const char *nng_url_userinfo(const nng_url *);
+
+// path portion of URL, will always non-NULL, but may be empty.
+const char *nng_url_path(const nng_url *);
+
+// query info part of URL, not including '?, NULL if absent'
+const char *nng_url_query(const nng_url *);
+
+// fragment part of URL, not including '#', NULL if absent.
+const char *nng_url_fragment(const nng_url *);
+
// nng_version returns the library version as a human readable string.
NNG_DECL const char *nng_version(void);