diff options
author | Rob Austein <sra@hactrn.net> | 2009-04-07 23:09:19 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2009-04-07 23:09:19 +0000 |
commit | 941a0d1e4bbffdd0cd033200f1cef22b083ba4ae (patch) | |
tree | f40b31d4b29b01d6a0c8d6c8252aa1a60960f85d /rtr-origin | |
parent | 05569362ab52a905f08520e09adbc314083c7e74 (diff) |
Handle cache_reset
svn path=/rtr-origin/rtr-origin.py; revision=2322
Diffstat (limited to 'rtr-origin')
-rw-r--r-- | rtr-origin/rtr-origin.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/rtr-origin/rtr-origin.py b/rtr-origin/rtr-origin.py index 9ea66700..f2e362cb 100644 --- a/rtr-origin/rtr-origin.py +++ b/rtr-origin/rtr-origin.py @@ -119,7 +119,8 @@ class pdu(object): return reader.update(need = self.header_struct.size, callback = self.got_header) def consume(self, client): - """Handle results in test client. Default is just to print the PDU.""" + """Handle results in test client. Default behavior is just to + print out the PDU.""" log(self) class pdu_with_serial(pdu): @@ -181,7 +182,9 @@ class serial_notify(pdu_with_serial): pdu_type = 0 def consume(self, client): - """Handle results in test client.""" + """Respond to a serial_notify message with either a serial_query + or reset_query, depending on what we already know. + """ log(self) if client.current_serial is None: client.push_pdu(reset_query()) @@ -248,15 +251,21 @@ class end_of_data(pdu_with_serial): pdu_type = 7 def consume(self, client): - """Handle results in test client.""" + """Handle end_of_data response.""" log(self) client.current_serial = self.serial #client.close() class cache_reset(pdu_empty): """Cache reset PDU.""" + pdu_type = 8 + def consume(self, client): + """Handle cache_reset response, by issuing a reset_query.""" + log(self) + client.push_pdu(reset_query()) + class prefix(pdu): """Object representing one prefix. This corresponds closely to one PDU in the rpki-router protocol, so closely that we use lexical @@ -597,10 +606,6 @@ class pdu_channel(asynchat.async_chat): self.deliver_pdu(p) self.start_new_pdu() - def deliver_pdu(self, pdu): - """Subclass must implement this.""" - raise NotImplementedError - def push_pdu(self, pdu): """Write PDU to stream.""" data = pdu.to_pdu() |