root/pm/trunk/umit/pm/core/netconst.py @ 5467

Revision 5467, 3.7 kB (checked in by nopper, 9 months ago)

Using flags attribute in MetaPacket? and adding l{2,3,4}_{src,dst,..}
attributes to improve performane and code readability (this should avoid
get_field() to be called for common fields)

Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# Copyright (C) 2009 Adriano Monteiro Marques
4#
5# Author: Francesco Piccinno <stack.box@gmail.com>
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
21###############################################################################
22# Layers
23###############################################################################
24
25IFACE_LAYER   = 1
26LINK_LAYER    = 2
27NET_LAYER     = 3
28PROTO_LAYER   = 4
29
30# Here goes dissectors
31APP_LAYER     = 5
32APP_LAYER_TCP = 6
33APP_LAYER_UDP = 7
34
35###############################################################################
36# Layer types
37###############################################################################
38
39# IFACE_LAYER types
40IL_TYPE_ETH   = 0x01 # ethernet
41IL_TYPE_TR    = 0x06 # token ring
42IL_TYPE_FDDI  = 0x0a # fiber distributed data interface
43IL_TYPE_RAWIP = 0x0c # raw ip dump file
44IL_TYPE_WIFI  = 0x69 # wireless
45IL_TYPE_COOK  = 0x71 # linux cooked
46IL_TYPE_PRISM = 0x77 # prism2 header for wifi dumps
47
48# LINK_LAYER types
49LL_TYPE_IP   = 0x0800
50LL_TYPE_IP6  = 0x86DD
51LL_TYPE_ARP  = 0x0806
52LL_TYPE_PPP  = 0x880B
53LL_TYPE_VLAN = 0x8100
54
55# NET_LAYER types
56NL_TYPE_ICMP  = 0x01
57NL_TYPE_ICMP6 = 0x3a
58NL_TYPE_TCP   = 0x06
59NL_TYPE_UDP   = 0x11
60NL_TYPE_GRE   = 0x2f
61NL_TYPE_OSPF  = 0x59
62NL_TYPE_VRRP  = 0x70
63
64# PROTO_LAYER types
65PL_DEFAULT  = 0x0000
66
67###############################################################################
68# TCP headers flags
69###############################################################################
70
71TH_FIN = 0x01
72TH_SYN = 0x02
73TH_RST = 0x04
74TH_PSH = 0x08
75TH_ACK = 0x10
76TH_URG = 0x20
77
78###############################################################################
79# ICMP types & codes
80###############################################################################
81
82ICMP_TYPE_ECHOREPLY     = 0
83ICMP_TYPE_DEST_UNREACH  = 3
84ICMP_TYPE_REDIRECT      = 5
85ICMP_TYPE_ECHO          = 8
86ICMP_TYPE_TIME_EXCEEDED = 11
87
88ICMP_CODE_NET_UNREACH   = 0
89ICMP_CODE_HOST_UNREACH  = 1
90
91###############################################################################
92# Injection stuff
93###############################################################################
94
95INJ_ERROR         = -1
96INJ_SKIP_PACKET   = 0 # Useless packet skip it
97INJ_COLLECT_DATA  = 1 # Data collection
98INJ_COLLECT_STATS = 2 # Drop data collect only number of bytes
99INJ_FORWARDED     = 3 # Forwarded
100INJ_FORWARD       = 4 # Forward the packet as is
101INJ_MODIFIED      = 5 # Forward the packet but recompute checksums
102
103###############################################################################
104# Metapacket constants
105###############################################################################
106
107MPKT_IGNORE      = 1
108MPKT_FORWARDABLE = 1 << 2
109MPKT_FORWARDED   = 1 << 3
110MPKT_FROMIFACE   = 1 << 4
111MPKT_FROMBRIDGE  = 1 << 5
112
113###############################################################################
114# Connection tracking constants
115###############################################################################
116
117CONN_UNDEFINED        = -1
118CONN_JUST_ESTABLISHED = 0
119CONN_DATA             = 1
120CONN_RESET            = 2
121CONN_CLOSE            = 3
122CONN_TIMED_OUT        = 4
Note: See TracBrowser for help on using the browser.