aboutsummaryrefslogtreecommitdiff
path: root/src/core/nng_impl.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-12 03:42:26 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-12 03:42:26 -0800
commit1adefe3879b211a47a784f477d56a9416ae72254 (patch)
treecf017599969fb109d62981cbef56eeeef4d2b108 /src/core/nng_impl.h
parent091043a0df9568b18e9bb49b07762b95e3508108 (diff)
downloadnng-1adefe3879b211a47a784f477d56a9416ae72254.tar.gz
nng-1adefe3879b211a47a784f477d56a9416ae72254.tar.bz2
nng-1adefe3879b211a47a784f477d56a9416ae72254.zip
New inproc transport.
Lots of supporting changes.
Diffstat (limited to 'src/core/nng_impl.h')
-rw-r--r--src/core/nng_impl.h88
1 files changed, 14 insertions, 74 deletions
diff --git a/src/core/nng_impl.h b/src/core/nng_impl.h
index 683e0df1..d728c652 100644
--- a/src/core/nng_impl.h
+++ b/src/core/nng_impl.h
@@ -20,90 +20,30 @@
* IN THE SOFTWARE.
*/
-#ifndef NNG_IMPL_H
-#define NNG_IMPL_H
+#ifndef CORE_NNG_IMPL_H
+#define CORE_NNG_IMPL_H
#include "nng.h"
-#include "platform/platform.h"
/*
* Internal implementation things for NNG, common definitions, etc.
+ * All internal modules wind up including this file to avoid having
+ * to figure out which header(s) to include.
*
* Hopefully it should be clear by the name that this file and its contents
* are *NOT* for use outside of this library.
*
* Symbols that are private to the library begin with the nni_ prefix, whereas
- * those starting with nng_ are intended for external consumption.
+ * those starting with nng_ are intended for external consumption. The latter
+ * symbols should be found in the toplevel nng.h header.
*/
-/*
- * C compilers may get unhappy when named arguments are not used. While
- * there are things like __attribute__((unused)) which are arguably
- * superior, support for such are not universal.
- */
-#define NNI_ARG_UNUSED(x) ((void)x);
-
-/*
- * We have our own snprintf, because some platforms lack this, while
- * others need special handling. Ours just calls the vsnprintf version
- * from the platform.
- */
-extern void nni_snprintf(char *, size_t, const char *, ...);
-
-/*
- * nni_panic is used to terminate the process with prejudice, and
- * should only be called in the face of a critical programming error,
- * or other situation where it would be unsafe to attempt to continue.
- * As this crashes the program, it should never be used when factors outside
- * the program can cause it, such as receiving protocol errors, or running
- * out of memory. Its better in those cases to return an error to the
- * program and let the caller handle the error situation.
- */
-extern void nni_panic(const char *, ...);
-
-/*
- * Message queues. Message queues work in some ways like Go channels;
- * they are a thread-safe way to pass messages between subsystems.
- */
-typedef struct nni_msgqueue *nni_msgqueue_t;
-
-/*
- * nni_msgqueue_create creates a message queue with the given capacity,
- * which must be a positive number. It returns NNG_EINVAL if the capacity
- * is invalid, or NNG_ENOMEM if resources cannot be allocated.
- */
-extern int nni_msgqueue_create(nni_msgqueue_t *, int);
-
-/*
- * nni_msgqueue_destroy destroys a message queue. It will also free any
- * messages that may be in the queue.
- */
-extern void nni_msgqueue_destroy(nni_msgqueue_t);
-
-/*
- * nni_msgqueue_put attempts to put a message to the queue. It will wait
- * for the timeout (us), if the value is positive. If the value is negative
- * then it will wait forever. If the value is zero, it will just check, and
- * return immediately whether a message can be put or not. Valid returns are
- * NNG_ECLOSED if the queue is closed or NNG_ETIMEDOUT if the message cannot
- * be placed after a time, or NNG_EAGAIN if the operation cannot succeed
- * immediately and a zero timeout is specified. Note that timeout granularity
- * may be limited -- for example Windows systems have a millisecond resolution
- * timeout capability.
- */
-extern int nni_msgqueue_put(nni_msgqueue_t, nng_msg_t, int);
-
-/*
- * nni_msgqueue_get gets the message from the queue, using a timeout just
- * like nni_msgqueue_put.
- */
-extern int nni_msgqueue_get(nni_msgqueue_t, nng_msg_t *, int);
-
-/*
- * nni_msgqueue_close closes the queue. After this all operates on the
- * message queue will return NNG_ECLOSED. Messages inside the queue
- * are freed. Unlike closing a go channel, this operation is idempotent.
- */
-extern void nni_msgqueue_close(nni_msgqueue_t);
+#include "core/defs.h"
+#include "core/list.h"
+#include "core/msgqueue.h"
+#include "core/panic.h"
+#include "core/snprintf.h"
+#include "core/platform.h"
+#include "core/transport.h"
-#endif /* NNG_IMPL_H */
+#endif /* CORE_NNG_IMPL_H */