stuff from netpfga
This commit is contained in:
parent
6430cf8264
commit
cf5552d835
4 changed files with 213 additions and 0 deletions
25
netpfga/minip4/testdata/switch_calc_headers.py
vendored
Normal file
25
netpfga/minip4/testdata/switch_calc_headers.py
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
from scapy.all import *
|
||||
import sys, os
|
||||
|
||||
CALC_TYPE = 0x1212
|
||||
|
||||
ADD_OP = 0
|
||||
SUB_OP = 1
|
||||
LOOKUP_OP = 2
|
||||
ADD_REG_OP = 3
|
||||
SET_REG_OP = 4
|
||||
|
||||
class Calc(Packet):
|
||||
name = "Calc"
|
||||
fields_desc = [
|
||||
IntField("op1", 0),
|
||||
ByteEnumField("opCode", 0, {ADD_OP:"ADD", SUB_OP:"SUB", LOOKUP_OP:"LOOKUP", ADD_REG_OP:"ADD_REG", SET_REG_OP:"SET_REG"}),
|
||||
IntField("op2", 0),
|
||||
IntField("result", 0)
|
||||
]
|
||||
def mysummary(self):
|
||||
return self.sprintf("op1=%op1% %opCode% op2=%op2% result=%result%")
|
||||
|
||||
|
||||
bind_layers(Ether, Calc, type=CALC_TYPE)
|
||||
bind_layers(Calc, Raw)
|
||||
Loading…
Add table
Add a link
Reference in a new issue