home
topology files
command‑line options
the core API
FAQ
download and install
|
cnet's Application Programming Interface
- NAME
- CNET_write_application - present a new message to the Application Layer
- SYNOPSIS
-
#include <cnet.h>
int CNET_write_application(const void *message, size_t *length);
- DESCRIPTION
-
CNET_write_application
passes a number of bytes,
pointed to by message , "up to" the Application Layer.
It is expected that the contents of message will be exactly that
generated by, and delivered for, another node's Application Layer.
On invocation, length must point to an integer indicating the number
of bytes to be copied from message .
On return, length will point to an integer now indicating the number
of bytes accepted by the Application Layer.
- RETURN VALUE
-
The value
0 is returned on success.
On failure, the value -1 is returned,
and the global variable cnet_errno is set to one of the
following values to describe the error:
ER_BADARG
- Either
message or length is an invalid pointer,
or the value provided by length is less 0 or
greater than MAX_MESSAGE_SIZE .
ER_BADSENDER
- The message has not been generated by another node's Application
Layer (and a node cannot write a message to itself).
ER_BADSESSION
- Either the source node, or the current node, have crashed and
rebooted since the message was generated.
ER_BADSIZE
- The message is not the same length as the original message
generated by another node's Application Layer.
ER_CORRUPTFRAME
- The contents of the message are not the same as the original message
generated by another node's Application Layer.
ER_DUPLICATEMSG
- The message has already been seen by the Application Layer
(for example, if the messages from another node are presented in the
order first, second, second,...).
ER_MISSINGMSG
- The message is being delivered out of order with respect to all
previously received messages from the message's source node
(for example, if the messages are presented in the order
first, second, fourth,...).
ER_NOTFORME
- The message has been written to the incorrect node's Application Layer.
ER_NOTSUPPORTED
- The current node does not have an Application Layer.
- SEE ALSO
-
CNET_read_application
|