def main(): """ Parser Options """ parser = OptionParser (option_class=eng_option) MimoMPIF.add_parser_options (parser) if not parser.has_option("--phy-addr"): parser.add_option("", "--phy-addr", type="string", default="0.0.0.0", \ help="set address for PHY [default=%default]") (options, args) = parser.parse_args () if len(args)!=0: parser.print_help() sys.exit(1) global RATE_LIMIT if (options.nchannels == 4): RATE_LIMIT = 32 elif (options.nchannels == 2): RATE_LIMIT = 16 elif (options.nchannels == 1): RATE_LIMIT = 8 mac = mimo.mac(options.phy_addr, options.mac_port) mac.start() #f = FuncThread(send_data, "tx-data", mac) f = FuncThread(send_80211data, "tx-data", mac) f.setDaemon(1) g = FuncThread(recv_data, "rx-data", mac) g.setDaemon(1) h = FuncThread(recv_ctrl, "rx-ctrl", mac) h.setDaemon(1) for x in [f,g,h]: x.start() #for x in [g,h]: x.start() raw_input("Press Enter to quit:\n") mac.shutdown() p = persist() # start a persitent thread
def __init__(self, name="csma-mac", options=None, **kwargs): """Constructor; all arguments passed to `TunClient` constructor; see `csma_defaults` for more about `options`.""" if options is None: options = csma_defaults self.__mtu = options.mtu # call TunClient constructor TunClient.__init__(self, name=name, options=options, **kwargs) # set up public members self.datatosend = None self.retrycount = 0 self.cslot = None self.macdb = MACDB(timeout=None) # set up remaining private members self.__mpif = mimo.mac(options.phy_addr, options.mac_port) self.__addr = None self.__rxdata = ParamEvent() # got RXDATA from PHY self.__csbusy = ParamEvent() # got CSBUSY from PHY self.__txdone = ParamEvent() # got TXDONE from PHY self.__txdata = ParamEvent() # New data to available to transmit self.__toidle = Event() # Entered IDLE state self.__mctrl = None # monitor ctrlQ of MPIF self.__mrecv = None # monitor outputQ of MPIF self.__msend = None # monitor send data from tun/tap interface