diff options
| author | Garrett D'Amore <garrett@damore.org> | 2016-12-25 09:29:16 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2016-12-25 09:29:16 -0800 |
| commit | 7acc29013636d2ddc004acebe02d88722fe0c8db (patch) | |
| tree | a211c99284a165e3eb6f9d5f4fb71480e4873f7c | |
| parent | 147d8408f577678331daf1cd06ae9aac6c231dab (diff) | |
| download | nng-7acc29013636d2ddc004acebe02d88722fe0c8db.tar.gz nng-7acc29013636d2ddc004acebe02d88722fe0c8db.tar.bz2 nng-7acc29013636d2ddc004acebe02d88722fe0c8db.zip | |
Expose and implement pipe operations. (nng_pipe_close, nng_pipe_getopt).
| -rw-r--r-- | src/core/pipe.c | 11 | ||||
| -rw-r--r-- | src/core/pipe.h | 2 | ||||
| -rw-r--r-- | src/nng.c | 17 |
3 files changed, 30 insertions, 0 deletions
diff --git a/src/core/pipe.c b/src/core/pipe.c index bf2e64fe..c9cc545c 100644 --- a/src/core/pipe.c +++ b/src/core/pipe.c @@ -76,3 +76,14 @@ nni_pipe_create(nni_pipe **pp, const nni_pipe_ops *ops) p->p_id = nni_plat_nextid(); return (0); } + + +int +nni_pipe_getopt(nni_pipe *p, int opt, void *val, size_t *szp) +{ + /* This should only be called with the mutex held... */ + if (p->p_ops.p_getopt == NULL) { + return (NNG_ENOTSUP); + } + return (p->p_ops.p_getopt(p->p_data, opt, val, szp)); +} diff --git a/src/core/pipe.h b/src/core/pipe.h index 6688f837..5349bbb1 100644 --- a/src/core/pipe.h +++ b/src/core/pipe.h @@ -37,4 +37,6 @@ extern int nni_pipe_create(nni_pipe **, const nni_pipe_ops *); extern void nni_pipe_destroy(nni_pipe *); +extern int nni_pipe_getopt(nni_pipe *, int, void *, size_t *sizep); + #endif // CORE_PIPE_H @@ -155,6 +155,23 @@ nng_strerror(int num) } +int +nng_pipe_getopt(nng_pipe *pipe, int opt, void *val, size_t *sizep) +{ + NNI_INIT_INT(); + return (nni_pipe_getopt(pipe, opt, val, sizep)); +} + + +int +nng_pipe_close(nng_pipe *pipe) +{ + NNI_INIT_INT(); + nni_pipe_close(pipe); + return (0); +} + + // Message handling. int nng_msg_alloc(nng_msg **msgp, size_t size) |
