kwalify structure schema, eth-frame, tcp and a example (which is tcp...)

This commit is contained in:
Marcel 2015-01-04 11:23:12 +01:00
parent df03df1b5a
commit 3547c20733
4 changed files with 215 additions and 0 deletions

70
example.yml Normal file
View File

@ -0,0 +1,70 @@
# Example YAML protocol structure
protocol: &tcp
name: TCP
fields:
-
field: source port
length: 2
-
field: destination port
length: 2
-
field: sequence number
length: 4
-
field: acknowledgment number
length: 4
-
field: data offset
bitfield: yes
length: 4
-
field: reserved
bitfield: yes
length: 6
-
field: URG
bitfield: yes
length: 1
-
field: ACK
bitfield: yes
length: 1
-
field: PSH
bitfield: yes
length: 1
-
field: RST
bitfield: yes
length: 1
-
field: SYN
bitfield: yes
length: 1
-
field: FIN
bitfield: yes
length: 1
-
field: window
length: 2
-
field: checksum
length: 2
-
field: options
length: 4
optional: true
repeatable: true
-
field: data
length: 0
data: true
osilayer: 4

View File

@ -0,0 +1,45 @@
#Ethernet
---
protocol: &eth
name: eth
osilayer: 2
fields:
-
field: destination MAC
length: 6
-
field: source MAC
length: 6
-
field: vlan tag
length: 4
subfields:
-
field: tag protocol identifier (0x8100)
length: 2
-
field: tag control information
length: 2
subfields:
-
field: priority code point (PCP)
bitfield: yes
length: 3
-
field: drop eligible indicator (DEI)
bitfield: yes
length: 1
-
field: VLAN identifier (VID)
bitfield: yes
length: 12
-
field: Ethertype (Eth II) or length (IEEE 802.3)
length: 2
-
field: data
length: 0
data: true
-
field: FCS (32-bit CRC)
length: 4

64
protocols/osi4/tcp.yml Normal file
View File

@ -0,0 +1,64 @@
---
protocol: &tcp
name: TCP
fields:
-
field: source port
length: 2
-
field: destination port
length: 2
-
field: sequence number
length: 4
-
field: acknowledgment number
length: 4
-
field: data offset
bitfield: yes
length: 4
-
field: reserved
bitfield: yes
length: 6
-
field: URG
bitfield: yes
length: 1
-
field: ACK
bitfield: yes
length: 1
-
field: PSH
bitfield: yes
length: 1
-
field: RST
bitfield: yes
length: 1
-
field: SYN
bitfield: yes
length: 1
-
field: FIN
bitfield: yes
length: 1
-
field: window
length: 2
-
field: checksum
length: 2
-
field: options
length: 4
optional: true
repeatable: true
-
field: data
length: 0
data: true
osilayer: 4

36
structure-schema.yml Normal file
View File

@ -0,0 +1,36 @@
type: map
mapping:
"protocol":
type: map
required: yes
mapping:
"name":
type: str
required: yes
"fields":
type: seq
required: yes
sequence: &fieldsseq
- type: map
mapping:
"field":
type: str
required: yes
"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!)
type: bool
"subfields":
type: seq
sequence: *fieldsseq
"osilayer":
type: int
range: { max: 7, min: 1 }
required: yes