diff options
| -rw-r--r-- | src/core/endpt.h | 20 | ||||
| -rw-r--r-- | src/core/nng_impl.h | 2 | ||||
| -rw-r--r-- | src/core/panic.h | 2 | ||||
| -rw-r--r-- | src/core/platform.h | 8 | ||||
| -rw-r--r-- | src/core/protocol.h | 104 | ||||
| -rw-r--r-- | src/nng.h | 4 |
6 files changed, 72 insertions, 68 deletions
diff --git a/src/core/endpt.h b/src/core/endpt.h index f96df047..cd46bb61 100644 --- a/src/core/endpt.h +++ b/src/core/endpt.h @@ -19,16 +19,16 @@ */ struct nng_endpt { - struct nni_endpt_ops ep_ops; - void *ep_tran; - nni_list_node_t ep_sock_node; - nni_socket_t ep_sock; - const char *ep_addr; - nni_thread_t ep_dialer; - nni_thread_t ep_listener; - int ep_close; - nni_mutex_t ep_mx; - nni_cond_t ep_cv; + struct nni_endpt_ops ep_ops; + void * ep_tran; + nni_list_node_t ep_sock_node; + nni_socket_t ep_sock; + const char * ep_addr; + nni_thread_t ep_dialer; + nni_thread_t ep_listener; + int ep_close; + nni_mutex_t ep_mx; + nni_cond_t ep_cv; }; /* diff --git a/src/core/nng_impl.h b/src/core/nng_impl.h index 57aa520f..5b473434 100644 --- a/src/core/nng_impl.h +++ b/src/core/nng_impl.h @@ -41,4 +41,4 @@ #include "core/socket.h" #include "core/endpt.h" -#endif /* CORE_NNG_IMPL_H */ +#endif /* CORE_NNG_IMPL_H */ diff --git a/src/core/panic.h b/src/core/panic.h index e77117ee..88ddb7b0 100644 --- a/src/core/panic.h +++ b/src/core/panic.h @@ -30,4 +30,4 @@ extern void nni_panic(const char *, ...); */ extern void nni_println(const char *); -#endif /* CORE_PANIC_H */ +#endif /* CORE_PANIC_H */ diff --git a/src/core/platform.h b/src/core/platform.h index f87042da..32e8727f 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -79,13 +79,14 @@ extern void *nni_alloc(size_t); */ extern void nni_free(void *, size_t); -typedef struct nni_mutex *nni_mutex_t; -typedef struct nni_cond *nni_cond_t; +typedef struct nni_mutex * nni_mutex_t; +typedef struct nni_cond * nni_cond_t; /* * Mutex handling. */ extern int nni_mutex_create(nni_mutex_t *); + extern void nni_mutex_destroy(nni_mutex_t); extern void nni_mutex_enter(nni_mutex_t); extern void nni_mutex_exit(nni_mutex_t); @@ -123,7 +124,8 @@ extern void nni_cond_wait(nni_cond_t); */ extern int nni_cond_timedwait(nni_cond_t, uint64_t); -typedef struct nni_thread *nni_thread_t; +typedef struct nni_thread * nni_thread_t; + /* * nni_thread_creates a thread that runs the given function. The thread * receives a single argument. diff --git a/src/core/protocol.h b/src/core/protocol.h index f524eb46..2b4625cb 100644 --- a/src/core/protocol.h +++ b/src/core/protocol.h @@ -28,58 +28,58 @@ */ struct nni_protocol { - /* - * Protocol information. - */ - uint16_t proto_self; /* our 16-bit protocol ID */ - uint16_t proto_peer; /* who we peer with (protocol ID) */ - const char * proto_name; /* string version of our name */ - - /* - * Create protocol instance data, which will be stored on the socket. - */ - int (*proto_create)(void **, nni_socket_t); - - /* - * Destroy the protocol instance. - */ - void (*proto_destroy)(void *); - - /* - * Shutdown the protocol instance, including giving time to - * drain any outbound frames (linger). The protocol is not - * required to honor the linger. - */ - void (*proto_shutdown)(void *, uint64_t); - - /* - * Add and remove pipes. These are called as connections are - * created or destroyed. - */ - int (*proto_add_pipe)(void *, nni_pipe_t); - int (*proto_remove_pipe)(void *, nni_pipe_t); - - /* - * Option manipulation. These may be NULL. - */ - int (*proto_setopt)(void *, int, const void *, size_t); - int (*proto_getopt)(void *, int, void *, size_t *); - - /* - * Receive filter. This may be NULL, but if it isn't, then - * messages coming into the system are routed here just before - * being delivered to the application. To drop the message, - * the protocol should return NULL, otherwise the message - * (possibly modified). - */ - nng_msg_t (*proto_recv_filter)(void *, nni_msg_t); - - /* - * Send filter. This may be NULL, but if it isn't, then - * messages here are filtered just after they come from the - * application. - */ - nng_msg_t (*proto_send_filter)(void *, nni_msg_t); + /* + * Protocol information. + */ + uint16_t proto_self; /* our 16-bit protocol ID */ + uint16_t proto_peer; /* who we peer with (protocol ID) */ + const char * proto_name; /* string version of our name */ + + /* + * Create protocol instance data, which will be stored on the socket. + */ + int (*proto_create)(void **, nni_socket_t); + + /* + * Destroy the protocol instance. + */ + void (*proto_destroy)(void *); + + /* + * Shutdown the protocol instance, including giving time to + * drain any outbound frames (linger). The protocol is not + * required to honor the linger. + */ + void (*proto_shutdown)(void *, uint64_t); + + /* + * Add and remove pipes. These are called as connections are + * created or destroyed. + */ + int (*proto_add_pipe)(void *, nni_pipe_t); + int (*proto_remove_pipe)(void *, nni_pipe_t); + + /* + * Option manipulation. These may be NULL. + */ + int (*proto_setopt)(void *, int, const void *, size_t); + int (*proto_getopt)(void *, int, void *, size_t *); + + /* + * Receive filter. This may be NULL, but if it isn't, then + * messages coming into the system are routed here just before + * being delivered to the application. To drop the message, + * the protocol should return NULL, otherwise the message + * (possibly modified). + */ + nng_msg_t (*proto_recv_filter)(void *, nni_msg_t); + + /* + * Send filter. This may be NULL, but if it isn't, then + * messages here are filtered just after they come from the + * application. + */ + nng_msg_t (*proto_send_filter)(void *, nni_msg_t); }; /* @@ -90,7 +90,7 @@ NNG_DECL int nng_socket_getopt(nng_socket_t, int, void *, size_t *); * recursion. */ NNG_DECL nng_notify_t nng_notify_register(nng_socket_t, int, -void (*)(nng_socket_t, nng_event_t, void *), void *); + void (*)(nng_socket_t, nng_event_t, void *), void *); NNG_DECL int nng_notify_unregister(nng_socket_t, nng_notify_t); /* @@ -367,6 +367,7 @@ NNG_DECL const char *nng_stat_name(nng_stat_t); * user as is. */ NNG_DECL int nng_stat_type(nng_stat_t); + #define NNG_STAT_LEVEL 0 #define NNG_STAT_COUNTER 1 @@ -377,6 +378,7 @@ NNG_DECL int nng_stat_type(nng_stat_t); * returned. */ NNG_DECL int nng_stat_unit(nng_stat_t); + #define NNG_UNIT_NONE 0 #define NNG_UNIT_BYTES 1 #define NNG_UNIT_MESSAGES 2 |
