mk constants.py :  » Network » python-libpcap » pylibpcap-0.6.2 » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Network » python libpcap 
python libpcap » pylibpcap 0.6.2 » mk-constants.py
# $Id: mk-constants.py,v 1.7 2008/01/26 01:31:55 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',
)


import string
fp = open('constants.c', 'w')
fp.write('/* Automatically generated from\n')
rcs = '   $Id: mk-constants.py,v 1.7 2008/01/26 01:31:55 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()

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.