Contiki 3.x
Data Structures | Functions

The mesh module sends packets using multi-hop routing to a specified receiver somewhere in the network. More...

Data Structures

struct  mesh_callbacks
 Mesh callbacks. More...
 

Functions

void mesh_open (struct mesh_conn *c, uint16_t channels, const struct mesh_callbacks *callbacks)
 Open a mesh connection. More...
 
void mesh_close (struct mesh_conn *c)
 Close an mesh connection. More...
 
int mesh_send (struct mesh_conn *c, const linkaddr_t *dest)
 Send a mesh packet. More...
 
int mesh_ready (struct mesh_conn *c)
 Test if mesh is ready to send a packet (or packet is queued) More...
 

Detailed Description

The mesh module sends packets using multi-hop routing to a specified receiver somewhere in the network.

Channels

The mesh module uses 3 channel; one for the multi-hop forwarding (multihop) and two for the route disovery (route-discovery).

Function Documentation

void mesh_close ( struct mesh_conn *  c)

Close an mesh connection.

Parameters
cA pointer to a struct mesh_conn
        This function closes an mesh connection that has
        previously been opened with mesh_open().

        This function typically is called as an exit handler.
Examples:
example-mesh.c.

Definition at line 177 of file mesh.c.

void mesh_open ( struct mesh_conn *  c,
uint16_t  channels,
const struct mesh_callbacks callbacks 
)

Open a mesh connection.

Parameters
cA pointer to a struct mesh_conn
channelsThe channels on which the connection will operate; mesh uses 3 channels
callbacksPointer to callback structure
        This function sets up a mesh connection on the
        specified channel. The caller must have allocated the
        memory for the struct mesh_conn, usually by declaring it
        as a static variable.

        The struct mesh_callbacks pointer must point to a structure
        containing function pointers to functions that will be called
        when a packet arrives on the channel.
Examples:
example-mesh.c.

Definition at line 164 of file mesh.c.

References CLOCK_SECOND.

int mesh_ready ( struct mesh_conn *  c)

Test if mesh is ready to send a packet (or packet is queued)

Parameters
cThe mesh connection on which is to be tested
Return values
0Packet queued
!0Ready

Definition at line 205 of file mesh.c.

References NULL.

int mesh_send ( struct mesh_conn *  c,
const linkaddr_t *  dest 
)

Send a mesh packet.

Parameters
cThe mesh connection on which the packet should be sent
destThe address of the final destination of the packet
Return values
Non-zeroif the packet could be queued for sending, zero otherwise
        This function sends a mesh packet. The packet must be
        present in the packetbuf before this function is called.

        The parameter c must point to an abc connection that
        must have previously been set up with mesh_open().
Examples:
example-mesh.c.

Definition at line 184 of file mesh.c.

References linkaddr_node_addr, and NULL.