aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/defs.h1
-rw-r--r--src/core/dialer.c10
-rw-r--r--src/core/listener.c10
-rw-r--r--src/core/sockimpl.h4
-rw-r--r--src/core/url.c24
-rw-r--r--src/core/url.h10
6 files changed, 27 insertions, 32 deletions
diff --git a/src/core/defs.h b/src/core/defs.h
index 6d6e3ff6..46a32ef5 100644
--- a/src/core/defs.h
+++ b/src/core/defs.h
@@ -36,7 +36,6 @@
// Internal code should use these names when possible.
typedef nng_msg nni_msg;
typedef nng_sockaddr nni_sockaddr;
-typedef nng_url nni_url;
typedef nng_iov nni_iov;
typedef nng_aio nni_aio;
diff --git a/src/core/dialer.c b/src/core/dialer.c
index d39eb99a..2eb02471 100644
--- a/src/core/dialer.c
+++ b/src/core/dialer.c
@@ -42,7 +42,7 @@ nni_dialer_destroy(nni_dialer *d)
d->d_ops.d_fini(d->d_data);
}
nni_mtx_fini(&d->d_mtx);
- nni_url_free(d->d_url);
+ nng_url_free(d->d_url);
NNI_FREE_STRUCT(d);
}
@@ -214,19 +214,19 @@ nni_dialer_create(nni_dialer **dp, nni_sock *s, const char *url_str)
nni_sp_tran *tran;
nni_dialer *d;
int rv;
- nni_url *url;
+ nng_url *url;
- if ((rv = nni_url_parse(&url, url_str)) != 0) {
+ if ((rv = nng_url_parse(&url, url_str)) != 0) {
return (rv);
}
if (((tran = nni_sp_tran_find(url)) == NULL) ||
(tran->tran_dialer == NULL)) {
- nni_url_free(url);
+ nng_url_free(url);
return (NNG_ENOTSUP);
}
if ((d = NNI_ALLOC_STRUCT(d)) == NULL) {
- nni_url_free(url);
+ nng_url_free(url);
return (NNG_ENOMEM);
}
d->d_url = url;
diff --git a/src/core/listener.c b/src/core/listener.c
index e1cdf833..8fa50a4f 100644
--- a/src/core/listener.c
+++ b/src/core/listener.c
@@ -43,7 +43,7 @@ nni_listener_destroy(nni_listener *l)
if (l->l_data != NULL) {
l->l_ops.l_fini(l->l_data);
}
- nni_url_free(l->l_url);
+ nng_url_free(l->l_url);
NNI_FREE_STRUCT(l);
}
@@ -203,19 +203,19 @@ nni_listener_create(nni_listener **lp, nni_sock *s, const char *url_str)
nni_sp_tran *tran;
nni_listener *l;
int rv;
- nni_url *url;
+ nng_url *url;
- if ((rv = nni_url_parse(&url, url_str)) != 0) {
+ if ((rv = nng_url_parse(&url, url_str)) != 0) {
return (rv);
}
if (((tran = nni_sp_tran_find(url)) == NULL) ||
(tran->tran_listener == NULL)) {
- nni_url_free(url);
+ nng_url_free(url);
return (NNG_ENOTSUP);
}
if ((l = NNI_ALLOC_STRUCT(l)) == NULL) {
- nni_url_free(url);
+ nng_url_free(url);
return (NNG_ENOMEM);
}
l->l_url = url;
diff --git a/src/core/sockimpl.h b/src/core/sockimpl.h
index 0a5114c0..deb226e4 100644
--- a/src/core/sockimpl.h
+++ b/src/core/sockimpl.h
@@ -22,7 +22,7 @@ struct nni_dialer {
uint32_t d_id; // endpoint id
nni_list_node d_node; // per socket list
nni_sock *d_sock;
- nni_url *d_url;
+ nng_url *d_url;
nni_pipe *d_pipe; // active pipe (for re-dialer)
int d_ref;
bool d_closed; // full shutdown
@@ -63,7 +63,7 @@ struct nni_listener {
uint32_t l_id; // endpoint id
nni_list_node l_node; // per socket list
nni_sock *l_sock;
- nni_url *l_url;
+ nng_url *l_url;
int l_ref;
bool l_closed; // full shutdown
nni_atomic_flag l_closing; // close started (shutdown)
diff --git a/src/core/url.c b/src/core/url.c
index c5be4f83..6e17e8c7 100644
--- a/src/core/url.c
+++ b/src/core/url.c
@@ -326,9 +326,9 @@ nni_url_default_port(const char *scheme)
// scheme with a leading //, such as http:// or tcp://. So our parser
// is a bit more restricted, but sufficient for our needs.
int
-nni_url_parse(nni_url **urlp, const char *raw)
+nng_url_parse(nng_url **urlp, const char *raw)
{
- nni_url *url;
+ nng_url *url;
size_t len;
const char *s;
char *p;
@@ -523,12 +523,12 @@ nni_url_parse(nni_url **urlp, const char *raw)
return (0);
error:
- nni_url_free(url);
+ nng_url_free(url);
return (rv);
}
void
-nni_url_free(nni_url *url)
+nng_url_free(nng_url *url)
{
if (url != NULL) {
nni_strfree(url->u_rawurl);
@@ -540,7 +540,7 @@ nni_url_free(nni_url *url)
}
int
-nni_url_sprintf(char *str, size_t size, const nni_url *url)
+nng_url_sprintf(char *str, size_t size, const nng_url *url)
{
const char *scheme = url->u_scheme;
const char *host = url->u_hostname;
@@ -576,16 +576,16 @@ nni_url_sprintf(char *str, size_t size, const nni_url *url)
}
int
-nni_url_asprintf(char **str, const nni_url *url)
+nni_url_asprintf(char **str, const nng_url *url)
{
char *result;
size_t sz;
- sz = nni_url_sprintf(NULL, 0, url) + 1;
+ sz = nng_url_sprintf(NULL, 0, url) + 1;
if ((result = nni_alloc(sz)) == NULL) {
return (NNG_ENOMEM);
}
- nni_url_sprintf(result, sz, url);
+ nng_url_sprintf(result, sz, url);
*str = result;
return (0);
}
@@ -594,9 +594,9 @@ nni_url_asprintf(char **str, const nni_url *url)
// override. If non-zero, this port number replaces the port number
// in the port string.
int
-nni_url_asprintf_port(char **str, const nni_url *url, int port)
+nni_url_asprintf_port(char **str, const nng_url *url, int port)
{
- nni_url myurl = *url;
+ nng_url myurl = *url;
if (port > 0) {
myurl.u_port = (uint16_t) port;
@@ -607,9 +607,9 @@ nni_url_asprintf_port(char **str, const nni_url *url, int port)
#define URL_COPYSTR(d, s) ((s != NULL) && ((d = nni_strdup(s)) == NULL))
int
-nni_url_clone(nni_url **dstp, const nni_url *src)
+nng_url_clone(nng_url **dstp, const nng_url *src)
{
- nni_url *dst;
+ nng_url *dst;
if ((dst = NNI_ALLOC_STRUCT(dst)) == NULL) {
return (NNG_ENOMEM);
diff --git a/src/core/url.h b/src/core/url.h
index f43d3db6..2eb3ed46 100644
--- a/src/core/url.h
+++ b/src/core/url.h
@@ -13,14 +13,10 @@
#include "core/defs.h"
-extern int nni_url_parse(nni_url **, const char *path);
-extern void nni_url_free(nni_url *);
-extern int nni_url_clone(nni_url **, const nni_url *);
extern uint16_t nni_url_default_port(const char *);
-extern int nni_url_sprintf(char *, size_t, const nni_url *);
-extern int nni_url_asprintf(char **, const nni_url *);
-extern int nni_url_asprintf_port(char **, const nni_url *, int);
+extern int nni_url_asprintf(char **, const nng_url *);
+extern int nni_url_asprintf_port(char **, const nng_url *, int);
extern size_t nni_url_decode(uint8_t *, const char *, size_t);
-extern int nni_url_to_address(nng_sockaddr *, const nni_url *);
+extern int nni_url_to_address(nng_sockaddr *, const nng_url *);
#endif // CORE_URL_H