diff options
author | Yuichi Ito <ito.yuichi0@gmail.com> | 2013-10-28 16:04:45 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2013-10-28 22:55:15 +0900 |
commit | 6048694889d3cb27a5c7162d2476a295306b5002 (patch) | |
tree | 7123cdb11e116dfe743fe4109b901243bf7cf9e2 | |
parent | d9e4791c567d983a5d478b02b35d5d7ddadbdef3 (diff) |
packet lib: sctp: aggregate the same method into the base class
Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/lib/packet/sctp.py | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/ryu/lib/packet/sctp.py b/ryu/lib/packet/sctp.py index e491c37f..8c1a20b0 100644 --- a/ryu/lib/packet/sctp.py +++ b/ryu/lib/packet/sctp.py @@ -1133,9 +1133,12 @@ class cause(stringify.StringifyMixin): def parser(cls, buf): pass - @abc.abstractmethod def serialize(self): - pass + if 0 == self.length: + self.length = self._MIN_LEN + buf = struct.pack( + self._PACK_STR, self.cause_code(), self.length) + return buf def __len__(self): length = self.length @@ -1350,13 +1353,6 @@ class cause_out_of_resource(cause): (_, length) = struct.unpack_from(cls._PACK_STR, buf) return cls(length) - def serialize(self): - if 0 == self.length: - self.length = self._MIN_LEN - buf = struct.pack( - self._PACK_STR, self.cause_code(), self.length) - return buf - @chunk_abort.register_cause_code @chunk_error.register_cause_code @@ -1483,13 +1479,6 @@ class cause_invalid_param(cause): (_, length) = struct.unpack_from(cls._PACK_STR, buf) return cls(length) - def serialize(self): - if 0 == self.length: - self.length = self._MIN_LEN - buf = struct.pack( - self._PACK_STR, self.cause_code(), self.length) - return buf - @chunk_abort.register_cause_code @chunk_error.register_cause_code @@ -1583,13 +1572,6 @@ class cause_cookie_while_shutdown(cause): (_, length) = struct.unpack_from(cls._PACK_STR, buf) return cls(length) - def serialize(self): - if 0 == self.length: - self.length = self._MIN_LEN - buf = struct.pack( - self._PACK_STR, self.cause_code(), self.length) - return buf - @chunk_abort.register_cause_code @chunk_error.register_cause_code |