1## This file is part of Scapy
2## See http://www.secdev.org/projects/scapy for more informations
3## Copyright (C) Philippe Biondi <phil@secdev.org>
4## This program is published under a GPLv2 license
5
6"""
7Cisco NetFlow protocol v1
8"""
9
10
11from scapy.fields import *
12from scapy.packet import *
13
14# Cisco Netflow Protocol version 1
15class NetflowHeader(Packet):
16    name = "Netflow Header"
17    fields_desc = [ ShortField("version", 1) ]
18
19class NetflowHeaderV1(Packet):
20    name = "Netflow Header V1"
21    fields_desc = [ ShortField("count", 0),
22                    IntField("sysUptime", 0),
23                    IntField("unixSecs", 0),
24                    IntField("unixNanoSeconds", 0) ]
25
26
27class NetflowRecordV1(Packet):
28    name = "Netflow Record"
29    fields_desc = [ IPField("ipsrc", "0.0.0.0"),
30                    IPField("ipdst", "0.0.0.0"),
31                    IPField("nexthop", "0.0.0.0"),
32                    ShortField("inputIfIndex", 0),
33                    ShortField("outpuIfIndex", 0),
34                    IntField("dpkts", 0),
35                    IntField("dbytes", 0),
36                    IntField("starttime", 0),
37                    IntField("endtime", 0),
38                    ShortField("srcport", 0),
39                    ShortField("dstport", 0),
40                    ShortField("padding", 0),
41                    ByteField("proto", 0),
42                    ByteField("tos", 0),
43                    IntField("padding1", 0),
44                    IntField("padding2", 0) ]
45
46
47bind_layers( NetflowHeader,   NetflowHeaderV1, version=1)
48bind_layers( NetflowHeaderV1, NetflowRecordV1, )
49