Apps     Components     Interfaces     All Files     Source Tree     source: tos.lib.TinyDB.Network.nc

Interface: Network

The network interface provides TinyDB to trap and monitor network communication -- TupleRouter could simply be wired directly to the appropriate AM send / handlers, but the network monitors topology and filters events in a semi-intelligent way.

Eventually, we'd like to abstract out the parts of this that are similar to Alec's fancy routing from the parts that are TinyDB magic (e.g. snooped messages) from the parts that really are just wrappers around other components (e.g. setPot).

Implemented by NetworkC.td.
Author: Sam Madden (madden@cs.berkeley.edu), Wei Hong (whong@intel-reseach.net)

Components providing this interface:
tos.lib.TinyDB.NetworkMultiHop
tos.lib.TinyDB.NetworkMultiHopM

Components requiring this interface:
tos.lib.TinyDB.TupleRouterM

Commands

Events

Commands - Details

getDataPayLoad

QueryResultPtr getDataPayLoad(TOS_MsgPtr msg)

Typically called before sendDataMessage, this command allows the caller to identify the payload portion of the data message.

Parameters:

msg - A pointer to the tos message buffer.

len - A pointer to a length byte. On return, it will be set to the maximum length of the payload area.

Returns: A pointer to the start of the payload area.

sendDataMessage

TinyDBError sendDataMessage(TOS_MsgPtr msg)

Send out a message containing a tuple, using the multihop forwarding protocol of choice to reach the parent node.

Parameters:

msg - The message to send

Returns: err_MsgSendFailed if message failed to xmit

sendDataMessageTo

TinyDBError sendDataMessageTo(TOS_MsgPtr msg, uint16_t to)

Send out a message containing a tuple to the specified address

Parameters:

msg - The message to send

to - The address to send it to (or TOS_BCAST_ADDR)

Returns: err_MsgSendFailed if the message failed to xmit.

getQueryRequestPayLoad

QueryRequestMessagePtr getQueryRequestPayLoad(TOS_MsgPtr msg)

Typically called before sendQueryRequest, this command allows the caller to identify the payload portion of the query request message.

Parameters:

msg - A pointer to the tos message buffer.

len - A pointer to a length byte. On return, it will be set to the maximum length of the payload area.

Returns: A pointer to the start of the payload area.

getQueryPayLoad

QueryMessagePtr getQueryPayLoad(TOS_MsgPtr msg)

Typically called before sendQueryMessage, this command allows the caller to identify the payload portion of the query message.

Parameters:

msg - A pointer to the tos message buffer.

len - A pointer to a length byte. On return, it will be set to the maximum length of the payload area.

Returns: A pointer to the start of the payload area.

Events - Details

dataSub

result_t dataSub(QueryResultPtr qresMsg)

Signalled when a data (tuple) message is received from a neighbor

Parameters:

The - data message that was received. Owned by the caller.

Returns: SUCCESS, ignored

querySub

result_t querySub(QueryMessagePtr qMsg)

Signalled when a query message is received from a broadcast

Parameters:

msg - The query message that was received. Owned by the caller.

Returns: SUCCESS, ignored

snoopedSub

result_t snoopedSub(QueryResultPtr qresMsg, bool isFromParent, uint16_t senderid)

Signalled when a message not directed to us is heard (snooped)

Parameters:

msg - a data message is heard from a neighbor. Owned by the caller.

isFromParent - set to TRUE if the message was sent by the parent

senderid - is the node id of the message sender

Returns: SUCCESS, ignored

queryRequestSub

result_t queryRequestSub(QueryRequestMessagePtr qreqMsg)

Signalled when a neighbor mote requests a query from us

Parameters:

The - message our neighbor sent. Owned by the caller.

Returns: SUCCESS, ignored