From: Felix Varghese <felixvarg...@gmail.com> Adds new file mlme_pib.c and function for resetting all PIB attributes to their default values
Signed-off-by: Felix Varghese <felixvarg...@gmail.com> Signed-off-by: Prajosh Premdas <premdas.praj...@gmail.com> --- net/mac802154/mlme_pib.c | 152 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 152 insertions(+), 0 deletions(-) create mode 100644 net/mac802154/mlme_pib.c diff --git a/net/mac802154/mlme_pib.c b/net/mac802154/mlme_pib.c new file mode 100644 index 0000000..e52a4c7 --- /dev/null +++ b/net/mac802154/mlme_pib.c @@ -0,0 +1,152 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * 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, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Written by: + * Felix Varghese <felix.vargh...@atmel.com> + * Prajosh Premdas <prajosh.prem...@atmel.com> + */ +#include <linux/skbuff.h> +#include <linux/if_arp.h> +#include <net/ieee802154_netdev.h> +#include <net/wpan-phy.h> +#include <net/mac802154.h> +#include <net/nl802154.h> +#include "mac802154.h" + +/* MLME_GET request worker structures */ +struct mlme_get_req_notify_work { + struct work_struct work; + struct net_device *dev; + u8 PIBattr; +}; + +/* MLME_SET request worker structures */ +struct mlme_set_req_notify_work { + struct work_struct work; + struct net_device *dev; + u8 PIBattr; + union pib_value_t PIBval; +}; + +/* MLME_GET request worker functions */ +static void internal_mlme_get_req_worker(struct work_struct *work); + +/* MLME_SET request worker functions */ +static void internal_mlme_set_req_worker(struct work_struct *work); + +void mac_pib_reset_def(struct net_device *dev) +{ + u8 pib_value_u8; + u16 pib_value_u16; + u32 pib_value_u32; + u64 pib_value_u64; + + pib_value_u8 = macAckWaitDuration_def; + internal_set_mac_pib(dev, macAckWaitDuration, &pib_value_u8); + + pib_value_u8 = macAssociationPermit_def; + internal_set_mac_pib(dev, macAssociationPermit, &pib_value_u8); + + pib_value_u8 = macAutoRequest_def; + internal_set_mac_pib(dev, macAutoRequest, &pib_value_u8); + + pib_value_u8 = macBattLifeExt_def; + internal_set_mac_pib(dev, macBattLifeExt, &pib_value_u8); + + pib_value_u8 = macBattLifeExtPeriods_def; + internal_set_mac_pib(dev, macBattLifeExtPeriods, &pib_value_u8); + + pib_value_u8 = macBeaconPayloadLength_def; + internal_set_mac_pib(dev, macBeaconPayloadLength, &pib_value_u8); + + pib_value_u8 = macBeaconOrder_def; + internal_set_mac_pib(dev, macBeaconOrder, &pib_value_u8); + + pib_value_u32 = macBeaconTxTime_def; + internal_set_mac_pib(dev, macBeaconTxTime, &pib_value_u32); + + get_random_bytes(&pib_value_u8, sizeof(u8)); + internal_set_mac_pib(dev, macBSN, &pib_value_u8); + + pib_value_u64 = 0; + internal_set_mac_pib(dev, macCoordExtendedAddress, &pib_value_u64); + + pib_value_u16 = macCoordShortAddress_def; + internal_set_mac_pib(dev, macCoordShortAddress, &pib_value_u16); + + get_random_bytes(&pib_value_u8, sizeof(u8)); + internal_set_mac_pib(dev, macDSN, &pib_value_u8); + + pib_value_u8 = macGTSPermit_def; + internal_set_mac_pib(dev, macGTSPermit, &pib_value_u8); + + pib_value_u8 = macMaxCSMABackoffs_def; + internal_set_mac_pib(dev, macMaxCSMABackoffs, &pib_value_u8); + + pib_value_u8 = macMinBE_def; + internal_set_mac_pib(dev, macMinBE, &pib_value_u8); + + pib_value_u16 = macPANId_def; + internal_set_mac_pib(dev, macPANId, &pib_value_u16); + + pib_value_u8 = 0; + internal_set_mac_pib(dev, macPromiscuousMode, &pib_value_u8); + + pib_value_u8 = macRxOnWhenIdle_def; + internal_set_mac_pib(dev, macRxOnWhenIdle, &pib_value_u8); + + pib_value_u16 = macShortAddress_def; + internal_set_mac_pib(dev, macShortAddress, &pib_value_u16); + + pib_value_u8 = macSuperframeOrder_def; + internal_set_mac_pib(dev, macSuperframeOrder, &pib_value_u8); + + pib_value_u16 = macTransactionPersistenceTime_def; + internal_set_mac_pib(dev, macTransactionPersistenceTime, &pib_value_u16); + + pib_value_u8 = macAssociatedPANCoord_def; + internal_set_mac_pib(dev, macAssociatedPANCoord, &pib_value_u8); + + pib_value_u8 = macMaxBE_def; + internal_set_mac_pib(dev, macMaxBE, &pib_value_u8); + + pib_value_u16 = macMaxFrameTotalWaitTime_def; + internal_set_mac_pib(dev, macMaxFrameTotalWaitTime, &pib_value_u16); + + pib_value_u16 = macResponseWaitTime_def; + internal_set_mac_pib(dev, macResponseWaitTime, &pib_value_u16); + + pib_value_u8 = macSecurityEnabled_def; + internal_set_mac_pib(dev, macSecurityEnabled, &pib_value_u8); +} + +/* + * MLME GET REQUEST related functions + */ + +int mlme_get_req(struct net_device *dev, u8 PIBattr) +{ + return 0; +} + +/* + * MLME SET REQUEST related functions + */ + +int mlme_set_req(struct net_device *dev, u8 PIBattr, void *PIBval) +{ + int ret = 0; + return ret; +} + -- 1.7.4.1 ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Linux-zigbee-devel mailing list Linux-zigbee-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel