summaryrefslogtreecommitdiff
path: root/src/core/protocol.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-07-10 15:02:38 -0700
committerGarrett D'Amore <garrett@damore.org>2017-07-10 15:02:38 -0700
commit795aebbee77bb74d8792df96dfe1aa79ec9548fc (patch)
tree58c16424c16b9e71cebdceaee4507ab6608f80da /src/core/protocol.h
parentde90f97167d2df6739db47b2c6aad85f06250270 (diff)
downloadnng-795aebbee77bb74d8792df96dfe1aa79ec9548fc.tar.gz
nng-795aebbee77bb74d8792df96dfe1aa79ec9548fc.tar.bz2
nng-795aebbee77bb74d8792df96dfe1aa79ec9548fc.zip
Give up on uncrustify; switch to clang-format.
Diffstat (limited to 'src/core/protocol.h')
-rw-r--r--src/core/protocol.h48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/core/protocol.h b/src/core/protocol.h
index 745f5986..3a133469 100644
--- a/src/core/protocol.h
+++ b/src/core/protocol.h
@@ -24,18 +24,18 @@
struct nni_proto_pipe_ops {
// pipe_init creates the protocol-specific per pipe data structure.
// The last argument is the per-socket protocol private data.
- int (*pipe_init)(void **, nni_pipe *, void *);
+ int (*pipe_init)(void **, nni_pipe *, void *);
// pipe_fini releases any pipe data structures. This is called after
// the pipe has been removed from the protocol, and the generic
// pipe threads have been stopped.
- void (*pipe_fini)(void *);
+ void (*pipe_fini)(void *);
// pipe_start is called to register a pipe with the protocol. The
// protocol can reject this, for example if another pipe is already
// active on a 1:1 protocol. The protocol may not block during this,
// as the socket lock is held.
- int (*pipe_start)(void *);
+ int (*pipe_start)(void *);
// pipe_stop is called to unregister a pipe from the protocol.
// Threads may still acccess data structures, so the protocol
@@ -43,66 +43,66 @@ struct nni_proto_pipe_ops {
// lock held, so the protocol may not call back into the socket, and
// must not block. This operation must be idempotent, and may
// be called even if pipe_start was not.
- void (*pipe_stop)(void *);
+ void (*pipe_stop)(void *);
};
struct nni_proto_sock_ops {
// sock_initf creates the protocol instance, which will be stored on
// the socket. This is run without the sock lock held, and allocates
// storage or other resources for the socket.
- int (*sock_init)(void **, nni_sock *);
+ int (*sock_init)(void **, nni_sock *);
// sock_fini destroys the protocol instance. This is run without the
// socket lock held, and is intended to release resources. It may
// block as needed.
- void (*sock_fini)(void *);
+ void (*sock_fini)(void *);
// Open the protocol instance. This is run with the lock held,
// and intended to allow the protocol to start any asynchronous
// processing.
- void (*sock_open)(void *);
+ void (*sock_open)(void *);
// Close the protocol instance. This is run with the lock held,
// and intended to initiate closure of the socket. For example,
// it can signal the socket worker threads to exit.
- void (*sock_close)(void *);
+ void (*sock_close)(void *);
// Option manipulation. These may be NULL.
- int (*sock_setopt)(void *, int, const void *, size_t);
- int (*sock_getopt)(void *, int, void *, size_t *);
+ int (*sock_setopt)(void *, int, const void *, size_t);
+ int (*sock_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 prtocol
// should return NULL, otherwise the message (possibly modified).
- nni_msg * (*sock_rfilter)(void *, nni_msg *);
+ nni_msg *(*sock_rfilter)(void *, nni_msg *);
// Send filter. This may be NULL, but if it isn't, then messages
// here are filtered just after they come from the application.
- nni_msg * (*sock_sfilter)(void *, nni_msg *);
+ nni_msg *(*sock_sfilter)(void *, nni_msg *);
};
struct nni_proto {
- uint16_t proto_self; // our 16-bit D
- uint16_t proto_peer; // who we peer with (ID)
- const char * proto_name; // Our name
- uint32_t proto_flags; // Protocol flags
- const nni_proto_sock_ops * proto_sock_ops; // Per-socket opeations
- const nni_proto_pipe_ops * proto_pipe_ops; // Per-pipe operations.
+ uint16_t proto_self; // our 16-bit D
+ uint16_t proto_peer; // who we peer with (ID)
+ const char * proto_name; // Our name
+ uint32_t proto_flags; // Protocol flags
+ const nni_proto_sock_ops *proto_sock_ops; // Per-socket opeations
+ const nni_proto_pipe_ops *proto_pipe_ops; // Per-pipe operations.
};
// These flags determine which operations make sense. We use them so that
// we can reject attempts to create notification fds for operations that make
// no sense.
-#define NNI_PROTO_FLAG_RCV 1 // Protocol can receive
-#define NNI_PROTO_FLAG_SND 2 // Protocol can send
-#define NNI_PROTO_FLAG_SNDRCV 3 // Protocol can both send & recv
+#define NNI_PROTO_FLAG_RCV 1 // Protocol can receive
+#define NNI_PROTO_FLAG_SND 2 // Protocol can send
+#define NNI_PROTO_FLAG_SNDRCV 3 // Protocol can both send & recv
// These functions are not used by protocols, but rather by the socket
// core implementation. The lookups can be used by transports as well.
-extern nni_proto *nni_proto_find(uint16_t);
+extern nni_proto * nni_proto_find(uint16_t);
extern const char *nni_proto_name(uint16_t);
-extern uint16_t nni_proto_number(const char *);
-extern uint16_t nni_proto_peer(uint16_t);
+extern uint16_t nni_proto_number(const char *);
+extern uint16_t nni_proto_peer(uint16_t);
#endif // CORE_PROTOCOL_H