aboutsummaryrefslogtreecommitdiffstats
path: root/utils.py
diff options
context:
space:
mode:
authorHenryk Plötz <henryk@ploetzli.ch>2010-10-15 17:58:54 +0200
committerHenryk Plötz <henryk@ploetzli.ch>2010-10-15 17:58:54 +0200
commit20b8d8167ee864c88287412da224d93c17381a08 (patch)
tree6da5a168fcc5244d168e086be4070c561d89ea21 /utils.py
parent2cc37817d7fbc0f2f10cf09090f9ac06f6bbbc7e (diff)
Add generic response chaining capability
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils.py b/utils.py
index e68007f..00533dc 100644
--- a/utils.py
+++ b/utils.py
@@ -224,6 +224,10 @@ class Transmission_Frame(object):
parts.append("data=%r" % self.data)
return "%s(%s)" % (self.__class__.__name__, ", ".join(parts))
+
+ # Stub for implementation in subclasses
+ # Semantics should be: c=a.append(b) <=> c.data == a.data + b.data and c.status == b.status
+ append = None
class Command_Frame(Transmission_Frame):
pass
@@ -472,6 +476,9 @@ class R_APDU(Response_Frame,APDU):
def render(self):
"Return this APDU as a binary string"
return self.data + self.sw
+
+ def append(self, other):
+ return R_APDU(self.data + other.data + other.sw)
APDU.COMMAND_CLASS = C_APDU
APDU.RESPONSE_CLASS = R_APDU