-
Notifications
You must be signed in to change notification settings - Fork 0
/
mk-constants.py
167 lines (162 loc) · 3.38 KB
/
mk-constants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# $Id: mk-constants.py,v 1.8 2012/01/05 10:15:27 wiml Exp $
#
# Python libpcap
# Copyright (C) 2004,2007 Wim Lewis
# Based on:
# PY-libpcap (C) 1998, Aaron L. Rhodes
# constants.i (C) 2001,2002, David Margrave
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the BSD Licence. See the file COPYING
# for details.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
linktypes = (
'DLT_NULL',
'DLT_EN10MB',
'DLT_EN3MB',
'DLT_AX25',
'DLT_PRONET',
'DLT_CHAOS',
'DLT_ARCNET',
'DLT_ARCNET_LINUX',
'DLT_SLIP',
'DLT_SLIP_BSDOS',
'DLT_FDDI',
'DLT_HIPPI',
'DLT_ATM_RFC1483',
'DLT_RAW',
'DLT_PPP',
'DLT_PPP_BSDOS',
'DLT_PPP_SERIAL',
'DLT_PPP_ETHER',
'DLT_C_HDLC',
# 'DLT_CHDLC', # CHDLC is a compatibility alias for C_HDLC
'DLT_HDLC',
'DLT_ATM_CLIP',
'DLT_IEEE802',
'DLT_IEEE802_11',
'DLT_IEEE802_11_RADIO',
'DLT_IEEE802_11_RADIO_AVS',
'DLT_LOOP',
'DLT_LINUX_SLL',
'DLT_LTALK',
'DLT_ECONET',
'DLT_IPFILTER',
'DLT_PFLOG',
'DLT_PFSYNC',
'DLT_CISCO_IOS',
'DLT_PRISM_HEADER',
'DLT_AIRONET_HEADER',
'DLT_ENC',
'DLT_APPLE_IP_OVER_IEEE1394',
'DLT_AURORA',
'DLT_DOCSIS',
'DLT_FRELAY',
'DLT_IP_OVER_FC',
'DLT_JUNIPER_ATM1',
'DLT_JUNIPER_ATM2',
'DLT_JUNIPER_ES',
'DLT_JUNIPER_GGSN',
'DLT_JUNIPER_MFR',
'DLT_JUNIPER_MLFR',
'DLT_JUNIPER_MLPPP',
'DLT_JUNIPER_MONITOR',
'DLT_JUNIPER_SERVICES',
'DLT_LINUX_IRDA',
'DLT_RIO',
'DLT_SUNATM',
'DLT_SYMANTEC_FIREWALL',
'DLT_TZSP',
'DLT_REDBACK_SMARTEDGE',
'DLT_OLD_PFLOG',
'DLT_HHDLC',
'DLT_PCI_EXP',
'DLT_MTP2_WITH_PHDR',
'DLT_MTP2',
'DLT_MTP3',
'DLT_SCCP',
'DLT_IBM_SP',
'DLT_IBM_SN',
'DLT_BACNET_MS_TP',
'DLT_LINUX_PPP_WITHDIRECTION', # Replaced by DLT_PPP_PPPD
'DLT_GPRS_LLC',
'DLT_GPF_T',
'DLT_GPF_F',
'DLT_GCOM_T1E1',
'DLT_GCOM_SERIAL',
'DLT_JUNIPER_PIC_PEER',
'DLT_ERF_ETH',
'DLT_ERF_POS',
'DLT_LINUX_LAPD',
'DLT_JUNIPER_ETHER',
'DLT_JUNIPER_PPP',
'DLT_JUNIPER_PPPOE',
'DLT_JUNIPER_PPPOE_ATM',
'DLT_JUNIPER_FRELAY',
'DLT_JUNIPER_CHDLC',
'DLT_JUNIPER_ISM',
'DLT_JUNIPER_ST',
'DLT_JUNIPER_VP',
'DLT_PPP_PPPD',
'DLT_MFR',
'DLT_A429',
'DLT_A653_ICM',
'DLT_USB',
'DLT_USB_LINUX',
'DLT_CAN20B',
'DLT_BLUETOOTH_HCI_H4',
'DLT_BLUETOOTH_HCI_H4_WITH_PHDR',
'DLT_IEEE802_16_MAC_CPS',
'DLT_IEEE802_16_MAC_CPS_RADIO',
'DLT_IEEE802_15_4_LINUX',
'DLT_IEEE802_15_4',
'DLT_PPI',
'DLT_SITA',
'DLT_ERF',
'DLT_RAIF1',
'DLT_IPMB',
'DLT_AX25_KISS',
'DLT_LAPD',
'DLT_PPP_WITH_DIR',
'DLT_C_HDLC_WITH_DIR',
'DLT_FRELAY_WITH_DIR',
'DLT_LAPB_WITH_DIR',
'DLT_IPMB_LINUX',
'DLT_FLEXRAY',
'DLT_MOST',
'DLT_LIN',
'DLT_IEEE802_15_4_NONASK_PHY',
'DLT_GSMTAP_UM',
'DLT_GSMTAP_ABIS',
'DLT_MPLS',
'DLT_DECT',
'DLT_AOS',
'DLT_WIHART',
'DLT_FC_2',
'DLT_FC_2_WITH_FRAME_DELIMS',
'DLT_IPNET',
'DLT_CAN_SOCKETCAN',
'DLT_IPV4',
'DLT_IPV6',
'DLT_IEEE802_15_4_NOFCS',
'DLT_MUX27010',
'DLT_STANAG_5066_D_PDU',
'DLT_IPOIB',
)
import string
fp = open('constants.c', 'w')
fp.write('/* Automatically generated from\n')
rcs = ' $Id: mk-constants.py,v 1.8 2012/01/05 10:15:27 wiml Exp $\n'
fp.write(string.replace(rcs, '$', ''))
fp.write(' Do not edit this file directly, it will be overwritten \n*/\n\n')
fp.write('static struct { const char *name; long value; } ')
fp.write(' const pcapmodule_DLT[] = {\n')
for dlt in linktypes:
fp.write('#ifdef %s\n' % (dlt,))
fp.write('{ "%s", (%s) },\n' % (dlt,dlt))
fp.write('#endif\n')
fp.write('{ NULL, 0 }\n};\n')
fp.close()