cnet v4.0.4  

home topology files command‑line options the core API FAQ download and install

cnet's Application Programming Interface

NAME
CNET_read_physical - read a data frame from the Physical Layer

SYNOPSIS
#include <cnet.h> int CNET_read_physical(int *link, void *frame, size_t *length);

DESCRIPTION
CNET_read_physical requests that a data frame be read from the Physical Layer. The specified maximum number of bytes from the Physical Layer are copied to the address pointed to by frame. On invocation, length must point to an integer indicating the maximum number of bytes that may be copied into frame.

Each node has a fixed number of links, the first available physical link is number 1, the second is number 2, and so on. As a special case, a node may reliably transmit a frame to itself by requesting the LOOPBACK(=0) link.

On return, the integer pointed to by length will contain the number of bytes read from the Physical Layer. If link is not NULL, then the integer pointed to by link will contain the link number on which the frame arrived.

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 or length is a NULL pointer.
ER_BADSIZE
The value of length is shorter than next available data frame.
ER_CORRUPTFRAME
The recently arrived data frame was corrupted in the Physical Layer and the -e command-line option was given.
ER_NOTREADY
The current node has not yet finished rebooting.
SEE ALSO
CNET_write_physical, CNET_write_physical_reliable, and CNET_write_direct

cnet v4.0.4 - [email protected]