aboutsummaryrefslogtreecommitdiff
path: root/scripts/left-right-schema.rnc
blob: 2c41da201e2d24b5d0742e26142a39518cfb42b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# $Id$
#
# RelaxNG (Compact Syntax) Schema for RPKI left-right protocol.
#
# libxml2 (including xmllint) only groks the XML syntax of RelaxNG, so
# run the compact syntax through trang to get XML syntax.

default namespace = "http://www.hactrn.net/uris/rpki/left-right-spec/"

start = element msg {
  attribute version { xsd:positiveInteger { maxInclusive="1" } },
  ( self_elt | bsc_elt | parent_elt | child_elt | repository_elt | route_origin_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" }

ctl_cq = attribute action { "create"  }, attribute type { "query" }
ctl_sq = attribute action { "set"     }, attribute type { "query" }
ctl_gq = attribute action { "get"     }, attribute type { "query" }
ctl_lq = attribute action { "list"    }, attribute type { "query" }
ctl_dq = attribute action { "destroy" }, attribute type { "query" }
ctl_cr = attribute action { "create"  }, attribute type { "reply" }
ctl_sr = attribute action { "set"     }, attribute type { "reply" }
ctl_gr = attribute action { "get"     }, attribute type { "reply" }
ctl_lr = attribute action { "list"    }, attribute type { "reply" }
ctl_dr = attribute action { "destroy" }, attribute type { "reply" }

self_bool = (attribute rekey { "yes" }?,
             attribute reissue { "yes" }?,
             attribute revoke { "yes" }?,
             attribute run_now { "yes" }?,
             attribute publish_world_now { "yes" }?)

self_payload = element extension_preference {
  attribute name { xsd:token { maxLength="1024" } },
  xsd:string { maxLength="512000" }
}*

self_id = attribute self_id { sql_id }

self_elt |= element self { ctl_cq, self_bool, self_payload }
self_elt |= element self { ctl_cr, self_id }
self_elt |= element self { ctl_sq, self_id, self_bool, self_payload }
self_elt |= element self { ctl_sr, self_id }
self_elt |= element self { ctl_gq, self_id }
self_elt |= element self { ctl_gr, self_id, self_payload }
self_elt |= element self { ctl_lq }
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_bool = (attribute generate_keypair { "yes" },
            attribute key_type { xsd:token { maxLength="1024" } }?,
            attribute hash_alg { xsd:token { maxLength="1024" } }?,
            attribute key_length { xsd:token { maxLength="1024" } }?)?

bsc_id = attribute bsc_id { sql_id }

bsc_payload = (element signing_cert { base64 }*,
               element public_key { base64 }?)

bsc_pkcs10 = element pkcs10_cert_request { base64 }?

bsc_elt |= element bsc { ctl_cq, self_id, bsc_bool, bsc_payload }
bsc_elt |= element bsc { ctl_cr, self_id, bsc_id, bsc_pkcs10 }
bsc_elt |= element bsc { ctl_sq, self_id, bsc_id, bsc_bool, bsc_payload }
bsc_elt |= element bsc { ctl_sr, self_id, bsc_id, bsc_pkcs10 }
bsc_elt |= element bsc { ctl_gq, self_id, bsc_id }
bsc_elt |= element bsc { ctl_gr, self_id, bsc_id, bsc_payload }
bsc_elt |= element bsc { ctl_lq, self_id }
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_id = attribute parent_id { sql_id }

parent_bool = (attribute rekey { "yes" }?,
               attribute reissue { "yes" }?,
               attribute revoke { "yes" }?)

parent_payload = (attribute peer_contact { xsd:anyURI { maxLength="1024" } }?,
                  attribute sia_base { xsd:anyURI { maxLength="1024" } }?,
                  attribute bsc_link { xsd:token { maxLength="1024" } }?,
                  attribute repository_link { xsd:token { maxLength="1024" } }?,
                  peer_ta?)

parent_elt |= element parent { ctl_cq, self_id, parent_bool, parent_payload }
parent_elt |= element parent { ctl_cr, self_id, parent_id }
parent_elt |= element parent { ctl_sq, self_id, parent_id, parent_bool, parent_payload }
parent_elt |= element parent { ctl_sr, self_id, parent_id }
parent_elt |= element parent { ctl_gq, self_id, parent_id }
parent_elt |= element parent { ctl_gr, self_id, parent_id, parent_payload }
parent_elt |= element parent { ctl_lq, self_id }
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_id = attribute child_id { sql_id }

child_bool = attribute reissue { "yes" }?

child_payload = (attribute bsc_link { xsd:token { maxLength="1024" } }?,
                 attribute child_db_id { xsd:token { maxLength="1024" } }?,
                 peer_ta?)

child_elt |= element child { ctl_cq, self_id, child_bool, child_payload }
child_elt |= element child { ctl_cr, self_id, child_id }
child_elt |= element child { ctl_sq, self_id, child_id, child_bool, child_payload }
child_elt |= element child { ctl_sr, self_id, child_id }
child_elt |= element child { ctl_gq, self_id, child_id }
child_elt |= element child { ctl_gr, self_id, child_id, child_payload }
child_elt |= element child { ctl_lq, self_id }
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_id = attribute repository_id { sql_id }

repository_payload = (attribute peer_contact { xsd:anyURI { maxLength="1024" } }?,
                      attribute bsc_link { xsd:token { maxLength="1024" } }?,
                      peer_ta?)

repository_elt |= element repository { ctl_cq, self_id, repository_payload }
repository_elt |= element repository { ctl_cr, self_id, repository_id }
repository_elt |= element repository { ctl_sq, self_id, repository_id, repository_payload }
repository_elt |= element repository { ctl_sr, self_id, repository_id }
repository_elt |= element repository { ctl_gq, self_id, repository_id }
repository_elt |= element repository { ctl_gr, self_id, repository_id, repository_payload }
repository_elt |= element repository { ctl_lq, self_id }
repository_elt |= element repository { ctl_lr, self_id, repository_id, repository_payload }
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" } }?
                          }*)

list_resources_elt = element list_resources {
  type, self_id, child_id?, list_resources_payload
}

report_error_elt = element report_error {
  self_id,
  attribute error_code { xsd:token { maxLength="1024" } },
  xsd:string { maxLength="512000" }?
}