diff options
| author | Garrett D'Amore <garrett@damore.org> | 2016-12-14 10:21:39 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2016-12-14 10:21:39 -0800 |
| commit | e0543fecaeb01ccdf7512004c54cd72b143b67c8 (patch) | |
| tree | e369ac7c00cb96690327a96e04caaff83b15f658 /src/core/transport.c | |
| parent | 75aee14e2951cfbd4d8d22375a9f4301890da1ee (diff) | |
| download | nng-e0543fecaeb01ccdf7512004c54cd72b143b67c8.tar.gz nng-e0543fecaeb01ccdf7512004c54cd72b143b67c8.tar.bz2 nng-e0543fecaeb01ccdf7512004c54cd72b143b67c8.zip | |
Some endpoint work started.
Diffstat (limited to 'src/core/transport.c')
| -rw-r--r-- | src/core/transport.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/core/transport.c b/src/core/transport.c index c4ac9faf..97d51e23 100644 --- a/src/core/transport.c +++ b/src/core/transport.c @@ -20,6 +20,8 @@ * IN THE SOFTWARE. */ +#include <string.h> + #include "core/nng_impl.h" /* @@ -33,6 +35,27 @@ static struct nni_transport *transports[] = { NULL }; +struct nni_transport * +nni_transport_find(const char *addr) +{ + /* address is of the form "<scheme>://blah..." */ + const char *end; + int len; + int i; + struct nni_transport *ops; + + if ((end = strstr(addr, "://")) == NULL) { + return (NULL); + } + len = (int)(end - addr); + for (i = 0; (ops = transports[i]) != NULL; i++) { + if (strncmp(addr, ops->tran_scheme, len) == 0) { + return (ops); + } + } + return (NULL); +} + /* * nni_transport_init initializes the entire transport subsystem, including * each individual transport. |
