structure update, + ipv4

This commit is contained in:
Marcel 2015-01-04 12:04:36 +01:00
parent 3547c20733
commit c7fb06edee
4 changed files with 95 additions and 5 deletions

View File

@ -1,7 +1,7 @@
#Ethernet
---
protocol: &eth
name: eth
protocol: &ethframe
name: eth-frame
osilayer: 2
fields:
-

View File

@ -0,0 +1,15 @@
---
protocol: &ethpacket
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

70
protocols/osi3/ip.yml Normal file
View File

@ -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

View File

@ -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