def __init__(self, numSNBits=16): """Initialize the packet format. By default use 16 bits for seq.nums. Arguments: numSNBits:Integer -- number of bits for the sequence numbers in the packet format. """ PointToPointDL.__init__(self) self._newFrame = None # We need the window size before creating PDUs. self._sendBuffer = {} # Dictionary: SN --> Bitstream self._retransmissionTimer = {} # Dictionary: SN --> Timer self._transmitQueue = [] # List of frames to transmit self._SN_MODULO = 2**numSNBits if (2 * numSNBits) % 8 != 0: padLen = 8 - (2 * numSNBits) % 8 self._newFrame = formatFactory( [ ('SN', 'BitField', numSNBits, 0), # Sequence number ('RN', 'BitField', numSNBits, 0), # Acknowledged SN ('pad', 'BitField', padLen, 0), # Padding to align to octets ('data', 'ByteField', None, None), # Payload ('FCS', 'Int', 32, None) ], # Checksum: CRC32. self) else: self._newFrame = formatFactory( [ ('SN', 'BitField', numSNBits, 0), # Sequence number ('RN', 'BitField', numSNBits, 0), # Acknowledged SN ('data', 'ByteField', None, None), # Payload ('FCS', 'Int', 32, None) ], # Checksum: CRC32. self)
def __init__(self,numSNBits=16): """Initialize the packet format. By default use 16 bits for seq.nums. Arguments: numSNBits:Integer -- number of bits for the sequence numbers in the packet format. """ PointToPointDL.__init__(self) self._newFrame = None # We need the window size before creating PDUs. self._sendBuffer = {} # Dictionary: SN --> Bitstream self._retransmissionTimer = {} # Dictionary: SN --> Timer self._transmitQueue = [] # List of frames to transmit self._SN_MODULO = 2**numSNBits if (2*numSNBits) % 8 != 0: padLen = 8 - (2*numSNBits)%8 self._newFrame = formatFactory( [('SN', 'BitField', numSNBits, 0), # Sequence number ('RN', 'BitField', numSNBits, 0), # Acknowledged SN ('pad', 'BitField', padLen, 0), # Padding to align to octets ('data', 'ByteField', None, None), # Payload ('FCS', 'Int', 32, None)], # Checksum: CRC32. self) else: self._newFrame = formatFactory( [('SN', 'BitField', numSNBits, 0), # Sequence number ('RN', 'BitField', numSNBits, 0), # Acknowledged SN ('data', 'ByteField', None, None), # Payload ('FCS', 'Int', 32, None)], # Checksum: CRC32. self)
def __init__(self): PointToPointDL.__init__(self) self._newFrame = formatFactory( [('SN', 'BitField', 1, 0), # Sequence number: 1 bit, defaul: 0 ('RN', 'BitField', 1, 0), # Acknowledged SN: 1 bit, default: 0 ('pad', 'BitField', 6, 0), # Padding to align to octet boundaries ('data', 'ByteField', None, None), # Payload ('FCS', 'Int', 32, None)], # Checksum: CRC32. self)
def __init__(self): PointToPointDL.__init__(self) self._newFrame = formatFactory( [ ('SN', 'BitField', 1, 0), # Sequence number: 1 bit, defaul: 0 ('RN', 'BitField', 1, 0), # Acknowledged SN: 1 bit, default: 0 ('pad', 'BitField', 6, 0), # Padding to align to octet boundaries ('data', 'ByteField', None, None), # Payload ('FCS', 'Int', 32, None) ], # Checksum: CRC32. self)
def __init__(self): PointToPointDL.__init__(self) self._newFrame = formatFactory( [('DstAddr', 'Int', 8, 0), # Destination address ('SrcAddr', 'Int', 8, 0), # Source address ('SN', 'BitField', 1, 0), # Sequence number: 1 bit, defaul: 0 ('RN', 'BitField', 1, 0), # Acknowledged SN: 1 bit, default: 0 ('pad', 'BitField', 6, 0), # Padding to align to octet boundaries ('data', 'ByteField', None, None), # Payload ('FCS', 'Int', 32, None)], # Checksum: CRC32. self) self._transmitQueue = [] # List of frames to transmit self._computeBackoff = self._fixedBackoff self._VR = {} self._VS = {}
def __init__(self): PointToPointDL.__init__(self) self._newFrame = formatFactory( [ ('DstAddr', 'Int', 8, 0), # Destination address ('SrcAddr', 'Int', 8, 0), # Source address ('SN', 'BitField', 1, 0), # Sequence number: 1 bit, defaul: 0 ('RN', 'BitField', 1, 0), # Acknowledged SN: 1 bit, default: 0 ('pad', 'BitField', 6, 0), # Padding to align to octet boundaries ('data', 'ByteField', None, None), # Payload ('FCS', 'Int', 32, None) ], # Checksum: CRC32. self) self._transmitQueue = [] # List of frames to transmit self._computeBackoff = self._fixedBackoff self._VR = {} self._VS = {}