aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/left-right-schema.rnc101
-rw-r--r--scripts/left-right-schema.rng270
2 files changed, 200 insertions, 171 deletions
diff --git a/scripts/left-right-schema.rnc b/scripts/left-right-schema.rnc
index 2c41da20..0ded0568 100644
--- a/scripts/left-right-schema.rnc
+++ b/scripts/left-right-schema.rnc
@@ -7,21 +7,16 @@
default namespace = "http://www.hactrn.net/uris/rpki/left-right-spec/"
+# Top level PDU
+
start = element msg {
attribute version { xsd:positiveInteger { maxInclusive="1" } },
- ( self_elt | bsc_elt | parent_elt | child_elt | repository_elt | route_origin_elt |
+ ( self_elt | bsc_elt | parent_elt | child_elt | repository_elt | ro_elt |
list_resources_elt | report_error_elt )*
}
-action = attribute action { "create" | "set" | "get" | "list" | "destroy" }
-
-type = attribute type { "query" | "reply" }
-
-base64 = xsd:base64Binary { maxLength="512000" }
-
-peer_ta = element peer_ta { base64 }
-
-sql_id = xsd:token { maxLength="1024" }
+# Combinations of action and type attributes used in later definitions.
+# The same patterns repeat in most of the elements in this protocol.
ctl_cq = attribute action { "create" }, attribute type { "query" }
ctl_sq = attribute action { "set" }, attribute type { "query" }
@@ -34,6 +29,17 @@ ctl_gr = attribute action { "get" }, attribute type { "reply" }
ctl_lr = attribute action { "list" }, attribute type { "reply" }
ctl_dr = attribute action { "destroy" }, attribute type { "reply" }
+# Base64 encoded DER stuff
+base64 = xsd:base64Binary { maxLength="512000" }
+
+# How we wrap peer_ta fields (separate element or inline?)
+peer_ta = element peer_ta { base64 }
+
+# Base definition for all fields that are really just SQL primary indices
+sql_id = xsd:token { maxLength="1024" }
+
+# <self/> element
+
self_bool = (attribute rekey { "yes" }?,
attribute reissue { "yes" }?,
attribute revoke { "yes" }?,
@@ -58,6 +64,8 @@ self_elt |= element self { ctl_lr, self_id, self_payload }
self_elt |= element self { ctl_dq, self_id }
self_elt |= element self { ctl_dr, self_id }
+# <bsc/> element
+
bsc_bool = (attribute generate_keypair { "yes" },
attribute key_type { xsd:token { maxLength="1024" } }?,
attribute hash_alg { xsd:token { maxLength="1024" } }?,
@@ -81,6 +89,8 @@ bsc_elt |= element bsc { ctl_lr, self_id, bsc_id, bsc_payload }
bsc_elt |= element bsc { ctl_dq, self_id, bsc_id }
bsc_elt |= element bsc { ctl_dr, self_id, bsc_id }
+# <parent/> element
+
parent_id = attribute parent_id { sql_id }
parent_bool = (attribute rekey { "yes" }?,
@@ -104,6 +114,8 @@ parent_elt |= element parent { ctl_lr, self_id, parent_id, parent_payload }
parent_elt |= element parent { ctl_dq, self_id, parent_id }
parent_elt |= element parent { ctl_dr, self_id, parent_id }
+# <child/> element
+
child_id = attribute child_id { sql_id }
child_bool = attribute reissue { "yes" }?
@@ -123,6 +135,8 @@ child_elt |= element child { ctl_lr, self_id, child_id, child_payload }
child_elt |= element child { ctl_dq, self_id, child_id }
child_elt |= element child { ctl_dr, self_id, child_id }
+# <repository/> element
+
repository_id = attribute repository_id { sql_id }
repository_payload = (attribute peer_contact { xsd:anyURI { maxLength="1024" } }?,
@@ -140,40 +154,47 @@ repository_elt |= element repository { ctl_lr, self_id, repository_id, repositor
repository_elt |= element repository { ctl_dq, self_id, repository_id }
repository_elt |= element repository { ctl_dr, self_id, repository_id }
-route_origin_id = attribute route_origin_id { sql_id }
-
-route_origin_bool = attribute suppress_publication { "yes" }?
-
-route_origin_payload = (attribute asn { xsd:token { maxLength="1024" } }?,
- attribute ipv4 { xsd:token { maxLength="1024" } }?,
- attribute ipv6 { xsd:token { maxLength="1024" } }?)
-
-route_origin_elt |= element route_origin { ctl_cq, self_id, route_origin_bool, route_origin_payload }
-route_origin_elt |= element route_origin { ctl_cr, self_id, route_origin_id }
-route_origin_elt |= element route_origin { ctl_sq, self_id, route_origin_id, route_origin_bool, route_origin_payload }
-route_origin_elt |= element route_origin { ctl_sr, self_id, route_origin_id }
-route_origin_elt |= element route_origin { ctl_gq, self_id, route_origin_id }
-route_origin_elt |= element route_origin { ctl_gr, self_id, route_origin_id, route_origin_payload }
-route_origin_elt |= element route_origin { ctl_lq, self_id }
-route_origin_elt |= element route_origin { ctl_lr, self_id, route_origin_id, route_origin_payload }
-route_origin_elt |= element route_origin { ctl_dq, self_id, route_origin_id }
-route_origin_elt |= element route_origin { ctl_dr, self_id, route_origin_id }
-
-list_resources_payload = (attribute valid_until { xsd:token { maxLength="1024" } }?,
- element resource_class {
- attribute subject_name { xsd:token { maxLength="1024" } }?,
- attribute as { xsd:token { maxLength="1024" } }?,
- attribute ipv4 { xsd:token { maxLength="1024" } }?,
- attribute ipv6 { xsd:token { maxLength="1024" } }?,
- attribute req_as { xsd:token { maxLength="1024" } }?,
- attribute req_ipv4 { xsd:token { maxLength="1024" } }?,
- attribute req_ipv6 { xsd:token { maxLength="1024" } }?
- }*)
+# <route_origin/> element
+
+ro_id = attribute route_origin_id { sql_id }
+
+ro_bool = attribute suppress_publication { "yes" }?
+
+ro_payload = (attribute asn { xsd:token { maxLength="1024" } }?,
+ attribute ipv4 { xsd:token { maxLength="1024" } }?,
+ attribute ipv6 { xsd:token { maxLength="1024" } }?)
+
+ro_elt |= element route_origin { ctl_cq, self_id, ro_bool, ro_payload }
+ro_elt |= element route_origin { ctl_cr, self_id, ro_id }
+ro_elt |= element route_origin { ctl_sq, self_id, ro_id, ro_bool, ro_payload }
+ro_elt |= element route_origin { ctl_sr, self_id, ro_id }
+ro_elt |= element route_origin { ctl_gq, self_id, ro_id }
+ro_elt |= element route_origin { ctl_gr, self_id, ro_id, ro_payload }
+ro_elt |= element route_origin { ctl_lq, self_id }
+ro_elt |= element route_origin { ctl_lr, self_id, ro_id, ro_payload }
+ro_elt |= element route_origin { ctl_dq, self_id, ro_id }
+ro_elt |= element route_origin { ctl_dr, self_id, ro_id }
+
+# <list_resources/> element
list_resources_elt = element list_resources {
- type, self_id, child_id?, list_resources_payload
+ ( attribute type { "query" }, self_id, child_id? ) |
+ ( attribute type { "reply" }, self_id, child_id?,
+ attribute valid_until { xsd:token { maxLength="1024" } }?,
+ element resource_class {
+ attribute subject_name { xsd:token { maxLength="1024" } }?,
+ attribute as { xsd:token { maxLength="1024" } }?,
+ attribute ipv4 { xsd:token { maxLength="1024" } }?,
+ attribute ipv6 { xsd:token { maxLength="1024" } }?,
+ attribute req_as { xsd:token { maxLength="1024" } }?,
+ attribute req_ipv4 { xsd:token { maxLength="1024" } }?,
+ attribute req_ipv6 { xsd:token { maxLength="1024" } }?
+ }*
+ )
}
+# <report_error/> element
+
report_error_elt = element report_error {
self_id,
attribute error_code { xsd:token { maxLength="1024" } },
diff --git a/scripts/left-right-schema.rng b/scripts/left-right-schema.rng
index 554e8180..5bd0391e 100644
--- a/scripts/left-right-schema.rng
+++ b/scripts/left-right-schema.rng
@@ -8,6 +8,7 @@
run the compact syntax through trang to get XML syntax.
-->
<grammar ns="http://www.hactrn.net/uris/rpki/left-right-spec/" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <!-- Top level PDU -->
<start>
<element name="msg">
<attribute name="version">
@@ -22,47 +23,17 @@
<ref name="parent_elt"/>
<ref name="child_elt"/>
<ref name="repository_elt"/>
- <ref name="route_origin_elt"/>
+ <ref name="ro_elt"/>
<ref name="list_resources_elt"/>
<ref name="report_error_elt"/>
</choice>
</zeroOrMore>
</element>
</start>
- <define name="action">
- <attribute name="action">
- <choice>
- <value>create</value>
- <value>set</value>
- <value>get</value>
- <value>list</value>
- <value>destroy</value>
- </choice>
- </attribute>
- </define>
- <define name="type">
- <attribute name="type">
- <choice>
- <value>query</value>
- <value>reply</value>
- </choice>
- </attribute>
- </define>
- <define name="base64">
- <data type="base64Binary">
- <param name="maxLength">512000</param>
- </data>
- </define>
- <define name="peer_ta">
- <element name="peer_ta">
- <ref name="base64"/>
- </element>
- </define>
- <define name="sql_id">
- <data type="token">
- <param name="maxLength">1024</param>
- </data>
- </define>
+ <!--
+ Combinations of action and type attributes used in later definitions.
+ The same patterns repeat in most of the elements in this protocol.
+ -->
<define name="ctl_cq">
<attribute name="action">
<value>create</value>
@@ -143,6 +114,25 @@
<value>reply</value>
</attribute>
</define>
+ <!-- Base64 encoded DER stuff -->
+ <define name="base64">
+ <data type="base64Binary">
+ <param name="maxLength">512000</param>
+ </data>
+ </define>
+ <!-- How we wrap peer_ta fields (separate element or inline?) -->
+ <define name="peer_ta">
+ <element name="peer_ta">
+ <ref name="base64"/>
+ </element>
+ </define>
+ <!-- Base definition for all fields that are really just SQL primary indices -->
+ <define name="sql_id">
+ <data type="token">
+ <param name="maxLength">1024</param>
+ </data>
+ </define>
+ <!-- <self/> element -->
<define name="self_bool">
<optional>
<attribute name="rekey">
@@ -253,6 +243,7 @@
<ref name="self_id"/>
</element>
</define>
+ <!-- <bsc/> element -->
<define name="bsc_bool">
<optional>
<attribute name="generate_keypair">
@@ -381,6 +372,7 @@
<ref name="bsc_id"/>
</element>
</define>
+ <!-- <parent/> element -->
<define name="parent_id">
<attribute name="parent_id">
<ref name="sql_id"/>
@@ -510,6 +502,7 @@
<ref name="parent_id"/>
</element>
</define>
+ <!-- <child/> element -->
<define name="child_id">
<attribute name="child_id">
<ref name="sql_id"/>
@@ -615,6 +608,7 @@
<ref name="child_id"/>
</element>
</define>
+ <!-- <repository/> element -->
<define name="repository_id">
<attribute name="repository_id">
<ref name="sql_id"/>
@@ -711,19 +705,20 @@
<ref name="repository_id"/>
</element>
</define>
- <define name="route_origin_id">
+ <!-- <route_origin/> element -->
+ <define name="ro_id">
<attribute name="route_origin_id">
<ref name="sql_id"/>
</attribute>
</define>
- <define name="route_origin_bool">
+ <define name="ro_bool">
<optional>
<attribute name="suppress_publication">
<value>yes</value>
</attribute>
</optional>
</define>
- <define name="route_origin_payload">
+ <define name="ro_payload">
<optional>
<attribute name="asn">
<data type="token">
@@ -746,153 +741,166 @@
</attribute>
</optional>
</define>
- <!-- route_origin_elt = element route_origin { action, type, self_id, route_origin_id?, route_origin_bool, route_origin_payload } -->
- <define name="route_origin_elt" combine="choice">
+ <define name="ro_elt" combine="choice">
<element name="route_origin">
<ref name="ctl_cq"/>
<ref name="self_id"/>
- <ref name="route_origin_bool"/>
- <ref name="route_origin_payload"/>
+ <ref name="ro_bool"/>
+ <ref name="ro_payload"/>
</element>
</define>
- <define name="route_origin_elt" combine="choice">
+ <define name="ro_elt" combine="choice">
<element name="route_origin">
<ref name="ctl_cr"/>
<ref name="self_id"/>
- <ref name="route_origin_id"/>
+ <ref name="ro_id"/>
</element>
</define>
- <define name="route_origin_elt" combine="choice">
+ <define name="ro_elt" combine="choice">
<element name="route_origin">
<ref name="ctl_sq"/>
<ref name="self_id"/>
- <ref name="route_origin_id"/>
- <ref name="route_origin_bool"/>
- <ref name="route_origin_payload"/>
+ <ref name="ro_id"/>
+ <ref name="ro_bool"/>
+ <ref name="ro_payload"/>
</element>
</define>
- <define name="route_origin_elt" combine="choice">
+ <define name="ro_elt" combine="choice">
<element name="route_origin">
<ref name="ctl_sr"/>
<ref name="self_id"/>
- <ref name="route_origin_id"/>
+ <ref name="ro_id"/>
</element>
</define>
- <define name="route_origin_elt" combine="choice">
+ <define name="ro_elt" combine="choice">
<element name="route_origin">
<ref name="ctl_gq"/>
<ref name="self_id"/>
- <ref name="route_origin_id"/>
+ <ref name="ro_id"/>
</element>
</define>
- <define name="route_origin_elt" combine="choice">
+ <define name="ro_elt" combine="choice">
<element name="route_origin">
<ref name="ctl_gr"/>
<ref name="self_id"/>
- <ref name="route_origin_id"/>
- <ref name="route_origin_payload"/>
+ <ref name="ro_id"/>
+ <ref name="ro_payload"/>
</element>
</define>
- <define name="route_origin_elt" combine="choice">
+ <define name="ro_elt" combine="choice">
<element name="route_origin">
<ref name="ctl_lq"/>
<ref name="self_id"/>
</element>
</define>
- <define name="route_origin_elt" combine="choice">
+ <define name="ro_elt" combine="choice">
<element name="route_origin">
<ref name="ctl_lr"/>
<ref name="self_id"/>
- <ref name="route_origin_id"/>
- <ref name="route_origin_payload"/>
+ <ref name="ro_id"/>
+ <ref name="ro_payload"/>
</element>
</define>
- <define name="route_origin_elt" combine="choice">
+ <define name="ro_elt" combine="choice">
<element name="route_origin">
<ref name="ctl_dq"/>
<ref name="self_id"/>
- <ref name="route_origin_id"/>
+ <ref name="ro_id"/>
</element>
</define>
- <define name="route_origin_elt" combine="choice">
+ <define name="ro_elt" combine="choice">
<element name="route_origin">
<ref name="ctl_dr"/>
<ref name="self_id"/>
- <ref name="route_origin_id"/>
+ <ref name="ro_id"/>
</element>
</define>
- <define name="list_resources_payload">
- <optional>
- <attribute name="valid_until">
- <data type="token">
- <param name="maxLength">1024</param>
- </data>
- </attribute>
- </optional>
- <zeroOrMore>
- <element name="resource_class">
- <optional>
- <attribute name="subject_name">
- <data type="token">
- <param name="maxLength">1024</param>
- </data>
- </attribute>
- </optional>
- <optional>
- <attribute name="as">
- <data type="token">
- <param name="maxLength">1024</param>
- </data>
- </attribute>
- </optional>
- <optional>
- <attribute name="ipv4">
- <data type="token">
- <param name="maxLength">1024</param>
- </data>
- </attribute>
- </optional>
- <optional>
- <attribute name="ipv6">
- <data type="token">
- <param name="maxLength">1024</param>
- </data>
- </attribute>
- </optional>
- <optional>
- <attribute name="req_as">
- <data type="token">
- <param name="maxLength">1024</param>
- </data>
- </attribute>
- </optional>
- <optional>
- <attribute name="req_ipv4">
- <data type="token">
- <param name="maxLength">1024</param>
- </data>
- </attribute>
- </optional>
- <optional>
- <attribute name="req_ipv6">
- <data type="token">
- <param name="maxLength">1024</param>
- </data>
- </attribute>
- </optional>
- </element>
- </zeroOrMore>
- </define>
+ <!-- <list_resources/> element -->
<define name="list_resources_elt">
<element name="list_resources">
- <ref name="type"/>
- <ref name="self_id"/>
- <optional>
- <ref name="child_id"/>
- </optional>
- <ref name="list_resources_payload"/>
+ <choice>
+ <group>
+ <attribute name="type">
+ <value>query</value>
+ </attribute>
+ <ref name="self_id"/>
+ <optional>
+ <ref name="child_id"/>
+ </optional>
+ </group>
+ <group>
+ <attribute name="type">
+ <value>reply</value>
+ </attribute>
+ <ref name="self_id"/>
+ <optional>
+ <ref name="child_id"/>
+ </optional>
+ <optional>
+ <attribute name="valid_until">
+ <data type="token">
+ <param name="maxLength">1024</param>
+ </data>
+ </attribute>
+ </optional>
+ <zeroOrMore>
+ <element name="resource_class">
+ <optional>
+ <attribute name="subject_name">
+ <data type="token">
+ <param name="maxLength">1024</param>
+ </data>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="as">
+ <data type="token">
+ <param name="maxLength">1024</param>
+ </data>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="ipv4">
+ <data type="token">
+ <param name="maxLength">1024</param>
+ </data>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="ipv6">
+ <data type="token">
+ <param name="maxLength">1024</param>
+ </data>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="req_as">
+ <data type="token">
+ <param name="maxLength">1024</param>
+ </data>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="req_ipv4">
+ <data type="token">
+ <param name="maxLength">1024</param>
+ </data>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="req_ipv6">
+ <data type="token">
+ <param name="maxLength">1024</param>
+ </data>
+ </attribute>
+ </optional>
+ </element>
+ </zeroOrMore>
+ </group>
+ </choice>
</element>
</define>
+ <!-- <report_error/> element -->
<define name="report_error_elt">
<element name="report_error">
<ref name="self_id"/>