sync/gen_messages.ysl2
branchsync
changeset 2831 be6623599adb
child 2864 dcbed0d35466
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/sync/gen_messages.ysl2	Thu Aug 09 12:26:53 2018 +0200
     1.3 @@ -0,0 +1,100 @@
     1.4 +// This file is under GNU General Public License 3.0
     1.5 +// see LICENSE.txt
     1.6 +// generated files of this template are under BSD License 2.0
     1.7 +
     1.8 +// generate message functions
     1.9 +
    1.10 +// Copyleft (c) 2017, p≡p foundation
    1.11 +
    1.12 +// Written by Volker Birk
    1.13 +
    1.14 +include yslt.yml2
    1.15 +
    1.16 +tstylesheet {
    1.17 +    include standardlib.ysl2
    1.18 +    include ./functions.ysl2
    1.19 +
    1.20 +    function "pEp_imports"
    1.21 +        | IMPORTS Identity, IdentityList, TID, Hash FROM PEP;
    1.22 +
    1.23 +    template "/" {
    1.24 +        apply "protocol", 0, mode=overview;
    1.25 +        apply "protocol/fsm", 0, mode=individual;
    1.26 +    }
    1.27 +
    1.28 +    template "protocol", mode=overview
    1.29 +        document "generated/{yml:lcase(@name)}.asn1", "text"
    1.30 +    ||
    1.31 +    -- This file is under BSD License 2.0
    1.32 +
    1.33 +    -- «@name» protocol stack for p≡p
    1.34 +    -- Copyright (c) 2016, 2017 p≡p foundation
    1.35 +
    1.36 +    -- Written by Volker Birk
    1.37 +
    1.38 +    «yml:ucase(@name)»
    1.39 +        { iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) pEp(47878) «yml:lcase(@name)»(«@id») }
    1.40 +
    1.41 +    DEFINITIONS AUTOMATIC TAGS EXTENSIBILITY IMPLIED ::=
    1.42 +
    1.43 +    BEGIN
    1.44 +
    1.45 +    `` for "fsm" | IMPORTS «@name» FROM «yml:ucase(@name)»;
    1.46 +
    1.47 +    «@name» ::= CHOICE {
    1.48 +        `` for "fsm" |> «yml:lcase(@name)» [APPLICATION «@id»] «@name»`if "position()!=last()" > , `
    1.49 +    }
    1.50 +
    1.51 +    END
    1.52 +
    1.53 +    ||
    1.54 +
    1.55 +    template "fsm", mode=individual
    1.56 +        document "generated/{yml:lcase(@name)}.asn1", "text"
    1.57 +    ||
    1.58 +    -- This file is under BSD License 2.0
    1.59 +
    1.60 +    -- «@name» protocol for p≡p version «version/@major».«version/@minor»
    1.61 +    -- Copyright (c) 2016, 2017 p≡p foundation
    1.62 +
    1.63 +    -- Written by Volker Birk
    1.64 +
    1.65 +    «yml:ucase(@name)»
    1.66 +        { iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) pEp(47878) «yml:lcase(../@name)»(«../@id») «yml:lcase(@name)»(«@id») }
    1.67 +
    1.68 +    DEFINITIONS AUTOMATIC TAGS EXTENSIBILITY IMPLIED ::=
    1.69 +
    1.70 +    BEGIN
    1.71 +
    1.72 +    EXPORTS «@name»;
    1.73 +    `` call "pEp_imports"
    1.74 +
    1.75 +    Version ::= SEQUENCE {
    1.76 +        major INTEGER (0..255) DEFAULT «version/@major»,
    1.77 +        minor INTEGER (0..255) DEFAULT «version/@minor»
    1.78 +    }
    1.79 +
    1.80 +    `` apply "message", 0, mode=impl;
    1.81 +    «@name» ::= SEQUENCE {
    1.82 +        header SEQUENCE {
    1.83 +            sequence INTEGER  -- always increases
    1.84 +        },
    1.85 +
    1.86 +        payload CHOICE {
    1.87 +        `` for "message" |>> «yml:mixedCase(@name)» [APPLICATION «@id»] «@name»`if "position()!=last()" > ,`
    1.88 +        }
    1.89 +    }
    1.90 +
    1.91 +    END
    1.92 +
    1.93 +    ||
    1.94 +
    1.95 +    template "message", mode=impl
    1.96 +    ||
    1.97 +    «@name» ::= SEQUENCE {
    1.98 +    `` for "field|auto" |> «func:asn1name()» «func:asn1type()»`if "position()!=last()" > ,`
    1.99 +    }
   1.100 +
   1.101 +    ||
   1.102 +}
   1.103 +