sync/gen_messages.ysl2
author Volker Birk <vb@pep.foundation>
Thu, 09 Aug 2018 12:26:53 +0200
branchsync
changeset 2831 be6623599adb
child 2864 dcbed0d35466
permissions -rw-r--r--
...
vb@2831
     1
// This file is under GNU General Public License 3.0
vb@2831
     2
// see LICENSE.txt
vb@2831
     3
// generated files of this template are under BSD License 2.0
vb@2831
     4
vb@2831
     5
// generate message functions
vb@2831
     6
vb@2831
     7
// Copyleft (c) 2017, p≡p foundation
vb@2831
     8
vb@2831
     9
// Written by Volker Birk
vb@2831
    10
vb@2831
    11
include yslt.yml2
vb@2831
    12
vb@2831
    13
tstylesheet {
vb@2831
    14
    include standardlib.ysl2
vb@2831
    15
    include ./functions.ysl2
vb@2831
    16
vb@2831
    17
    function "pEp_imports"
vb@2831
    18
        | IMPORTS Identity, IdentityList, TID, Hash FROM PEP;
vb@2831
    19
vb@2831
    20
    template "/" {
vb@2831
    21
        apply "protocol", 0, mode=overview;
vb@2831
    22
        apply "protocol/fsm", 0, mode=individual;
vb@2831
    23
    }
vb@2831
    24
vb@2831
    25
    template "protocol", mode=overview
vb@2831
    26
        document "generated/{yml:lcase(@name)}.asn1", "text"
vb@2831
    27
    ||
vb@2831
    28
    -- This file is under BSD License 2.0
vb@2831
    29
vb@2831
    30
    -- «@name» protocol stack for p≡p
vb@2831
    31
    -- Copyright (c) 2016, 2017 p≡p foundation
vb@2831
    32
vb@2831
    33
    -- Written by Volker Birk
vb@2831
    34
vb@2831
    35
    «yml:ucase(@name)»
vb@2831
    36
        { iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) pEp(47878) «yml:lcase(@name)»(«@id») }
vb@2831
    37
vb@2831
    38
    DEFINITIONS AUTOMATIC TAGS EXTENSIBILITY IMPLIED ::=
vb@2831
    39
vb@2831
    40
    BEGIN
vb@2831
    41
vb@2831
    42
    `` for "fsm" | IMPORTS «@name» FROM «yml:ucase(@name)»;
vb@2831
    43
vb@2831
    44
    «@name» ::= CHOICE {
vb@2831
    45
        `` for "fsm" |> «yml:lcase(@name)» [APPLICATION «@id»] «@name»`if "position()!=last()" > , `
vb@2831
    46
    }
vb@2831
    47
vb@2831
    48
    END
vb@2831
    49
vb@2831
    50
    ||
vb@2831
    51
vb@2831
    52
    template "fsm", mode=individual
vb@2831
    53
        document "generated/{yml:lcase(@name)}.asn1", "text"
vb@2831
    54
    ||
vb@2831
    55
    -- This file is under BSD License 2.0
vb@2831
    56
vb@2831
    57
    -- «@name» protocol for p≡p version «version/@major».«version/@minor»
vb@2831
    58
    -- Copyright (c) 2016, 2017 p≡p foundation
vb@2831
    59
vb@2831
    60
    -- Written by Volker Birk
vb@2831
    61
vb@2831
    62
    «yml:ucase(@name)»
vb@2831
    63
        { iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) pEp(47878) «yml:lcase(../@name)»(«../@id») «yml:lcase(@name)»(«@id») }
vb@2831
    64
vb@2831
    65
    DEFINITIONS AUTOMATIC TAGS EXTENSIBILITY IMPLIED ::=
vb@2831
    66
vb@2831
    67
    BEGIN
vb@2831
    68
vb@2831
    69
    EXPORTS «@name»;
vb@2831
    70
    `` call "pEp_imports"
vb@2831
    71
vb@2831
    72
    Version ::= SEQUENCE {
vb@2831
    73
        major INTEGER (0..255) DEFAULT «version/@major»,
vb@2831
    74
        minor INTEGER (0..255) DEFAULT «version/@minor»
vb@2831
    75
    }
vb@2831
    76
vb@2831
    77
    `` apply "message", 0, mode=impl;
vb@2831
    78
    «@name» ::= SEQUENCE {
vb@2831
    79
        header SEQUENCE {
vb@2831
    80
            sequence INTEGER  -- always increases
vb@2831
    81
        },
vb@2831
    82
vb@2831
    83
        payload CHOICE {
vb@2831
    84
        `` for "message" |>> «yml:mixedCase(@name)» [APPLICATION «@id»] «@name»`if "position()!=last()" > ,`
vb@2831
    85
        }
vb@2831
    86
    }
vb@2831
    87
vb@2831
    88
    END
vb@2831
    89
vb@2831
    90
    ||
vb@2831
    91
vb@2831
    92
    template "message", mode=impl
vb@2831
    93
    ||
vb@2831
    94
    «@name» ::= SEQUENCE {
vb@2831
    95
    `` for "field|auto" |> «func:asn1name()» «func:asn1type()»`if "position()!=last()" > ,`
vb@2831
    96
    }
vb@2831
    97
vb@2831
    98
    ||
vb@2831
    99
}
vb@2831
   100