This commit is contained in:
Sven Zehl 2016-09-27 15:03:14 +02:00
parent 2ec696beef
commit 81b1093f35
6 changed files with 26 additions and 10 deletions

View File

@ -1818,7 +1818,7 @@ enum nl80211_attrs {
/* add attributes here, update the policy in nl80211.c */
#ifdef CPTCFG_ATH9K_TID_SLEEPING
NL80211_ATTR_TID_SLEEP,
NL80211_ATTR_TID_SLEEP,
#endif
__NL80211_ATTR_AFTER_LAST,

View File

@ -1,4 +1,4 @@
CFLAGS=-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -DTID_SLEEPING
CFLAGS=-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
LXDIALOG := lxdialog/checklist.o lxdialog/inputbox.o lxdialog/menubox.o lxdialog/textbox.o lxdialog/util.o lxdialog/yesno.o

View File

@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*-coding: utf-8 -*-
import logging
import time
from hmac_python_wrapper import HybridTDMACSMAMac, AccessPolicy
__author__ = "Sven Zehl, Anatolij Zubow"
@ -22,7 +25,14 @@ if __name__ == "__main__":
- B. time slots 5-8 can be used by any best effort traffic towards STA with MAC address 34:13:e8:24:77:be
- B. the other time slots are guard time slots, i.e. blocked from being used
'''
log = logging.getLogger("HMAC.Example")
log = logging.getLogger()
handler = logging.StreamHandler()
handler.setLevel(logging.INFO)
formatter = logging.Formatter("%(levelname)s - %(message)s")
handler.setFormatter(formatter)
log.addHandler(handler)
# configuration of hybrid MAC
dstHWAddr = "34:13:e8:24:77:be" # STA destination MAC address
@ -31,7 +41,7 @@ if __name__ == "__main__":
iface = 'wlan0'
# create new MAC for local node
mac = HybridTDMACSMAMac(no_slots_in_superframe=total_slots, slot_duration_ns=slot_duration)
mac = HybridTDMACSMAMac(log, iface, total_slots, slot_duration)
be_slots = [1,2,3,4]

View File

@ -1,3 +1,6 @@
#!/usr/bin/env python
# -*-coding: utf-8 -*-
import logging
import time
import subprocess
@ -12,7 +15,7 @@ __email__ = "{zehl, zubow}@tkn.tu-berlin.de"
Class for controlling the hybrid TDMA/CSMA MAC.
"""
class HybridTDMACSMAMac(object):
def __init__(self, interface, no_slots_in_superframe, slot_duration_ns,
def __init__(self, log, interface, no_slots_in_superframe, slot_duration_ns,
hmac_binary_path='hmac_userspace_daemon/hmac_userspace_daemon',
local_mac_processor_port=1217):
'''
@ -23,8 +26,7 @@ class HybridTDMACSMAMac(object):
:param hmac_binary_path: path to the C++ userland HMAC daemon
:param local_mac_processor_port: ZeroMQ port used for communication with HMAC daemon
'''
self.log = logging.getLogger("{module}.{name}".format(
module=self.__class__.__module__, name=self.__class__.__name__))
self.log = log
self.interface = interface
self.mNo_slots_in_superframe = no_slots_in_superframe
@ -126,7 +128,7 @@ class HybridTDMACSMAMac(object):
conf_str = self._create_configuration_string()
# construct command argument for HMAC daemon
processArgs = str(self.exec_file) + " -d 0 " + " -i" + str(self.interface) \
processArgs = str(self.hmac_binary_path) + " -d 0 " + " -i" + str(self.interface) \
+ " -f" + str(self.getSlotDuration()) + " -n" + str(self.getNumSlots()) + " -c" + conf_str
self.log.debug('Starting HMAC daemon with: %s' % processArgs)

View File

@ -39,8 +39,10 @@
#include <netlink/attr.h>
#include <netlink/socket.h>
#include <stdlib.h>
#define CPTCFG_ATH9K_TID_SLEEPING
#include "../backports-3.12.8-1/include/uapi/linux/nl80211.h"
#include "iw.h"
//nclude "../backports-3.12.8-1/include/uapi/linux/nl80211.h"
#include <pthread.h>
#include <unistd.h>
#include <cassert>
@ -51,6 +53,7 @@
#include <sstream>
#include <vector>
// struct to be passed via netlink to ath9k driver
struct tid_sleep_tuple
{
@ -235,8 +238,9 @@ static int send_nl_msg(std::string& schedule)
goto out_free_msg;
}
// create NetLink message
genlmsg_put(msg, 0, 0, state.nl80211_id, 0, 0, NL80211_CMD_TID_SLEEP, 0);
genlmsg_put(msg, 0, 0, state.nl80211_id, 0, 0, NL80211_CMD_SET_TID_SLEEP, 0);
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, devidx);
// update tids_tuple with current slot schedule

View File

@ -7,7 +7,7 @@
#include <netlink/genl/family.h>
#include <netlink/genl/ctrl.h>
#include <endian.h>
#include "../backports-3.12.8-1/include/uapi/linux/nl80211.h"
#include "ieee80211.h"
#define ETH_ALEN 6