nicinfo 1.3.0.pre.alpha1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/nicinfo/ip.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2011,2012,2013,2014 American Registry for Internet Numbers
1
+ # Copyright (C) 2011-2017 American Registry for Internet Numbers
2
2
  #
3
3
  # Permission to use, copy, modify, and/or distribute this software for any
4
4
  # purpose with or without fee is hereby granted, provided that the above
@@ -25,7 +25,7 @@ require 'nicinfo/cidrs'
25
25
  module NicInfo
26
26
 
27
27
  def NicInfo.display_ip json_data, config, data_tree
28
- ip = Ip.new( config ).process( json_data )
28
+ ip = config.factory.new_ip.process( json_data )
29
29
  NicInfo::display_object_with_entities( ip, config, data_tree )
30
30
  end
31
31
 
@@ -50,10 +50,18 @@ module NicInfo
50
50
  def display
51
51
  @config.logger.start_data_item
52
52
  @config.logger.data_title "[ IP NETWORK ]"
53
- @config.logger.terse "Handle", NicInfo::get_handle( @objectclass )
54
- @config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass )
55
- @config.logger.terse "Start Address", NicInfo.get_startAddress( @objectclass )
56
- @config.logger.terse "End Address", NicInfo.get_endAddress( @objectclass )
53
+ @config.logger.terse "Handle", NicInfo::get_handle( @objectclass ), NicInfo::AttentionType::SUCCESS
54
+ @config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass, "ip network", @config )
55
+ start_addr = NicInfo.get_startAddress( @objectclass )
56
+ if start_addr.include?( '/' )
57
+ @config.conf_msgs << "start IP #{start_addr} is not an IP address (possibly a CIDR)"
58
+ end
59
+ @config.logger.terse "Start Address", start_addr , NicInfo::AttentionType::SUCCESS
60
+ end_addr = NicInfo.get_endAddress( @objectclass )
61
+ if end_addr.include?( '/' )
62
+ @config.conf_msgs << "end IP #{end_addr} is not an IP address (possibly a CIDR)"
63
+ end
64
+ @config.logger.terse "End Address", end_addr, NicInfo::AttentionType::SUCCESS
57
65
  @config.logger.terse "CIDRs", get_CIDRs
58
66
  @config.logger.datum "IP Version", @objectclass[ "ipVersion" ]
59
67
  @config.logger.extra "Name", NicInfo.get_name( @objectclass )
@@ -0,0 +1,807 @@
1
+ ; all_parts rdap_all.jcr
2
+ ;
3
+ ; JSON Content Rules (JCR) ruleset
4
+ ; for the Registry Data Access Protocol (RDAP)
5
+ ;
6
+ ; Specified in RFC 7483
7
+ ;
8
+
9
+ # ruleset-id rdap_level_0
10
+
11
+ ;
12
+ ; The various types of responses
13
+ ;
14
+
15
+ ; start_part rdap_roots.jcr
16
+ @{root} $entity_response = {
17
+ $response_mixin,
18
+ $entity_mixin
19
+ }
20
+
21
+ @{root} $nameserver_response = {
22
+ $response_mixin,
23
+ $nameserver_mixin
24
+ }
25
+
26
+ @{root} $domain_response = {
27
+ $response_mixin,
28
+ $domain_mixin
29
+ }
30
+
31
+ @{root} $network_response = {
32
+ $response_mixin,
33
+ $network_mixin
34
+ }
35
+
36
+ @{root} $autnum_response = {
37
+ $response_mixin,
38
+ $autnum_mixin
39
+ }
40
+
41
+ @{root} $error_response = {
42
+ $response_mixin,
43
+ $error_mixin
44
+ }
45
+
46
+ @{root} $help_response = {
47
+ $response_mixin,
48
+ $lang ?
49
+ }
50
+
51
+ @{root} $domainSearch_response = {
52
+ $response_mixin,
53
+ $lang ?,
54
+ $domainSearchResult
55
+ }
56
+
57
+ @{root} $nameserverSearch_response = {
58
+ $response_mixin,
59
+ $lang ?,
60
+ $nameserverSearchResult
61
+ }
62
+
63
+ @{root} $entitySearch_response = {
64
+ $response_mixin,
65
+ $lang ?,
66
+ $entitySearchResult
67
+ }
68
+ ; end_part
69
+
70
+ ; start_part rdap_response_mixin.jcr
71
+ $response_mixin = (
72
+ $rdapConformance ?,
73
+ "notices" : $notices ?
74
+ )
75
+ ; end_part
76
+
77
+ ;
78
+ ; RFC 7483 Section 4.1 - RDAP Conformance
79
+ ;
80
+
81
+ ; start_part rdap_conformance.jcr
82
+ $rdapConformance = "rdapConformance" : [ string * ]
83
+ ; end_part
84
+
85
+ ;
86
+ ; RFC 7483 Section 4.2 - Links
87
+ ;
88
+
89
+ ; start_part rdap_links.jcr
90
+ $links = ( "links" : [ $link * ] )
91
+
92
+ ; see RFC 5988
93
+ $link = {
94
+ "value" : uri ?,
95
+ "rel" : string ?,
96
+ "href" : uri,
97
+ "hreflang" : [ $lang_value * ] ?,
98
+ "title" : string ?,
99
+ "media" : string ?,
100
+ "type" :
101
+ /[a-zA-Z][a-zA-Z0-9]*\/[a-zA-Z][a-zA-Z0-9]*/ ?
102
+ }
103
+ ; end_part
104
+
105
+ ;
106
+ ; RFC 7483 Section 4.3 - Notices
107
+ ;
108
+
109
+ ; start_part rdap_notices.jcr
110
+ $notices = [ $notice * ]
111
+
112
+ $notice = {
113
+ "title" : string ?,
114
+ "description" : [ string * ],
115
+ $noticeRemarkType ?,
116
+ $links ?,
117
+ $lang ?
118
+ }
119
+
120
+ $noticeRemarkType = "type" : string
121
+ ; end_part
122
+
123
+ ;
124
+ ; RFC 7483 Section 4.4 - Language Identifier
125
+ ;
126
+
127
+ ; start_part rdap_language.jcr
128
+ ; the language value as defined in RFC 5646
129
+ $lang_value =: /[a-z]{2}(\-[A-Z][a-zA-Z]*(\-[A-Z]{2})?)?/
130
+
131
+ $lang = ( "lang" : $lang_value )
132
+ ; end_part
133
+
134
+ ;
135
+ ; RFC 7483 Section 4.5 - Events
136
+ ;
137
+
138
+ ; start_part rdap_events.jcr
139
+ $events = "events" : [ $event * ]
140
+
141
+ $noActorEvent_mixin = (
142
+ $eventAction,
143
+ "eventDate" : datetime,
144
+ $links ?,
145
+ $lang ?
146
+ )
147
+
148
+ $eventAction = "eventAction" : string
149
+
150
+ $noActorEvent = {
151
+ $noActorEvent_mixin
152
+ }
153
+
154
+ $event = {
155
+ $noActorEvent_mixin,
156
+ "eventActor" : string ?
157
+ }
158
+
159
+ ; end_part
160
+
161
+ ;
162
+ ; RFC 7483 Section 4.6 - Status
163
+ ;
164
+
165
+ ; start_part rdap_status.jcr
166
+ $status = "status" : [ string * ]
167
+ ; end_part
168
+
169
+ ;
170
+ ; RFC 7483 Section 4.7 - Port43
171
+ ;
172
+
173
+ ; start_part rdap_port.jcr
174
+ $port43 = "port43" : string
175
+ ; end_part
176
+
177
+ ;
178
+ ; RFC 7482 Section 4.8 - Public Ids
179
+ ;
180
+
181
+ ; start_part rdap_publicids.jcr
182
+ $publicIds = "publicIds" : [ $publicId * ]
183
+
184
+ $publicId = {
185
+ "type" : string,
186
+ "identifier" : string
187
+ }
188
+ ; end_part
189
+
190
+ ;
191
+ ; Common Object Class Structures
192
+ ;
193
+
194
+ ; start_part rdap_common_mixin.jcr
195
+ $common_mixin = (
196
+ "handle" : string ?,
197
+ "remarks" : [ $notice * ] ?,
198
+ $links ?,
199
+ $events ?,
200
+ $status ?,
201
+ $port43 ?,
202
+ $lang ?
203
+ )
204
+ ; end_part
205
+
206
+ ;
207
+ ; RFC 7483 Section 5.1 - Entity Object Class
208
+ ;
209
+
210
+ ; start_part rdap_entity.jcr
211
+ $entities = "entities" : [ $entity_oc * ]
212
+
213
+ $entity_oc = {
214
+ $entity_mixin
215
+ }
216
+
217
+ $entity_mixin = (
218
+ "objectClassName" : "entity",
219
+ $common_mixin,
220
+ "vcardArray" : [ "vcard", $vcard * ] ?,
221
+ "asEventActor" : [ $noActorEvent * ] ?,
222
+ $roles ?,
223
+ $publicIds ?,
224
+ $entities ?,
225
+ "networks" : [ $network_oc * ] ?,
226
+ "autnums" : [ $autnum_oc * ] ?
227
+ )
228
+
229
+ $roles = "roles" : [ string * ]
230
+ ; end_part
231
+
232
+ ; jCard (see RFC 7095) is an algorithm for converting
233
+ ; vCard to JSON. Each jCard is represented by an array of
234
+ ; vCard properties. The "version" property must be the
235
+ ; first property, and there must be one and only one "fn"
236
+ ; property in some part of the array.
237
+ ;
238
+ ; Here we represent this by an ordered array, with "version"
239
+ ; being the first property, then listing all the properties
240
+ ; that match by property name, then matching
241
+ ; the "fn" property, then matching any other property again.
242
+ ; start_part rdap_vcard_array.jcr
243
+ $vcard = [
244
+ [ "version", {}, "text", "4.0" ],
245
+ $vcard_not_fn_properties * ,
246
+ [ "fn", { $vcard_type_param?, $vcard_language_param? ,
247
+ $vcard_altid_param? , $vcard_pid_param? ,
248
+ $vcard_pref_param?, $vcard_any_param? },
249
+ "text", string ],
250
+ $vcard_not_fn_properties *
251
+ ]
252
+
253
+ $vcard_not_fn_properties =
254
+ (
255
+ $vcard_source |
256
+ $vcard_kind |
257
+ $vcard_n |
258
+ $vcard_nicname |
259
+ $vcard_photo |
260
+ $vcard_bday |
261
+ $vcard_anniversary |
262
+ $vcard_gender |
263
+ $vcard_adr |
264
+ $vcard_tel |
265
+ $vcard_email |
266
+ $vcard_impp |
267
+ $vcard_lang |
268
+ $vcard_tz |
269
+ $vcard_geo |
270
+ $vcard_title |
271
+ $vcard_role |
272
+ $vcard_logo |
273
+ $vcard_org |
274
+ $vcard_member |
275
+ $vcard_related |
276
+ $vcard_categories |
277
+ $vcard_note |
278
+ $vcard_prodid |
279
+ $vcard_rev |
280
+ $vcard_sound |
281
+ $vcard_uid |
282
+ $vcard_clientpidmap |
283
+ $vcard_url |
284
+ $vcard_key |
285
+ $vcard_fburl |
286
+ $vcard_caladruri |
287
+ $vcard_caluri |
288
+ $vcard_x10
289
+ )
290
+ ; end_part
291
+
292
+ ; vCard properties. Each one is defined with a common
293
+ ; definition, and then a group that matches the property name.
294
+ ; start_part rdap_vcard_properties.jcr
295
+ $vcard_source = [ "source", $vcard_source_prop ]
296
+ $vcard_source_prop = (
297
+ { $vcard_pid_param? , $vcard_pref_param?, $vcard_altid_param? ,
298
+ $vcard_mediatype_param?, $vcard_any_param? } ,
299
+ "uri", uri
300
+ )
301
+
302
+ $vcard_kind = [ "kind", $vcard_kind_prop ]
303
+ $vcard_kind_prop = (
304
+ { $vcard_any_param? },
305
+ "text", $vcard_kind_type
306
+ )
307
+
308
+ $vcard_n = [ "n", $vcard_n_prop ]
309
+ $vcard_n_prop = (
310
+ { $vcard_sort_as_param? , $vcard_language_param? ,
311
+ $vcard_altid_param? , $vcard_any_param? },
312
+ "text", $vcard_string_type_array
313
+ )
314
+
315
+ $vcard_nicname = [ "nicname", $vcard_nicname_prop ]
316
+ $vcard_nicname_prop = (
317
+ { $vcard_type_param? , $vcard_language_param? ,
318
+ $vcard_altid_param? , $vcard_pid_param? ,
319
+ $vcard_pref_param? , $vcard_any_param ? },
320
+ "text", $vcard_string_type_array
321
+ )
322
+
323
+ $vcard_photo = [ "photo", $vcard_photo_prop ]
324
+ $vcard_photo_prop = (
325
+ { $vcard_altid_param? , $vcard_type_param? ,
326
+ $vcard_mediatype_param? , $vcard_pref_param? ,
327
+ $vcard_pid_param? , $vcard_any_param? },
328
+ "uri", uri
329
+ )
330
+
331
+ $vcard_bday = [ "bday", $vcard_bday_prop ]
332
+ $vcard_bday_prop = (
333
+ ( { $vcard_language_param?, $vcard_altid_param?,
334
+ $vcard_calscale_param?, $vcard_any_param? },
335
+ "text", string
336
+ ) |
337
+ ( { $vcard_altid_param?, $vcard_calscale_param?,
338
+ $vcard_any_param? },
339
+ "date-and-or-time", $vcard_date_and_or_time_type
340
+ )
341
+ )
342
+
343
+ $vcard_anniversary = [ "anniversary", $vcard_anniversary_prop ]
344
+ $vcard_anniversary_prop = (
345
+ { $vcard_altid_param?, $vcard_calscale_param?, $vcard_any_param? },
346
+ "date-and-or-time", $vcard_date_and_or_time_type
347
+ )
348
+
349
+ $vcard_gender = [ "gender", $vcard_gender_prop ]
350
+ $vcard_gender_prop = (
351
+ { $vcard_any_param? },
352
+ "text",
353
+ ( $vcard_gender_type | [ $vcard_gender_type, string + ] )
354
+ )
355
+
356
+ $vcard_adr = [ "adr", $vcard_adr_prop ]
357
+ $vcard_adr_prop = (
358
+ { $vcard_label_param? , $vcard_language_param? ,
359
+ $vcard_geo_param ? , $vcard_tz_param? ,
360
+ $vcard_altid_param? , $vcard_pid_param? ,
361
+ $vcard_pref_param? , $vcard_type_param? ,
362
+ $vcard_any_param? },
363
+ "text", $vcard_string_type_array
364
+ )
365
+
366
+ $vcard_tel = [ "tel", $vcard_tel_prop ]
367
+ $vcard_tel_prop = (
368
+ ( { $vcard_type_param? , $vcard_pid_param? , $vcard_pref_param? ,
369
+ $vcard_altid_param?, $vcard_any_param? }, "text", string
370
+ ) |
371
+ ( { $vcard_type_param? , $vcard_pid_param? , $vcard_pref_param? ,
372
+ $vcard_altid_param?, $vcard_mediatype_param?,
373
+ $vcard_any_param? },
374
+ "uri", uri..tel
375
+ )
376
+ )
377
+
378
+ $vcard_email = [ "email", $vcard_email_prop ]
379
+ $vcard_email_prop = (
380
+ { $vcard_pid_param? , $vcard_pref_param? , $vcard_type_param? ,
381
+ $vcard_altid_param? , $vcard_any_param ? },
382
+ "text", string
383
+ )
384
+
385
+ $vcard_impp = [ "impp", $vcard_impp_prop ]
386
+ $vcard_impp_prop = (
387
+ { $vcard_pid_param? , $vcard_pref_param? , $vcard_type_param? ,
388
+ $vcard_mediatype_param? , $vcard_altid_param? ,
389
+ $vcard_any_param },
390
+ "uri", uri..impp
391
+ )
392
+
393
+ $vcard_lang = [ "lang", $vcard_lang_prop ]
394
+ $vcard_lang_prop = (
395
+ { $vcard_pid_param? , $vcard_pref_param? , $vcard_altid_param? ,
396
+ $vcard_type_param? , $vcard_any_param? },
397
+ "language-tag", $vcard_language_tag_type
398
+ )
399
+
400
+ $vcard_tz = [ "tz", $vcard_tz_prop ]
401
+ $vcard_tz_prop = (
402
+ { $vcard_altid_param?, $vcard_pid_param? , $vcard_pref_param? ,
403
+ $vcard_type_param? , $vcard_mediatype_param?,
404
+ $vcard_any_param? },
405
+ ( ( "text", string ) |
406
+ ( "uri" , uri ) |
407
+ ( "utc-offset" , $vcard_utc_offset_type ) )
408
+ )
409
+
410
+ $vcard_geo = [ "geo", $vcard_geo_prop ]
411
+ $vcard_geo_prop = (
412
+ { $vcard_pid_param? , $vcard_pref_param? , $vcard_type_param? ,
413
+ $vcard_mediatype_param? , $vcard_altid_param? ,
414
+ $vcard_any_param? },
415
+ "uri", uri..geo
416
+ )
417
+
418
+ $vcard_title = [ "title", $vcard_title_prop ]
419
+ $vcard_title_prop = (
420
+ { $vcard_language_param? , $vcard_pid_param? , $vcard_pref_param? ,
421
+ $vcard_altid_param? , $vcard_type_param? , $vcard_any_param? },
422
+ "text", string
423
+ )
424
+
425
+ $vcard_role = [ "role", $vcard_role_prop ]
426
+ $vcard_role_prop = (
427
+ { $vcard_language_param? , $vcard_pid_param? , $vcard_pref_param? ,
428
+ $vcard_altid_param? , $vcard_type_param? , $vcard_any_param? },
429
+ "text", string
430
+ )
431
+
432
+ $vcard_logo = [ "logo", $vcard_logo_prop ]
433
+ $vcard_logo_prop = (
434
+ { $vcard_altid_param? , $vcard_type_param? ,
435
+ $vcard_mediatype_param? , $vcard_pref_param? ,
436
+ $vcard_pid_param? , $vcard_language_param? ,
437
+ $vcard_any_param? },
438
+ "uri", uri
439
+ )
440
+
441
+ $vcard_org = [ "org", $vcard_org_prop ]
442
+ $vcard_org_prop = (
443
+ { $vcard_sort_as_param? , $vcard_language_param? ,
444
+ $vcard_pid_param? , $vcard_pref_param? , $vcard_altid_param? ,
445
+ $vcard_type_param? , $vcard_any_param? },
446
+ "text", $vcard_string_type_array
447
+ )
448
+
449
+ $vcard_member = [ "member", $vcard_member_prop ]
450
+ $vcard_member_prop = (
451
+ { $vcard_altid_param? , $vcard_mediatype_param? ,
452
+ $vcard_pref_param? , $vcard_pid_param? , $vcard_any_param? },
453
+ "uri", uri
454
+ )
455
+
456
+ $vcard_related = [ "related", $vcard_related_prop ]
457
+ $vcard_related_prop = (
458
+ ( { $vcard_mediatype_param? , $vcard_pref_param? ,
459
+ $vcard_altid_param? , $vcard_type_param? ,
460
+ $vcard_any_param? },
461
+ "uri", uri
462
+ ) |
463
+ ( { $vcard_language_param? , $vcard_pref_param? ,
464
+ $vcard_altid_param? , $vcard_type_param? ,
465
+ $vcard_any_param? },
466
+ "text", $vcard_related_type_array
467
+ )
468
+ )
469
+
470
+ $vcard_categories = [ "categories", $vcard_categories_prop ]
471
+ $vcard_categories_prop = (
472
+ { $vcard_pid_param? , $vcard_pref_param? , $vcard_type_param ?,
473
+ $vcard_altid_param? , $vcard_any_param? },
474
+ "text", $vcard_string_type_array
475
+ )
476
+
477
+ $vcard_note = [ "note", $vcard_note_prop ]
478
+ $vcard_note_prop = (
479
+ { $vcard_language_param? , $vcard_pid_param? ,
480
+ $vcard_pref_param? , $vcard_type_param? ,
481
+ $vcard_altid_param? , $vcard_any_param ? },
482
+ "text", string
483
+ )
484
+
485
+ $vcard_prodid = [ "prodid", $vcard_prodid_prop ]
486
+ $vcard_prodid_prop = ( { $vcard_any_param ? }, "text", string )
487
+
488
+ $vcard_rev = [ "rev", $vcard_rev_prop ]
489
+ $vcard_rev_prop = (
490
+ { $vcard_any_param ? }, "timestamp", datetime
491
+ )
492
+
493
+ $vcard_sound = [ "sound", $vcard_sound_prop ]
494
+ $vcard_sound_prop = (
495
+ { $vcard_altid_param? , $vcard_mediatype_param? ,
496
+ $vcard_language_param? , $vcard_pref_param? ,
497
+ $vcard_pid_param? , $vcard_any_param? },
498
+ "uri", uri
499
+ )
500
+
501
+ $vcard_uid = [ "uid", $vcard_uid_prop ]
502
+ $vcard_uid_prop = (
503
+ ( { $vcard_any_param? }, "uri", uri ) |
504
+ ( { $vcard_any_param? }, "text", string )
505
+ )
506
+
507
+ $vcard_clientpidmap = [ "clientpidmap", $vcard_clientpidmap_prop ]
508
+ $vcard_clientpidmap_prop = ( {}, "text", [ /^[0-9]+$/, uri ] )
509
+
510
+ $vcard_url = [ "url", $vcard_url_prop ]
511
+ $vcard_url_prop = (
512
+ { $vcard_altid_param? , $vcard_mediatype_param? ,
513
+ $vcard_pref_param? , $vcard_pid_param? , $vcard_any_param? },
514
+ "uri", uri
515
+ )
516
+
517
+ $vcard_key = [ "key", $vcard_key_prop ]
518
+ $vcard_key_prop = (
519
+ ( { $vcard_mediatype_param? , $vcard_pref_param? ,
520
+ $vcard_altid_param? , $vcard_type_param? ,
521
+ $vcard_any_param? },
522
+ "uri", uri
523
+ ) |
524
+ ( { $vcard_pref_param? , $vcard_altid_param? ,
525
+ $vcard_type_param? , $vcard_any_param? },
526
+ "text", string
527
+ )
528
+ )
529
+
530
+ $vcard_fburl = [ "fburl", $vcard_fburl_prop ]
531
+ $vcard_fburl_prop = (
532
+ { $vcard_altid_param? , $vcard_mediatype_param? ,
533
+ $vcard_altid_param? , $vcard_pref_param? ,
534
+ $vcard_pid_param? , $vcard_any_param? },
535
+ "uri", uri
536
+ )
537
+
538
+ $vcard_caladruri = [ "caladruri", $vcard_caladruri_prop ]
539
+ $vcard_caladruri_prop = (
540
+ { $vcard_altid_param? , $vcard_mediatype_param? ,
541
+ $vcard_altid_param? , $vcard_pref_param? ,
542
+ $vcard_pid_param? , $vcard_any_param? },
543
+ "uri", uri
544
+ )
545
+
546
+ $vcard_caluri = [ "caluri", $vcard_caluri_prop ]
547
+ $vcard_caluri_prop = (
548
+ { $vcard_altid_param? , $vcard_mediatype_param? ,
549
+ $vcard_altid_param? , $vcard_pref_param? ,
550
+ $vcard_pid_param? , $vcard_any_param? },
551
+ "uri", uri
552
+ )
553
+
554
+ $vcard_x10 = [ $vcard_x_name_type, $vcard_x10_prop ]
555
+ $vcard_x10_prop = (
556
+ { $vcard_language_param? , $vcard_pref_param? ,
557
+ $vcard_altid_param? , $vcard_pid_param? ,
558
+ $vcard_type_param? , $vcard_mediatype_param? ,
559
+ $vcard_calscale_param? , $vcard_sort_as_param? ,
560
+ $vcard_geo_param? , $vcard_tz_param? ,
561
+ $vcard_label_param? , $vcard_any_param? },
562
+ $vcard_x_name_type, $vcard_string_type_array
563
+ )
564
+ ; end_part
565
+
566
+ ; Each vCard property can have parameters.
567
+ ; start_part rdap_vcard_params.jcr
568
+ $vcard_language_param = "language" : $vcard_language_tag_type
569
+ $vcard_pref_param = "pref" : $vcard_pref_type
570
+ $vcard_altid_param = "altid" : string
571
+ $vcard_pid_param = "pid" : $vcard_pid_type_array
572
+ $vcard_type_param = "type" : $vcard_type_type_array
573
+ $vcard_mediatype_param = "mediatype" : $vcard_mediatype_type
574
+ $vcard_calscale_param = "calscale" : $vcard_calscale_type
575
+ $vcard_sort_as_param = "sort-as" : $vcard_string_type_array
576
+ $vcard_geo_param = "geo" : uri..geo
577
+ $vcard_tz_param = "tz" : $vcard_utc_offset_type
578
+ $vcard_label_param = "label" : $vcard_string_type_array
579
+ $vcard_any_param = /^x\-[A-Za-z0-9\-]*$/ : $vcard_string_type_array
580
+ ; end_part
581
+
582
+ ; Each vCard property has a value type.
583
+ ; start_part rdap_vcard_values.jcr
584
+ $vcard_string_type_array =
585
+ ( string | [ ( string | [ string * ] ) * ] )
586
+ $vcard_language_tag_type =:
587
+ /[a-z]{2}(-[A-Z][a-zA-Z]*(\-[A-Z]{2})?)?/
588
+ $vcard_mediatype_type =: /^\w+\/[\-.\w]+(?:\+[\-.\w]+)?$/
589
+ $vcard_utc_offset_type =: /^(([\-\+]\d{1,2}):?(\d{2})?)?$/
590
+ $vcard_date_or_time =: (
591
+ /^(\d{4})-?(\d{2})-?(\d{2})$/ |
592
+ /^(\d{4})$/ |
593
+ /^--(\d{2})-?(\d{2})$/ |
594
+ /^--(\d{2})$/ |
595
+ /^---(\d{2})$/ |
596
+ /^(\d{2})(([-+]\d{1,2}):?(\d{2})?)?$/ |
597
+ /^(\d{2}):?(\d{2})(([\-\+]\d{1,2}):?(\d{2})?)?$/ |
598
+ /^(\d{2}):?(\d{2}):?(\d{2})(Z|([\-\+]\d{1,2}):?(\d{2})?)?$/ |
599
+ /^-(\d{2}):?(\d{2})(Z|([\-\+]\d{1,2}):?(\d{2})?)?$/ |
600
+ /^-(\d{2})(([\-\+]\d{1,2}):?(\d{2})?)?$/ |
601
+ /^--(\d{2})(([\-\+]\d{1,2}):?(\d{2})?)?$/
602
+ )
603
+ $vcard_date_and_or_time_type =: (
604
+ datetime | $vcard_date_or_time
605
+ )
606
+ $vcard_group_type =: /^[a-zA-Z0-9\-]+$/
607
+ $vcard_type_type =: (
608
+ "home" | "work" | $vcard_tel_type | $vcard_related_type |
609
+ $vcard_x_name_type
610
+ )
611
+ $vcard_type_type_array = (
612
+ $vcard_type_type | [ $vcard_type_type * ]
613
+ )
614
+ $vcard_tel_type =: (
615
+ "text" | "voice" | "fax" | "cell" | "video" |
616
+ "pager" | "textphone" | "main-number"
617
+ )
618
+ $vcard_tel_type_array = ( $vcard_tel_type | [ $vcard_tel_type * ] )
619
+ $vcard_related_type =: (
620
+ "contact" | "acquaintance" | "friend" | "met" |
621
+ "co-worker" | "colleague" | "co-resident" |
622
+ "neighbor" | "child" | "parent" | "sibling" |
623
+ "spouse" | "kin" | "muse" | "crush" | "date" |
624
+ "sweetheart" | "me" | "agent" | "emergency"
625
+ )
626
+ $vcard_related_type_array = (
627
+ $vcard_related_type | [ $vcard_related_type * ]
628
+ )
629
+ $vcard_index_type =: /^[1-9]?[0-9]*$/
630
+ $vcard_expertise_level_type =: (
631
+ "beginner" | "average" | "expert"
632
+ )
633
+ $vcard_hobby_type =: ( "high" | "medium" | "low" )
634
+ $vcard_pref_type =: /^[1-9]?[0-9]{1}$|^100$/
635
+ $vcard_pid_type =: /^[0-9]+(\.[0-9]+)?$/
636
+ $vcard_pid_type_array = (
637
+ $vcard_pid_type | [ $vcard_pid_type * ]
638
+ )
639
+ $vcard_gender_type =: ( "M" | "F" | "O" | "N" | "U" )
640
+ $vcard_gender_type_array = (
641
+ $vcard_gender_type | [ $vcard_gender_type * ]
642
+ )
643
+ $vcard_kind_type =: (
644
+ "individual" | "group" | "org" | "location" |
645
+ "application" | "device"
646
+ )
647
+ $vcard_iana_token_type =: /^[A-Za-z0-9\-]*$/
648
+ $vcard_x_name_type =: /^x\-[A-Za-z0-9\-]*$/
649
+ $vcard_calscale_type =: (
650
+ "gregorian" | $vcard_iana_token_type | $vcard_x_name_type
651
+ )
652
+ ; end_part
653
+
654
+ ;
655
+ ; RFC 7483 Section 5.2 - Nameserver Object Class
656
+ ;
657
+
658
+ ; start_part rdap_nameserver.jcr
659
+ $nameservers = "nameservers" : [ $nameserver_oc * ]
660
+
661
+ $nameserver_oc = {
662
+ $nameserver_mixin
663
+ }
664
+
665
+ $nameserver_mixin = (
666
+ "objectClassName" : "nameserver",
667
+ $common_mixin,
668
+ "ldhName" : fqdn,
669
+ "unicodeName" : idn ?,
670
+ "ipAddresses" : {
671
+ "v4" : [ ipv4 + ] ?,
672
+ "v6" : [ ipv6 + ] ?
673
+ } ?,
674
+ $entities ?
675
+ )
676
+ ; end_part
677
+
678
+ ;
679
+ ; RFC 7483 Section 5.3 - Domain Object Class
680
+ ;
681
+
682
+ ; start_part rdap_domain.jcr
683
+ $domain_oc = {
684
+ $domain_mixin
685
+ }
686
+
687
+ $domain_mixin = (
688
+ "objectClassName" : "domain",
689
+ $common_mixin,
690
+ "ldhName" : fqdn,
691
+ "unicodeName" : idn ?,
692
+ "variants" : [ $variant * ] ?,
693
+ $nameservers ?,
694
+ $secureDNS ?,
695
+ $entities ?,
696
+ $publicIds ?,
697
+ "network" : $network_oc ?
698
+ )
699
+
700
+ $variant = {
701
+ $variantRelation ?,
702
+ "relation" : [ string * ] ?,
703
+ "idnTable" : string ?,
704
+ "variantNames" : [
705
+ { "ldhName" : fqdn, "unicodeName" : idn } *
706
+ ]
707
+ }
708
+
709
+ $variantRelation = "relation" : [ string * ]
710
+
711
+ $secureDNS = "secureDNS" : {
712
+ "zoneSigned" : boolean ?,
713
+ "delegationSigned" : boolean ?,
714
+ "maxSigLife" : integer ?,
715
+ "dsData" : [ $dsData_obj * ] ?,
716
+ "keyData" : [ $keyData_obj * ] ?
717
+ }
718
+
719
+ $dsData_obj = {
720
+ "keyTag" : integer,
721
+ "algorithm" : integer,
722
+ "digest" : string,
723
+ "digestType" : integer,
724
+ $events ?,
725
+ $links ?
726
+ }
727
+
728
+ $keyData_obj = {
729
+ "flags" : integer,
730
+ "protocol" : integer,
731
+ "publicKey" : string,
732
+ "algorithm" : integer,
733
+ $events ?,
734
+ $links ?
735
+ }
736
+ ; end_part
737
+
738
+ ;
739
+ ; RFC 7483 Section 5.4 - IP Network Object Class
740
+ ;
741
+
742
+ ; start_part rdap_network.jcr
743
+ $network_oc = {
744
+ $network_mixin
745
+ }
746
+
747
+ $network_mixin = (
748
+ "objectClassName" : "ip network",
749
+ $common_mixin,
750
+ "startAddress" : ( ipv4 | ipv6 ) ?,
751
+ "endAddres" : ( ipv4 | ipv6 ) ?,
752
+ "ipVersion" : ( "v4" | "v6" ) ?,
753
+ "name" : string ?,
754
+ "type" : string ?,
755
+ "country" : /[A-Z]{2}/ ?,
756
+ "parentHandle" : string ?,
757
+ $entities ?
758
+ )
759
+ ; end_part
760
+
761
+ ;
762
+ ; RFC 7483 Section 5.5 - Autnum Object Class
763
+ ;
764
+
765
+ ; start_part rdap_autnum.jcr
766
+ $autnum_oc = {
767
+ $autnum_mixin
768
+ }
769
+
770
+ $autnum_mixin = (
771
+ "objectClassName" : "autnum",
772
+ $common_mixin,
773
+ "startAutnum" : int32 ?,
774
+ "endAutnum" : int32 ?,
775
+ "name" : string ?,
776
+ "type" : string ?,
777
+ "country" : string ?,
778
+ $entities ?
779
+ )
780
+ ; end_part
781
+
782
+ ;
783
+ ; RFC 7483 Section 6 - Error
784
+ ;
785
+
786
+ ; start_part rdap_error.jcr
787
+ $error_mixin = (
788
+ "errorCode" : integer,
789
+ "title" : string ?,
790
+ "description" : [ string * ] ?
791
+ )
792
+ ; end_part
793
+
794
+ ;
795
+ ; RFC 7483 Section 8 - Search Results
796
+ ;
797
+
798
+ ; start_part rdap_searches.jcr
799
+ $domainSearchResult =
800
+ "domainSearchResults" : [ $domain_oc + ]
801
+
802
+ $nameserverSearchResult =
803
+ "nameserverSearchResults" : [ $nameserver_oc + ]
804
+
805
+ $entitySearchResult =
806
+ "entitySearchResults" : [ $entity_oc + ]
807
+ ; end_part