From da2aac4a6eb10af88e3938068e24c58aea1832b1 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 12 Jun 2018 20:05:34 -0700 Subject: fixes #540 nni_ep_opttype serves no purpose fixes #538 setopt should have an explicit chkopt routine fixes #537 Internal TCP API needs better name separation fixes #524 Option types should be "typed" This is a rework of the option management code, to make it both clearer and to prepare for further work to break up endpoints. This reduces a certain amount of dead or redundant code, and actually saves cycles when setting options, as some loops were not terminated that should have been. --- src/core/defs.h | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'src/core/defs.h') diff --git a/src/core/defs.h b/src/core/defs.h index 29d1b826..77078a7a 100644 --- a/src/core/defs.h +++ b/src/core/defs.h @@ -40,22 +40,20 @@ typedef struct nng_event nni_event; typedef struct nng_notify nni_notify; // These are our own names. -typedef struct nni_socket nni_sock; -typedef struct nni_ctx nni_ctx; -typedef struct nni_ep nni_ep; -typedef struct nni_pipe nni_pipe; -typedef struct nni_tran nni_tran; -typedef struct nni_tran_ep_ops nni_tran_ep_ops; -typedef struct nni_tran_ep_option nni_tran_ep_option; -typedef struct nni_tran_pipe_ops nni_tran_pipe_ops; -typedef struct nni_tran_pipe_option nni_tran_pipe_option; - -typedef struct nni_proto_ctx_option nni_proto_ctx_option; -typedef struct nni_proto_ctx_ops nni_proto_ctx_ops; -typedef struct nni_proto_sock_ops nni_proto_sock_ops; -typedef struct nni_proto_pipe_ops nni_proto_pipe_ops; -typedef struct nni_proto_sock_option nni_proto_sock_option; -typedef struct nni_proto nni_proto; +typedef struct nni_socket nni_sock; +typedef struct nni_ctx nni_ctx; +typedef struct nni_ep nni_ep; +typedef struct nni_pipe nni_pipe; +typedef struct nni_tran nni_tran; +typedef struct nni_tran_option nni_tran_option; +typedef struct nni_tran_ep_ops nni_tran_ep_ops; +typedef struct nni_tran_pipe_ops nni_tran_pipe_ops; + +typedef struct nni_proto_option nni_proto_option; +typedef struct nni_proto_ctx_ops nni_proto_ctx_ops; +typedef struct nni_proto_sock_ops nni_proto_sock_ops; +typedef struct nni_proto_pipe_ops nni_proto_pipe_ops; +typedef struct nni_proto nni_proto; typedef struct nni_plat_mtx nni_mtx; typedef struct nni_plat_cv nni_cv; @@ -140,7 +138,7 @@ typedef struct { // Types. These are used to provide more structured access to options // (and maybe later statistics). For now these are internal only. -enum nni_type { +typedef enum nni_opt_type { NNI_TYPE_OPAQUE, NNI_TYPE_BOOL, NNI_TYPE_INT32, @@ -152,6 +150,6 @@ enum nni_type { NNI_TYPE_STRING, NNI_TYPE_SOCKADDR, NNI_TYPE_POINTER, -}; +} nni_opt_type; #endif // CORE_DEFS_H -- cgit v1.2.3-70-g09d2