home
topology files
command‑line options
the core API
FAQ
download and install
|
cnet's Application Programming Interface
- NAME
- CNET_write_direct - write a data frame directly to an indicated node
- SYNOPSIS
-
#include <cnet.h>
int CNET_write_direct(CnetAddr destaddr, const void *frame, size_t *length);
- DESCRIPTION
-
CNET_write_direct requests that the indicated number of bytes,
pointed to by frame ,
be written directly to the node indicated by destaddr .
This function thus
provides a reliable network/routing layer for asynchronous message
passing, even if the source and destination nodes are not connected.
Messages transmitted using CNET_write_direct are considered to be
transmitted on, and arrive on, link number 1 .
The special destination address ALLNODES may be used to transmit a
message to all nodes except the sender.
Regardless of the number of hops, propagation delays, and bandwidth,
all frames sent via CNET_write_direct reach their destination in
just 1000usecs.
On invocation, length must point to an integer indicating the number
of bytes to be copied from frame .
On return, the integer pointed to by length will now contain
the number of bytes accepted by the Physical 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
frame is a NULL pointer,
or length is equal to zero.
ER_BADNODE
- The value of
destaddr refers to the current node.
ER_NOTREADY
- The current node has not yet finished rebooting.
ER_TOOBUSY
- An attempt has been made to write more than 1000 frames to the
indicated destination before any of them have been read.
This restriction is imposed to trap obvious errors in protocols.
- SEE ALSO
-
CNET_write_physical,
CNET_write_physical_reliable, and
CNET_read_physical
|