Some cleanup of the OOBhandler and communication with GMCP.
This commit is contained in:
parent
08525f11ee
commit
cc39aff62c
2 changed files with 8 additions and 3 deletions
|
|
@ -375,12 +375,14 @@ def oob_list(oobhandler, session, mode, *args, **kwargs):
|
||||||
CMD_MAP = {"oob_error": oob_error, # will get error messages
|
CMD_MAP = {"oob_error": oob_error, # will get error messages
|
||||||
"return_field_report": oob_return_field_report,
|
"return_field_report": oob_return_field_report,
|
||||||
"return_attribute_report": oob_return_attribute_report,
|
"return_attribute_report": oob_return_attribute_report,
|
||||||
|
# MSDP
|
||||||
"REPEAT": oob_repeat,
|
"REPEAT": oob_repeat,
|
||||||
"UNREPEAT": oob_unrepeat,
|
"UNREPEAT": oob_unrepeat,
|
||||||
"SEND": oob_send,
|
"SEND": oob_send,
|
||||||
"ECHO": oob_echo,
|
"ECHO": oob_echo,
|
||||||
"REPORT": oob_report,
|
"REPORT": oob_report,
|
||||||
"UNREPORT": oob_unreport,
|
"UNREPORT": oob_unreport,
|
||||||
"LIST": oob_list
|
"LIST": oob_list,
|
||||||
|
# GMCP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -221,12 +221,15 @@ class TelnetOOB(object):
|
||||||
|
|
||||||
print "decode_gmcp:", data
|
print "decode_gmcp:", data
|
||||||
if data:
|
if data:
|
||||||
splits = data.split(" ", 1)
|
splits = data.split(None, 1)
|
||||||
cmdname = splits[0]
|
cmdname = splits[0]
|
||||||
if len(splits) < 2:
|
if len(splits) < 2:
|
||||||
self.protocol.data_in(oob=(cmdname, (), {}))
|
self.protocol.data_in(oob=(cmdname, (), {}))
|
||||||
elif splits[1]:
|
elif splits[1]:
|
||||||
struct = json.loads(json.dumps(splits[1]))
|
try:
|
||||||
|
struct = json.loads(splits[1])
|
||||||
|
except ValueError:
|
||||||
|
struct = splits[1]
|
||||||
args, kwargs = (), {}
|
args, kwargs = (), {}
|
||||||
if hasattr(struct, "__iter__"):
|
if hasattr(struct, "__iter__"):
|
||||||
if isinstance(struct, dict):
|
if isinstance(struct, dict):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue