mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-05 12:26:11 +02:00
packet lib: For convenience, make packet into a sequence type
Protocols can mow be accesed as packet[n]. Signed-off-by: Shaun Crampton <Shaun.Crampton@metaswitch.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
43b439770b
commit
95f79d6a51
@ -95,3 +95,15 @@ class Packet(object):
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __getitem__(self, idx):
|
||||
return self.protocols[idx]
|
||||
|
||||
def __setitem__(self, idx, item):
|
||||
self.protocols[idx] = item
|
||||
|
||||
def __delitem__(self, idx):
|
||||
del self.protocols[idx]
|
||||
|
||||
def __len__(self):
|
||||
return len(self.protocols)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user