aboutsummaryrefslogtreecommitdiff
path: root/src/core/endpt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/endpt.c')
-rw-r--r--src/core/endpt.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/src/core/endpt.c b/src/core/endpt.c
index 9fc26cf3..8e678fb0 100644
--- a/src/core/endpt.c
+++ b/src/core/endpt.c
@@ -582,26 +582,27 @@ nni_ep_pipe_remove(nni_ep *ep, nni_pipe *pipe)
}
int
-nni_ep_setopt(nni_ep *ep, const char *name, const void *val, size_t sz, int t)
+nni_ep_setopt(
+ nni_ep *ep, const char *name, const void *val, size_t sz, nni_opt_type t)
{
- nni_tran_ep_option *eo;
+ nni_tran_option *o;
if (strcmp(name, NNG_OPT_URL) == 0) {
return (NNG_EREADONLY);
}
- for (eo = ep->ep_ops.ep_options; eo && eo->eo_name; eo++) {
+ for (o = ep->ep_ops.ep_options; o && o->o_name; o++) {
int rv;
- if (strcmp(eo->eo_name, name) != 0) {
+ if (strcmp(o->o_name, name) != 0) {
continue;
}
- if (eo->eo_setopt == NULL) {
+ if (o->o_set == NULL) {
return (NNG_EREADONLY);
}
nni_mtx_lock(&ep->ep_mtx);
- rv = eo->eo_setopt(ep->ep_data, val, sz, t);
+ rv = o->o_set(ep->ep_data, val, sz, t);
nni_mtx_unlock(&ep->ep_mtx);
return (rv);
}
@@ -616,38 +617,21 @@ nni_ep_mode(nni_ep *ep)
}
int
-nni_ep_opttype(nni_ep *ep, const char *name, int *tp)
+nni_ep_getopt(
+ nni_ep *ep, const char *name, void *valp, size_t *szp, nni_opt_type t)
{
- nni_tran_ep_option *eo;
+ nni_tran_option *o;
- for (eo = ep->ep_ops.ep_options; eo && eo->eo_name; eo++) {
- if (strcmp(eo->eo_name, name) == 0) {
- *tp = eo->eo_type;
- return (0);
- }
- }
- if (strcmp(name, NNG_OPT_URL) == 0) {
- *tp = NNI_TYPE_STRING;
- return (0);
- }
- return (NNG_ENOTSUP);
-}
-
-int
-nni_ep_getopt(nni_ep *ep, const char *name, void *valp, size_t *szp, int t)
-{
- nni_tran_ep_option *eo;
-
- for (eo = ep->ep_ops.ep_options; eo && eo->eo_name; eo++) {
+ for (o = ep->ep_ops.ep_options; o && o->o_name; o++) {
int rv;
- if (strcmp(eo->eo_name, name) != 0) {
+ if (strcmp(o->o_name, name) != 0) {
continue;
}
- if (eo->eo_getopt == NULL) {
+ if (o->o_get == NULL) {
return (NNG_EWRITEONLY);
}
nni_mtx_lock(&ep->ep_mtx);
- rv = eo->eo_getopt(ep->ep_data, valp, szp, t);
+ rv = o->o_get(ep->ep_data, valp, szp, t);
nni_mtx_unlock(&ep->ep_mtx);
return (rv);
}