Commit fb06337c authored by Grégory Wisniewski's avatar Grégory Wisniewski

Implement the notifyLastOID packet.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1025 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 2f614cb8
......@@ -42,7 +42,8 @@ from protocol import ERROR, REQUEST_NODE_IDENTIFICATION, ACCEPT_NODE_IDENTIFICAT
INTERNAL_ERROR_CODE, ASK_PARTITION_LIST, ANSWER_PARTITION_LIST, ASK_NODE_LIST, \
ANSWER_NODE_LIST, SET_NODE_STATE, ANSWER_NODE_STATE, SET_CLUSTER_STATE, \
ASK_NODE_INFORMATION, ANSWER_NODE_INFORMATION, NO_ERROR_CODE, \
ASK_CLUSTER_STATE, ANSWER_CLUSTER_STATE, NOTIFY_CLUSTER_INFORMATION
ASK_CLUSTER_STATE, ANSWER_CLUSTER_STATE, NOTIFY_CLUSTER_INFORMATION, \
NOTIFY_LAST_OID
class EventHandler(object):
......@@ -357,6 +358,9 @@ class EventHandler(object):
def handleNotifyClusterInformation(self, conn, packet, state):
raise UnexpectedPacketError
def handleNotifyLastOID(self, conn, packet, oid):
raise UnexpectedPacketError
# Error packet handlers.
# XXX: why answer a protocolError to another protocolError ?
......@@ -445,6 +449,7 @@ class EventHandler(object):
d[ASK_CLUSTER_STATE] = self.handleAskClusterState
d[ANSWER_CLUSTER_STATE] = self.handleAnswerClusterState
d[NOTIFY_CLUSTER_INFORMATION] = self.handleNotifyClusterInformation
d[NOTIFY_LAST_OID] = self.handleNotifyLastOID
return d
......
......@@ -301,6 +301,10 @@ packet_types = Enum({
# Notify being alive. Any -> Any.
'PONG': 0x0029,
# Notify last OID generated
'NOTIFY_LAST_OID': 0x0030,
})
# Error codes.
......@@ -1080,6 +1084,12 @@ def _decodeNotifyClusterInformation(body):
return (state, )
decode_table[NOTIFY_CLUSTER_INFORMATION] = _decodeNotifyClusterInformation
@handle_errors
def _decodeNotifyLastOID(body):
(loid, ) = unpack('8s', body)
return (loid, )
decode_table[NOTIFY_LAST_OID] = _decodeNotifyLastOID
# Packet encoding
......@@ -1445,3 +1455,6 @@ def notifyClusterInformation(state):
body = pack('!H', state)
return Packet(NOTIFY_CLUSTER_INFORMATION, body)
def notifyLastOID(oid):
body = pack('!8s', oid)
return Packet(NOTIFY_LAST_OID, body)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment