openmls / plt

Presentation Language Tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Presentation Language Tool

A simple tool to parse the TLS/MLS presentation language for research and learning purposes.

Usage

Currently, this tool generates a dependency graph of all structs and enums defined in a given <file> and outputs a graph in either GML or GV format.

plt <file> [gml|gv]

You can try this out by running ...

cargo run -- assets/draft-ietf-mls-protocol.tls

... and using a GML viewer such as yEd. (Don't forget to apply an auto-layout.)

Warning

This tool is not thoroughly tested and might produce invalid GML/GV output. Use at your own risk!

Example

The following definition ...

struct {    
    CredentialType credential_type;    
    select (Credential.credential_type) {    
        case basic:    
            opaque identity<V>;    
    
        case x509:    
            Certificate chain<V>;    
    };    
} Credential;

... is parsed into ...

Struct(
    Struct {
        name: "Credential",
        items: [
            Field(
                Field {
                    type: "CredentialType",
                    name: "credential_type",
                    range: None,
                    optional: false,
                    default: None,
                },
            ),
            Select(
                Select {
                    over: "Credential.credential_type",
                    cases: [
                        Case {
                            left: "basic",
                            right: Fields(
                                [
                                    Field {
                                        type: "opaque",
                                        name: "identity",
                                        range: Some(
                                            Variable,
                                        ),
                                        optional: false,
                                        default: None,
                                    },
                                ],
                            ),
                        },
// ...
                    ],
                },
            ),
        ],
    },
)

License

Licensed under either of ...

... at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Presentation Language Tool

License:Apache License 2.0


Languages

Language:Rust 100.0%