cnet v4.0.4  

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

cnet's Application Programming Interface

NAME
CNET_set_position - set the node's location on the simulation map

SYNOPSIS
#include <cnet.h> int CNET_set_position(CnetPosition new);

DESCRIPTION
All simulations run within a rectangular region whose dimensions are set in the toplology file by specifying the attributes of mapwidth and mapheight as two non-negative integer values. There is no maximum constraint on the Z-axis.

Nodes of type NT_MOBILE may move around the simulation map by calling CNET_set_position to set the node's location. Calls to CNET_set_position during simulations not using the graphical interface are still meaningful.

The dimensions of the simulation area are measured in metres, and may be specified by setting the mapwidth and mapheight attributes in the toplogy file. Distances, in metres, are used in the default calculations of wireless signal strength and propagation delay of LT_WLAN transmissions.

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_BADPOSITION
The value of new.x, new.y, or new.z is off the map.
ER_NOTSUPPORTED
The current node is not of type NT_MOBILE.
SEE ALSO
CNET_get_position.

cnet v4.0.4 - [email protected]