/** * This file is part of license combination gpl version 3 license and eCos. * The corresponding license terms are below. * * gpl version 3 Licence: * * The file were developed during the student thesis "Datensammlung in Wireless * Sensor Networks fuer Autonomic Home NetworkingÒ of Thomas Kothmayr and is * included in the dissertation "Secure Data Transmission in Wireless * Sensor Networks" by Corinna Schmitt during employment at the Technische * UniversitŠt MŸnchen, Department Computer Science, Chair Network * Architectures and Services (Germany). * Copyright (C) 2013 * Authors: Thomas Kothmayr and Corinna Schmitt (schmitt[at]net.in.tum.de) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * * eCos Licence: (http://ecos.sourceware.org) * * This file is part of eCos, the Embedded Configurable Operating System. * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, * 2007, 2008, 2009 Free Software Foundation, Inc. * * eCos is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free * Software Foundation; either version 3 any later version. * * eCos is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with eCos; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * As a special exception, if other files instantiate templates or use * macros or inline functions from this file, or you compile this file and * link it with other works to produce a work based on this file, this file * does not by itself cause the resulting work to be covered by the GNU * General Public License. However the source code for this file must still * be made available in accordance with section (3) of the GNU General * Public License v2. * * This exception does not invalidate any other reasons why a work based on * this file might be covered by the GNU General Public License. * */ Interface: tos.interfaces.AMPacket

Interface: tos.interfaces.AMPacket

interface AMPacket

The Active Message accessors, which provide the AM local address and functionality for querying packets. Active Messages are a single-hop communication protocol. Therefore, fields such as source and destination represent the single-hop source and destination. Multihop sources and destinations are defined by the corresponding multihop protocol (if any). Also see the Packet interface.

Author:
Philip Levis
Date:
January 18 2005
See:
Packet
AMSend
TEP 116: Packet Protocols

Commands
command am_addr_t address() Return the node's active message address associated with this AM stack.
command am_addr_t destination(message_t *amsg) Return the AM address of the destination of the AM packet.
command am_group_t group(message_t *amsg) Get the AM group of the AM packet.
command bool isForMe(message_t *amsg) Return whether amsg is destined for this mote.
command am_group_t localGroup() Provides the current AM group of this communication interface.
command void setDestination(message_t *amsg, am_addr_t addr) Set the AM address of the destination field of the AM packet.
command void setGroup(message_t *amsg, am_group_t grp) Set the AM group field of a packet.
command void setSource(message_t *amsg, am_addr_t addr) Set the AM address of the source field of the AM packet.
command void setType(message_t *amsg, am_id_t t) Set the AM type of the AM packet.
command am_addr_t source(message_t *amsg) Return the AM address of the source of the AM packet.
command am_id_t type(message_t *amsg) Return the AM type of the AM packet.

Commands - Details

address

command am_addr_t address()

Return the node's active message address associated with this AM stack.

Returns:
The address

destination

command am_addr_t destination(message_t *amsg)

Return the AM address of the destination of the AM packet. If amsg is not an AM packet, the results of this command are undefined.

Parameters:
'message_t* ONE amsg' the packet
Returns:
the destination address of the packet.

group

command am_group_t group(message_t *amsg)

Get the AM group of the AM packet. The AM group is a logical identifier that distinguishes sets of nodes which may share a physical communication medium but wish to not communicate. The AM group logically separates the sets of nodes. When a node sends a packet, it fills in its AM group, and typically nodes only receive packets whose AM group field matches their own.

Parameters:
'message_t* ONE amsg' the packet
Returns:
the AM group of this packet

isForMe

command bool isForMe(message_t *amsg)

Return whether amsg is destined for this mote. This is partially a shortcut for testing whether the return value of destination and address are the same. It may, however, include additional logic. For example, there may be an AM broadcast address: destination will return the broadcast address, but address will still be the mote's local address. If amsg is not an AM packet, the results of this command are undefined.

Parameters:
'message_t* ONE amsg' the packet
Returns:
whether the packet is addressed to this AM stack

localGroup

command am_group_t localGroup()

Provides the current AM group of this communication interface.

Returns:
The AM group.

setDestination

command void setDestination(message_t *amsg, am_addr_t addr)

Set the AM address of the destination field of the AM packet. As the AM address is set as part of sending with the AMSend interface, this command is not used for sending packets. Rather, it is used when a component, such as a queue, needs to buffer a request to send. The component can save the destination address and then recover it when actually sending. If amsg is not an AM packet, the results of this command are undefined.

Parameters:
'message_t* ONE amsg' the packet
addr - the address

setGroup

command void setGroup(message_t *amsg, am_group_t grp)

Set the AM group field of a packet. Note that most data link stacks will set this field automatically on a send request, which may overwrite changes made with this command.

Parameters:
'message_t* ONE amsg' the packet
group - the packet's new AM group value

setSource

command void setSource(message_t *amsg, am_addr_t addr)

Set the AM address of the source field of the AM packet. As the AM address is set as part of sending with the AMSend interface, this command is not used for sending packets. Rather, it is used when a component, such as a queue, needs to buffer a request to send. The component can save the source address and then recover it when actually sending. As an AM layer generally sets the source address to be the local address, this interface is not commonly used except when a system is bypassing the AM layer (e.g., a protocol bridge). If amsg is not an AM packet, the results of this command are undefined.

Parameters:
'message_t* ONE amsg' the packet
addr - the address

setType

command void setType(message_t *amsg, am_id_t t)

Set the AM type of the AM packet. As the AM type is set as part of sending with the AMSend interface, this command is not used for sending packets. Instead, it is used when a component, such as a queue, needs to buffer a request to send. The component can save the AM type in the packet then recover it when actually sending. If amsg is not an AM packet, the results of this command are undefined.

Parameters:
'message_t* ONE amsg' the packet
t - the AM type

source

command am_addr_t source(message_t *amsg)

Return the AM address of the source of the AM packet. If amsg is not an AM packet, the results of this command are undefined.

Parameters:
'message_t* ONE amsg' the packet
Returns:
the source address of the packet.

type

command am_id_t type(message_t *amsg)

Return the AM type of the AM packet. If amsg is not an AM packet, the results of this command are undefined.

Parameters:
'message_t* ONE amsg' the packet
Returns:
the AM type