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.
- Components providing this interface:
-
tos.lib.TinyDB.NetworkMultiHop
tos.lib.TinyDB.NetworkMultiHopM
- Components requiring this interface:
-
tos.lib.TinyDB.TupleRouterM
-
QueryResultPtr
getDataPayLoad
(TOS_MsgPtr msg)
-
TinyDBError
sendDataMessage
(TOS_MsgPtr msg)
-
TinyDBError
sendDataMessageTo
(TOS_MsgPtr msg, uint16_t to)
-
QueryRequestMessagePtr
getQueryRequestPayLoad
(TOS_MsgPtr msg)
-
TinyDBError sendQueryRequest(TOS_MsgPtr msg, uint16_t to)
-
QueryMessagePtr
getQueryPayLoad
(TOS_MsgPtr msg)
Typically called before sendQueryMessage, this command allows
the caller to identify the payload portion of the query message.
-
TinyDBError sendQueryMessage(TOS_MsgPtr msg)
broadcast a message containing part of a query to the neighbors
after one of them requested the query
Parameters: |
msg - The message to send
|
Returns: |
err_MsgSendFailed if message failed to xmit
|
-
result_t sendDataDone(TOS_MsgPtr msg, result_t success)
Signalled when a data message has been sent
Parameters: |
msg - The message that was sent
success - SUCCESS if the send succeeded, FAIL otherwise
|
Returns: |
SUCCESS, but ignored
|
-
result_t sendQueryRequestDone(TOS_MsgPtr msg, result_t success)
Signalled when a query request message has been sent
Parameters: |
msg - The message that was sent
success - SUCCESS if the send succeeded, FAIL otherwise
|
Returns: |
SUCCESS, but ignored
|
-
result_t sendQueryDone(TOS_MsgPtr msg, result_t success)
Signalled when a query message has been sent
Parameters: |
msg - The message that was sent
success - SUCCESS if the send succeeded, FAIL otherwise
|
Returns: |
SUCCESS, but ignored
|
-
result_t
dataSub
(QueryResultPtr qresMsg)
Signalled when a data (tuple) message is received from a neighbor
-
result_t
querySub
(QueryMessagePtr qMsg)
Signalled when a query message is received from a broadcast
-
result_t
snoopedSub
(QueryResultPtr qresMsg, bool isFromParent, uint16_t senderid)
Signalled when a message not directed to us is heard (snooped)
-
result_t
queryRequestSub
(QueryRequestMessagePtr qreqMsg)
Signalled when a neighbor mote requests a query from us
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.
|
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
|