/** * 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.chips.rf230.IEEE154Packet

Interface: tos.chips.rf230.IEEE154Packet

interface IEEE154Packet

This interface encapsulates IEEE 802.15.4 intrapan data frames with 16-bit destination pan, source and destination addresses. It also supports 6LowPan interoperability mode, and acknowledgement frames. Note, that this interface does not support the CRC-16 value, which should be verified before the data can be trusted.

Commands
command void createAckFrame(message_t *msg) Sets the FCF to create an acknowledgement frame supported by this interface.
command void createAckReply(message_t *data, message_t *ack) Creates an acknowledgement packet for the given data packet.
command void createDataFrame(message_t *msg) Sets the FCF to create a data frame supported by this interface.
command uint8_t get6LowPan(message_t *msg) Returns the value of the 6LowPan network field.
command bool getAckRequired(message_t *msg) Returns TRUE if the ACK required field is set in the FCF.
command uint16_t getDestAddr(message_t *msg) Returns the destination address, valid only for data frames
command uint16_t getDestPan(message_t *msg) returns the destination PAN id, values <= 255 are tinyos groups, valid only for data frames
command uint8_t getDSN(message_t *msg) Returns the data sequence number
command uint16_t getFCF(message_t *msg) Returns the frame control field.
command bool getFramePending(message_t *msg) Returns TRUE if the frame pending field is set in the FCF.
command ieee154_header_t *getHeader(message_t *msg) Returns the IEEE 802.15.4 header including the length field.
command uint8_t getLength(message_t *msg) Returns the raw value (unadjusted) of the length field
command uint16_t getSrcAddr(message_t *msg) Returns the source address, valid only for data frames
command am_id_t getType(message_t *msg) Returns the active message type of the message
command bool isAckFrame(message_t *msg) Returns TRUE if the message is an acknowledgement frame supported by this interface (based on the value of the FCF).
command bool isDataFrame(message_t *msg) Returns TRUE if the message is a data frame supported by this interface (based on the value of the FCF).
command bool requiresAckReply(message_t *msg) Returns TRUE if the packet is a data packet, the ACK_REQ field is set and the destionation address is this node.
command bool requiresAckWait(message_t *msg) Returns TRUE if the packet is a data packet, the ACK_REQ field is set and the destination address is not the broadcast address.
command void set6LowPan(message_t *msg, uint8_t network) Sets the value of the 6LowPan network field.
command void setAckRequired(message_t *msg, bool ack) Sets the ACK required field in the FCF, should never be set for acknowledgement frames.
command void setDestAddr(message_t *msg, uint16_t addr) Sets the destination address, valid only for data frames
command void setDestPan(message_t *msg, uint16_t pan) Sets the destination PAN id, valid only for data frames
command void setDSN(message_t *msg, uint8_t dsn) Sets the data sequence number
command void setFCF(message_t *msg, uint16_t fcf) Sets the frame control field.
command void setFramePending(message_t *msg, bool pending) Sets the frame pending field in the FCF.
command void setLength(message_t *msg, uint8_t length) Sets the length field
command void setSrcAddr(message_t *msg, uint16_t addr) Sets the source address, valid only for data frames
command void setType(message_t *msg, am_id_t type) Sets the active message type
command bool verifyAckReply(message_t *data, message_t *ack) Returns TRUE if the acknowledgement packet corresponds to the data packet.

Commands - Details

createAckFrame

command void createAckFrame(message_t *msg)

Sets the FCF to create an acknowledgement frame supported by this interface. You may call setFramePending after this.

createAckReply

command void createAckReply(message_t *data, message_t *ack)

Creates an acknowledgement packet for the given data packet. This also sets the DSN value. The data message must be a data frame, the ack message will be overwritten.

createDataFrame

command void createDataFrame(message_t *msg)

Sets the FCF to create a data frame supported by this interface. You may call setAckRequired and setFramePending commands after this.

get6LowPan

command uint8_t get6LowPan(message_t *msg)

Returns the value of the 6LowPan network field.

getAckRequired

command bool getAckRequired(message_t *msg)

Returns TRUE if the ACK required field is set in the FCF.

getDestAddr

command uint16_t getDestAddr(message_t *msg)

Returns the destination address, valid only for data frames

getDestPan

command uint16_t getDestPan(message_t *msg)

returns the destination PAN id, values <= 255 are tinyos groups, valid only for data frames

getDSN

command uint8_t getDSN(message_t *msg)

Returns the data sequence number

getFCF

command uint16_t getFCF(message_t *msg)

Returns the frame control field. This method should not be used, isDataFrame and isAckFrame should be used instead.

getFramePending

command bool getFramePending(message_t *msg)

Returns TRUE if the frame pending field is set in the FCF.

getHeader

command ieee154_header_t *getHeader(message_t *msg)

Returns the IEEE 802.15.4 header including the length field.

getLength

command uint8_t getLength(message_t *msg)

Returns the raw value (unadjusted) of the length field

getSrcAddr

command uint16_t getSrcAddr(message_t *msg)

Returns the source address, valid only for data frames

getType

command am_id_t getType(message_t *msg)

Returns the active message type of the message

isAckFrame

command bool isAckFrame(message_t *msg)

Returns TRUE if the message is an acknowledgement frame supported by this interface (based on the value of the FCF).

isDataFrame

command bool isDataFrame(message_t *msg)

Returns TRUE if the message is a data frame supported by this interface (based on the value of the FCF).

requiresAckReply

command bool requiresAckReply(message_t *msg)

Returns TRUE if the packet is a data packet, the ACK_REQ field is set and the destionation address is this node.

requiresAckWait

command bool requiresAckWait(message_t *msg)

Returns TRUE if the packet is a data packet, the ACK_REQ field is set and the destination address is not the broadcast address.

set6LowPan

command void set6LowPan(message_t *msg, uint8_t network)

Sets the value of the 6LowPan network field.

setAckRequired

command void setAckRequired(message_t *msg, bool ack)

Sets the ACK required field in the FCF, should never be set for acknowledgement frames.

setDestAddr

command void setDestAddr(message_t *msg, uint16_t addr)

Sets the destination address, valid only for data frames

setDestPan

command void setDestPan(message_t *msg, uint16_t pan)

Sets the destination PAN id, valid only for data frames

setDSN

command void setDSN(message_t *msg, uint8_t dsn)

Sets the data sequence number

setFCF

command void setFCF(message_t *msg, uint16_t fcf)

Sets the frame control field. This method should not be used, createDataFrame and createAckFrame should be used instead.

setFramePending

command void setFramePending(message_t *msg, bool pending)

Sets the frame pending field in the FCF.

setLength

command void setLength(message_t *msg, uint8_t length)

Sets the length field

setSrcAddr

command void setSrcAddr(message_t *msg, uint16_t addr)

Sets the source address, valid only for data frames

setType

command void setType(message_t *msg, am_id_t type)

Sets the active message type

verifyAckReply

command bool verifyAckReply(message_t *data, message_t *ack)

Returns TRUE if the acknowledgement packet corresponds to the data packet. The data message must be a data packet.