示例#1
0
文件: dcf.py 项目: reidlindsay/wins
    def __init__(self, cwmin=None, cwmax=None, retrylimit=None, \
                       usecsma=False, **kwargs):
        """Constructor.

        :param cwmin: Minimum contention window size.
        :param cwmax: Maximum contention window size.
        :param retrylimit: Maximum number of retries allowed.
        :param usecsma: Boolean flag; if true, use CSMA/CA without RTS-CTS
                        reservation messages.
        :param kwargs: Additional keywords passed to `configure()`.

        The default parameters are specified by the class.
        """
        if cwmin is None: cwmin = self.__class__.cwmin
        if cwmax is None: cwmax = self.__class__.cwmax
        if retrylimit is None: retrylimit = self.__class__.retrylimit
        # timing parameters
        self.sifs, self.slottime = None, None
        self.cwmin, self.cwmax   = cwmin, cwmax
        self.cslot = None
        # events and other members
        self.datatosend = None
        self.retrycount = None
        self.retrylimit = retrylimit
        self.usecsma = usecsma
        self.rxdata = SimEvent(name=".rxdata")
        self._ctsduration = None
        self._ackduration = None
        # call CSMAC constructor
        CSMAC.__init__(self, **kwargs)
        self.rxdata.name = "%s.rxdata"%(self.name)
示例#2
0
文件: dcf.py 项目: reidlindsay/wins
 def log(self, event=None, p=None, *args, **kwargs):
     """Overloaded to check verbose level and set common annotations."""
     force = False
     if ('verbose' in kwargs): force = (kwargs['verbose']>DOT11_VERBOSE)
     if self.verbose>DOT11_VERBOSE or force:
         kwargs.update(self.get_dcf_anno(p))
         CSMAC.log(self, event, p, *args, **kwargs)
示例#3
0
文件: dcf.py 项目: reidlindsay/wins
 def configure(self, **kwargs):
     """Configure downstream ports and `FSM`."""
     CSMAC.configure(self, **kwargs)
     # add downstream and control ports
     self.addport("TXD", tracename=self.tracename+".TXD")
     self.addport("RXD", tracename=self.tracename+".RXD")
     self.addport("TXC", tracename=self.tracename+".TXC") # control port
     # create FSM to manage send/recv execution of DCF
     txfsm = self.newchild("txfsm", FSM, tracename=self.tracename+".TX")
     rxfsm = self.newchild("rxfsm", FSM, tracename=self.tracename+".RX")
     txfsm.goto(self.IDLE)
     rxfsm.goto(self.RECV)
     # set up timing parameters
     self.set_timing()
     nav = self.newchild("nav", NAVTimer, tracename=self.tracename+".NAV")
示例#4
0
文件: dcf.py 项目: reidlindsay/wins
 def connect(self, p):
     """Overloaded to connect and call `set_phy()`."""
     self.set_phy(p)
     return CSMAC.connect(self, p)