From c7fb06edee375c5ad87937f0ea5f9c5d71ff6b85 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 4 Jan 2015 12:04:36 +0100 Subject: [PATCH] structure update, + ipv4 --- protocols/osi1-2/eth-frame.yml | 4 +- protocols/osi1-2/eth-packet.yml | 15 +++++++ protocols/osi3/ip.yml | 70 +++++++++++++++++++++++++++++++++ structure-schema.yml | 11 ++++-- 4 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 protocols/osi1-2/eth-packet.yml create mode 100644 protocols/osi3/ip.yml diff --git a/protocols/osi1-2/eth-frame.yml b/protocols/osi1-2/eth-frame.yml index 893b40a..c69c3f0 100644 --- a/protocols/osi1-2/eth-frame.yml +++ b/protocols/osi1-2/eth-frame.yml @@ -1,7 +1,7 @@ #Ethernet --- -protocol: ð - name: eth +protocol: ðframe + name: eth-frame osilayer: 2 fields: - diff --git a/protocols/osi1-2/eth-packet.yml b/protocols/osi1-2/eth-packet.yml new file mode 100644 index 0000000..026ee8e --- /dev/null +++ b/protocols/osi1-2/eth-packet.yml @@ -0,0 +1,15 @@ +--- +protocol: ðpacket + name: eth-packet + osilayer: 1 + fields: + - + field: preamble + length: 7 + - + field: Start of frame delimiter + length: 1 + - field: eth-frame + length: 0 + data: true + reference: eth-frame \ No newline at end of file diff --git a/protocols/osi3/ip.yml b/protocols/osi3/ip.yml new file mode 100644 index 0000000..40734c8 --- /dev/null +++ b/protocols/osi3/ip.yml @@ -0,0 +1,70 @@ +--- +protocol: + name: internet protocol version 4 + shortname: ipv4 + osilayer: 3 + fields: + - field: version + desc: Version + bitfield: yes + length: 4 + - field: IHL + desc: internet header length (IHL) + bitfield: yes + length: 4 + - field: DSCP + desc: differential services code point (DSCP) + bitfield: yes + length: 6 + - field: ECN + desc: explicit congestion notification (ECN) + bitfield: yes + length: 2 + - field: packetlength + desc: total length (incl. header) + length: 2 + - field: id + desc: identification + length: 2 + - field: flags + desc: fragment flags + bitfield: yes + length: 3 + subfields: + - field: reserved + desc: reserved + bitfield: yes + length: 1 + - field: df + desc: don't fragment (DF) + bitfield: yes + length: 1 + - field: mf + desc: more fragments (MF) + bitfield: yes + length: 1 + - field: fragmentoffset + desc: fragment offset + bitfield: yes + length: 13 + - field: TTL + desc: time to live (TTL) + length: 1 + - field: protocol + desc: protocol id + length: 1 + - field: headerchecksum + desc: header checksum + length: 2 + - field: source + desc: source ip address + length: 4 + - field: destination + desc: destination ip address + length: 4 + - field: options + desc: options (if IHL > 5) + length: 4 + optional: yes + - field: data + data: true \ No newline at end of file diff --git a/structure-schema.yml b/structure-schema.yml index 7bdcac7..4c7d470 100644 --- a/structure-schema.yml +++ b/structure-schema.yml @@ -7,26 +7,31 @@ mapping: "name": type: str required: yes + "shortname": + type: str "fields": type: seq required: yes sequence: &fieldsseq - type: map mapping: - "field": + "field": #field name (best if only one word, for easier referencing) type: str required: yes + "desc": #short description + type: str "length": #length in bytes, except bitfield is set to true! type: int - required: yes "bitfield": #if this is true length is in BITS! type: bool "optional": type: bool "repeatable": type: bool - "data": #data placeholder for next layer (length should be 0!) + "data": #data placeholder for next layer type: bool + "reference": #reference another protocol directly (e.g. ethpacket->ethframe) + type: str "subfields": type: seq sequence: *fieldsseq