Skip to content
Snippets Groups Projects
Commit 51765faf authored by Phil's avatar Phil
Browse files

Changed ls() to take advantage of conf.layers

parent d4d86e9c
No related branches found
No related tags found
No related merge requests found
......@@ -1098,13 +1098,13 @@ def split_layers(lower, upper, __fval=None, **fval):
def ls(obj=None):
"""List available layers, or infos on a given layer"""
if obj is None:
import __builtin__
all = __builtin__.__dict__.copy()
all.update(globals())
objlst = filter(lambda (n,o): isinstance(o,type) and issubclass(o,Packet), all.items())
objlst.sort(lambda x,y:cmp(x[0],y[0]))
for n,o in objlst:
print "%-10s : %s" %(n,o.name)
objlst = sorted(conf.layers, key=lambda x:x.__name__)
for o in objlst:
print "%-10s : %s" %(o.__name__,o.name)
else:
if isinstance(obj, type) and issubclass(obj, Packet):
for f in obj.fields_desc:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment