aboutsummaryrefslogtreecommitdiff
path: root/rpkid
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2010-02-23 22:52:38 +0000
committerRob Austein <sra@hactrn.net>2010-02-23 22:52:38 +0000
commitb01b3e3fac2db84b01aae61df6c8de3ff3d374c3 (patch)
tree2df0465985e825d8050c4696970bb01657443669 /rpkid
parent2a7c7f3a6d8cff0bc6b1f6ff50ecbd8069975f9d (diff)
Initial cut of <list_received_resources/> code.
svn path=/rpkid/irbe_cli.py; revision=3002
Diffstat (limited to 'rpkid')
-rw-r--r--rpkid/irbe_cli.py4
-rw-r--r--rpkid/rpki/left_right.py40
2 files changed, 43 insertions, 1 deletions
diff --git a/rpkid/irbe_cli.py b/rpkid/irbe_cli.py
index 93f86fb8..12b509fd 100644
--- a/rpkid/irbe_cli.py
+++ b/rpkid/irbe_cli.py
@@ -215,9 +215,11 @@ class repository_elt(cmd_elt_mixin, rpki.left_right.repository_elt):
pass
class list_published_objects_elt(cmd_elt_mixin, rpki.left_right.list_published_objects_elt):
-
excludes = ("uri",)
+class list_received_resources_elt(cmd_elt_mixin, rpki.left_right.list_received_resources_elt):
+ excludes = ("notBefore", "notAfter", "uri", "sia_uri", "aia_uri", "asn", "ipv4", "ipv6")
+
class report_error_elt(reply_elt_mixin, rpki.left_right.report_error_elt):
pass
diff --git a/rpkid/rpki/left_right.py b/rpkid/rpki/left_right.py
index ac0e22e1..9e3a6fed 100644
--- a/rpkid/rpki/left_right.py
+++ b/rpkid/rpki/left_right.py
@@ -997,6 +997,46 @@ class list_published_objects_elt(rpki.xml_utils.text_elt, left_right_namespace):
r_pdu.obj = obj.get_Base64()
return r_pdu
+class list_received_resources_elt(rpki.xml_utils.text_elt, left_right_namespace):
+ """
+ <list_received_resources/> element.
+ """
+
+ element_name = "list_received_resources"
+ attributes = ("self_handle", "tag",
+ "notBefore", "notAfter", "uri", "sia_uri", "aia_uri", "asn", "ipv4", "ipv6")
+
+ def serve_dispatch(self, r_msg, cb, eb):
+ """
+ Handle a <list_received_resources/> query. The method name is a
+ misnomer here, there's no action attribute and no dispatch, we
+ just dump a bunch of data about every certificate issued to us by
+ one of our parents, then return.
+ """
+ for parent in self_elt.serve_fetch_handle(self.gctx, None, self.self_handle).parents():
+ for ca in parent.cas():
+ ca_detail = ca.fetch_active()
+ if ca_detail is not None and ca_detail.latest_ca_cert is not None:
+ r_msg.append(self.make_reply(ca_detail.ca_cert_uri, ca_detail.latest_ca_cert))
+ cb()
+
+ def make_reply(self, uri, cert):
+ """
+ Generate one reply PDU.
+ """
+ resources = cert.get_3779resources()
+ return self.make_pdu(
+ tag = self.tag,
+ self_handle = self.self_handle,
+ notBefore = str(cert.getNotBefore()),
+ notAfter = str(cert.getNotAfter()),
+ uri = uri,
+ sia_uri = cert.get_SIA(),
+ aia_uri = cert.get_AIA(),
+ asn = resources.asn,
+ ipv4 = resources.v4,
+ ipv6 = resources.v6)
+
class report_error_elt(rpki.xml_utils.text_elt, left_right_namespace):
"""
<report_error/> element.