You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
2.8 KiB

4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. // This file is under GNU General Public License 3.0
  2. // see LICENSE.txt
  3. // generated files of this template are under BSD License 2.0
  4. // generate message functions
  5. // Copyleft (c) 2017-2020, p≡p foundation
  6. // Written by Volker Birk
  7. include yslt.yml2
  8. tstylesheet {
  9. include standardlib.ysl2
  10. include ./functions.ysl2
  11. function "pEp_imports"
  12. | IMPORTS Version, Identity, IdentityList, TID, Hash, Rating FROM PEP
  13. function "header"
  14. ||
  15. -- This file is under BSD License 2.0
  16. -- «@name» protocol for p≡p
  17. -- Copyleft 2016-2020 by p≡p foundation
  18. -- Written by Volker Birk
  19. ||
  20. template "/" {
  21. apply "protocol", 0, mode=overview;
  22. apply "protocol/fsm", 0, mode=individual;
  23. }
  24. template "protocol", mode=overview
  25. document "generated/{yml:lcase(@name)}.asn1", "text" {
  26. call "header";
  27. ||
  28. «yml:ucase(@name)»
  29. { iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) pEp(47878) «yml:lcase(@name)»(«@id») }
  30. DEFINITIONS AUTOMATIC TAGS EXTENSIBILITY IMPLIED ::=
  31. BEGIN
  32. IMPORTS
  33. `` for "fsm" |> «@name» FROM «yml:ucase(@name)»
  34. ;
  35. «@name» ::= CHOICE {
  36. «yml:lcase(fsm[1]/@name)» [APPLICATION «fsm[1]/@id»] «fsm[1]/@name»`if "count(fsm)>1" > ,`
  37. `` if "count(fsm)>1" |> ...,
  38. `` for "fsm[position()>1]" |> «yml:lcase(@name)» [APPLICATION «@id»] «@name»`if "position()!=last()" > ,`
  39. }
  40. END
  41. ||
  42. }
  43. template "fsm", mode=individual
  44. document "generated/{yml:lcase(@name)}.asn1", "text" {
  45. call "header";
  46. ||
  47. «yml:ucase(@name)»
  48. { iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) pEp(47878) «yml:lcase(../@name)»(«../@id») «yml:lcase(@name)»(«@id») }
  49. DEFINITIONS AUTOMATIC TAGS EXTENSIBILITY IMPLIED ::=
  50. BEGIN
  51. EXPORTS «@name»;
  52. `` call "pEp_imports"
  53. `` apply "message/embed", mode=import
  54. ;
  55. `` apply "message//list|message", 0, mode=impl;
  56. «@name» ::= CHOICE {
  57. `` for "message" |> «yml:mixedCase(@name)» [APPLICATION «@id»] «@name»`if "position()!=last()" > ,`
  58. }
  59. END
  60. ||
  61. }
  62. template "message", mode=impl
  63. ||
  64. «@name» ::= SEQUENCE {
  65. `` apply "field|auto|list|embed", mode=direct
  66. }
  67. ||
  68. template "list", mode=impl
  69. ||
  70. «@type» ::= SEQUENCE {
  71. `` apply "field|auto|list", mode=direct
  72. }
  73. ||
  74. template "field|auto|embed", mode=direct
  75. | «func:asn1name()» «func:asn1type()»`if "position()!=last()" > ,`
  76. template "list", mode=direct
  77. | «func:asn1name()» SEQUENCE OF «func:asn1type()»`if "position()!=last()" > ,`
  78. template "embed", mode=import
  79. | «@type» FROM «yml:ucase(@protocol)»
  80. }