diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-10-31 00:47:21 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-10-31 00:47:21 -0700 |
| commit | 475f4c8abfdd9c88b585105c48839f51d7523d57 (patch) | |
| tree | f6fa693cd20d1f419ec5a1af0b60ffb798b68b4c /src/nng_compat.c | |
| parent | b92320b9afe3771465514286db6ee6746ba512d8 (diff) | |
| download | nng-475f4c8abfdd9c88b585105c48839f51d7523d57.tar.gz nng-475f4c8abfdd9c88b585105c48839f51d7523d57.tar.bz2 nng-475f4c8abfdd9c88b585105c48839f51d7523d57.zip | |
fixes #137 Remove public access to numeric protocols
Diffstat (limited to 'src/nng_compat.c')
| -rw-r--r-- | src/nng_compat.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/nng_compat.c b/src/nng_compat.c index e9a3e3a3..f8a7ceb0 100644 --- a/src/nng_compat.c +++ b/src/nng_compat.c @@ -92,18 +92,19 @@ static const struct { uint16_t p_id; int (*p_open)(nng_socket *); } nn_protocols[] = { - { NNG_PROTO_BUS_V0, nng_bus0_open }, - { NNG_PROTO_PAIR_V0, nng_pair0_open }, - { NNG_PROTO_PAIR_V0, nng_pair1_open }, - { NNG_PROTO_PUSH_V0, nng_push0_open }, - { NNG_PROTO_PULL_V0, nng_pull0_open }, - { NNG_PROTO_PUB_V0, nng_pub0_open }, - { NNG_PROTO_SUB_V0, nng_sub0_open }, - { NNG_PROTO_REQ_V0, nng_req0_open }, - { NNG_PROTO_REP_V0, nng_rep0_open }, - { NNG_PROTO_SURVEYOR_V0, nng_surveyor0_open }, - { NNG_PROTO_RESPONDENT_V0, nng_respondent0_open }, - { NNG_PROTO_NONE, NULL }, + // clang-format off + { NN_BUS, nng_bus0_open }, + { NN_PAIR, nng_pair0_open }, + { NN_PUSH, nng_push0_open }, + { NN_PULL, nng_pull0_open }, + { NN_PUB, nng_pub0_open }, + { NN_SUB, nng_sub0_open }, + { NN_REQ, nng_req0_open }, + { NN_REP, nng_rep0_open }, + { NN_SURVEYOR, nng_surveyor0_open }, + { NN_RESPONDENT, nng_respondent0_open }, + { 0, NULL }, + // clang-format on }; int @@ -118,7 +119,7 @@ nn_socket(int domain, int protocol) return (-1); } - for (i = 0; nn_protocols[i].p_id != NNG_PROTO_NONE; i++) { + for (i = 0; nn_protocols[i].p_id != 0; i++) { if (nn_protocols[i].p_id == protocol) { break; } |
