Files
storage_fresco/cc_tpdu.py
2019-05-23 13:36:01 +00:00

55 lines
1.2 KiB
Python
Executable File

#!/usr/bin/python
__author__ = "Daniel Egger"
__date__ = "22 March 2002"
__email__ = "egger@interearth.com"
__version__ = "$Revision: 1.1 $"[11:-2]
from cany_tpdu import CANY_TPDU
from tpdu import TPDU_CC
__all__ = ["fromstring", "CC_TPDU"]
def fromstring (data):
"""
Decode the binary representation of a TPDU from the given
parameter and note the data in the instance of the object.
Parameters:
data: The binary form of the TPDU
"""
tpdu = CC_TPDU ()
tpdu.fromstring (data)
return tpdu
class CC_TPDU (CANY_TPDU):
def __init__ (self, srctsap = "", dsttsap = "", *args, **args2):
CANY_TPDU.__init__ (self, TPDU_CC, srctsap, dsttsap, *args, **args2)
return
def identify (self):
"""
This method can be used to identify a TPDU by string.
"""
return "CC TPDU (Connection request reply)\n"
# Integrated tests start here
if __name__ == '__main__':
testnum = 1
tpdu = CC_TPDU ("SOURCE", "DEST")
print "Test %0d sucessful" % testnum
testnum += 1
tpdu = CC_TPDU ("TCP-1", "TCP", dstref=0x005, srcref=0x4431)
print "Test %0d sucessful" % testnum
testnum += 1
print tpdu
print "Test %0d sucessful" % testnum
testnum += 1