From 64db0f085be0c9efc6dca8d9e72d3e5a47cb792e Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 25 Sep 2017 12:49:10 -0700 Subject: Refactor option handling APIs. This makes the APIs use string keys, and largely eliminates the use of integer option IDs altogether. The underlying registration for options is also now a bit richer, letting protcols and transports declare the actual options they use, rather than calling down into each entry point carte blanche and relying on ENOTSUP. This code may not be as fast as the integers was, but it is more intuitive, easier to extend, and is not on any hot code paths. (If you're diddling options on a hot code path you're doing something wrong.) --- tests/device.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'tests/device.c') diff --git a/tests/device.c b/tests/device.c index d3407eab..d1e08449 100644 --- a/tests/device.c +++ b/tests/device.c @@ -49,8 +49,8 @@ Main({ So(nng_pair1_open(&dev1) == 0); So(nng_pair1_open(&dev2) == 0); - So(nng_setopt_int(dev1, nng_optid_raw, 1) == 0); - So(nng_setopt_int(dev2, nng_optid_raw, 1) == 0); + So(nng_setopt_int(dev1, NNG_OPT_RAW, 1) == 0); + So(nng_setopt_int(dev2, NNG_OPT_RAW, 1) == 0); struct dev_data ddata; ddata.s1 = dev1; @@ -73,10 +73,8 @@ Main({ So(nng_dial(end2, addr2, NULL, 0) == 0); tmo = 1000000; - So(nng_setopt_usec(end1, nng_optid_recvtimeo, tmo) == - 0); - So(nng_setopt_usec(end2, nng_optid_recvtimeo, tmo) == - 0); + So(nng_setopt_usec(end1, NNG_OPT_RECVTIMEO, tmo) == 0); + So(nng_setopt_usec(end2, NNG_OPT_RECVTIMEO, tmo) == 0); nng_usleep(100000); Convey("Device can send and receive", { -- cgit v1.2.3-70-g09d2