correct mcs bugs

This commit is contained in:
sylvain
2013-10-22 22:58:34 +02:00
parent b0949e6f3c
commit b880c027a9
4 changed files with 18 additions and 7 deletions

View File

@@ -150,7 +150,10 @@ def writeBoolean(b):
@param b: boolean
@return: ber boolean structure
'''
return (writeUniversalTag(Tag.BER_TAG_BOOLEAN, False), writeLength(1), UInt8(int(b)))
boolean = UInt8(0)
if b:
boolean = UInt8(0xff)
return (writeUniversalTag(Tag.BER_TAG_BOOLEAN, False), writeLength(1), boolean)
def readInteger(s):
'''
@@ -190,9 +193,9 @@ def writeInteger(value):
@param param: int or python long
@return ber interger structure
'''
if value < 0xff:
if value <= 0xff:
return (writeUniversalTag(Tag.BER_TAG_INTEGER, False), writeLength(1), UInt8(value))
elif value < 0xff80:
elif value <= 0xffff:
return (writeUniversalTag(Tag.BER_TAG_INTEGER, False), writeLength(2), UInt16Be(value))
else:
return (writeUniversalTag(Tag.BER_TAG_INTEGER, False), writeLength(4), UInt32Be(value))

View File

@@ -61,7 +61,7 @@ class MCS(LayerAutomata):
ccReqStream.writeType(ccReq)
tmp = (ber.writeOctetstring("\x01"), ber.writeOctetstring("\x01"), ber.writeBoolean(True),
self.writeDomainParams(34, 2, 0, 0xffff),
self.writeDomainParams(34, 2, 0, 0xffff),self.writeDomainParams(1, 1, 1, 0x420),
self.writeDomainParams(0xffff, 0xfc17, 0xffff, 0xffff),
ber.writeOctetstring(ccReqStream.getvalue()))
self._transport.send((ber.writeApplicationTag(Message.MCS_TYPE_CONNECT_INITIAL, sizeof(tmp)), tmp))