Changeset 3479

Show
Ignore:
Timestamp:
08/16/08 13:20:30 (5 years ago)
Author:
getxsick
Message:

all attribute for protocols. another import cleaning etc.

Location:
branch/UMPA/umpa
Files:
5 modified
2 moved

Legend:

Unmodified
Added
Removed
  • branch/UMPA/umpa/__init__.py

    r3478 r3479  
    2020# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
    2121 
    22 from packets import Packet 
    23 from sockets import Socket 
     22from _packets import Packet 
     23from _sockets import Socket 
  • branch/UMPA/umpa/protocols/ICMP.py

    r3478 r3479  
    2020# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
    2121 
    22 import umpa.protocols._consts as const 
    23  
    24 from umpa.protocols._fields import * 
    25 from umpa.protocols._protocols import * 
    26  
    27 class HType(EnumIntField): 
     22from umpa.protocols import _consts 
     23from umpa.protocols import _fields 
     24from umpa.protocols import _protocols 
     25 
     26class _HType(_fields.EnumIntField): 
    2827    bits = 8 
    2928    auto = False 
     
    278277    } 
    279278 
    280 class HCode(IntField): 
     279class _HCode(_fields.IntField): 
    281280    bits = 8 
    282281    auto = False 
    283282 
    284 class HChecksum(IntField): 
     283class _HChecksum(_fields.IntField): 
    285284    bits = 16 
    286285    auto = True 
     
    288287        return 0 
    289288 
    290 class HExtraData(Field): 
     289class _HExtraData(_fields.Field): 
    291290    pass 
    292291 
    293 class ICMP(Protocol): 
     292class ICMP(_protocols.Protocol): 
    294293    layer = 4 
    295294    protocol_id = const.PROTOCOL_ICMP 
     
    300299    def __init__(self, **kw): 
    301300        raise NotImplementedError("not finished yet") 
    302         fields_list = [ HType("Type"), HCode("Code"), HChecksum("Checksum"),  
    303                         HExtraData("Extra Data"), ] 
     301        fields_list = [ _HType("Type"), 
     302                        _HCode("Code"), 
     303                        _HChecksum("Checksum"),  
     304                        _HExtraData("Extra Data"), ] 
    304305 
    305306        super(ICMP, self).__init__(fields_list, **kw) 
     
    312313 
    313314protocols = [ ICMP, ] 
     315__all__ = [ "ICMP", ] 
  • branch/UMPA/umpa/protocols/IP.py

    r3478 r3479  
    2020# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
    2121 
    22 import umpa.protocols._consts as const 
    23  
    24 from umpa.protocols._fields import * 
    25 from umpa.protocols._protocols import * 
    26 from umpa.utils import net 
    27 from umpa.utils import bits 
    28  
    29 class HVersion(EnumField): 
     22from umpa.protocols import _consts 
     23from umpa.protocols import _fields 
     24from umpa.protocols import _protocols 
     25import umpa.utils.net as _net 
     26import umpa.utils.bits as _bits 
     27 
     28class _HVersion(_fields.EnumField): 
    3029    """The Version field indicates the format of the internet header. 
    3130     
     
    3534    auto = True 
    3635    enumerable = { 
    37         "Reserved (0)"      : const.IPVERSION_RESERVED0, 
    38         "Internet Protocol" : const.IPVERSION_4, 
    39         "ST Datagram Mode"  : const.IPVERSION_ST_DATAGRAM_MODE, 
    40         "Reserved (15)"     : const.IPVERSION_RESERVED15 
     36        "Reserved (0)"      : _consts.IPVERSION_RESERVED0, 
     37        "Internet Protocol" : _consts.IPVERSION_4, 
     38        "ST Datagram Mode"  : _consts.IPVERSION_ST_DATAGRAM_MODE, 
     39        "Reserved (15)"     : _consts.IPVERSION_RESERVED15 
    4140    } 
    4241 
    4342    def _generate_value(self): 
    44         return const.IPVERSION_4 
    45  
    46 class HIHL(SpecialIntField): 
     43        return _consts.IPVERSION_4 
     44 
     45class _HIHL(_fields.SpecialIntField): 
    4746    """Internet Header Length is the length of the internet header in 32 bit 
    4847    words, and thus points to the beginning of the data. 
     
    5554        return 5 + self._tmp_value / 32 # 5 is a minimum value (see RFC 791) 
    5655 
    57 class HTotalLength(SpecialIntField): 
     56class _HTotalLength(_fields.SpecialIntField): 
    5857    """Total Length is the length of the datagram, measured in octets, 
    5958    including internet header and data. 
     
    6463    auto = True 
    6564    def _generate_value(self): 
    66         return self._tmp_value / const.BYTE 
    67  
    68 class HIdentification(IntField): 
     65        return self._tmp_value / _consts.BYTE 
     66 
     67class _HIdentification(_fields.IntField): 
    6968    """An identifying value assigned by the sender to aid in assembling the 
    7069    fragments of a datagram. 
     
    7978        return 0 
    8079 
    81 class HFragmentOffset(IntField): 
     80class _HFragmentOffset(_fields.IntField): 
    8281    """This field indicates where in the datagram this fragment belongs. 
    8382     
     
    9190        return 0 
    9291 
    93 class HTTL(IntField): 
     92class _HTTL(_fields.IntField): 
    9493    """This field indicates the maximum time the datagram is allowed to 
    9594    remain in the internet system. 
     
    104103        # list of returns from sys.platform 
    105104        # also, there is some changes in Python 2.6 about sys.platform 
    106         return const.TTL_LINUX 
     105        return _consts.TTL_LINUX 
    107106 
    108107    def ttl(self, name): 
     
    118117        self._value = getattr(const, name) 
    119118 
    120 class HProtocol(SpecialIntField, EnumField): 
     119class _HProtocol(_fields.SpecialIntField, _fields.EnumField): 
    121120    """This field indicates the next level protocol used in the data portion 
    122121    of the internet datagram. 
     
    127126    auto = True 
    128127    enumerable = { 
    129         "Reserved (0)"                    : const.PROTOCOL_RESERVED0, 
    130         "ICMP"                            : const.PROTOCOL_ICMP, 
    131         "Gateway-to-Gateway"              : const.PROTOCOL_GATEWAY_TO_GATEWAY, 
    132         "CMCC Gateway Monitoring Message" : const.PROTOCOL_CMCC, 
    133         "ST"                              : const.PROTOCOL_ST, 
    134         "TCP"                             : const.PROTOCOL_TCP, 
    135         "UCL"                             : const.PROTOCOL_UCL, 
    136         "Secure"                          : const.PROTOCOL_SECURE, 
    137         "BBN RCC Monitoring"              : const.PROTOCOL_BBN_RCC_MONITORING, 
    138         "NVP"                             : const.PROTOCOL_NVP, 
    139         "PUP"                             : const.PROTOCOL_PUP, 
    140         "Pluribus"                        : const.PROTOCOL_PLURIBUS, 
    141         "Telenet"                         : const.PROTOCOL_TELENET, 
    142         "XNET"                            : const.PROTOCOL_XNET, 
    143         "Chaos"                           : const.PROTOCOL_CHAOS, 
    144         "UDP"                             : const.PROTOCOL_UDP, 
    145         "Multiplexing"                    : const.PROTOCOL_MULTIPLEXING, 
    146         "DCN"                             : const.PROTOCOL_DCN, 
    147         "TAC Monitoring"                  : const.PROTOCOL_TAC_MONITORING, 
    148         "any local network"               : const.PROTOCOL_ANY, 
    149         "SATNET and Backroom EXPAK"       : const.PROTOCOL_SATNET_BACKROOM_EXPAK, 
    150         "MIT Subnet Support"              : const.PROTOCOL_MIT_SUBNET_SUPPORT, 
    151         "SATNET Monitoring"               : const.PROTOCOL_SATNET_MONITORING, 
    152         "Internet Packet Core Utility"    : const.PROTOCOL_INTERNET_PACKET_CORE_UTILITY, 
    153         "Backroom SATNET Monitoring"      : const.PROTOCOL_BACKROOM_SATNET_MONITORING, 
    154         "WIDEBAND Monitoring"             : const.PROTOCOL_WIDEBAND_MONITORING, 
    155         "WIDEBAND EXPAK"                  : const.PROTOCOL_WIDEBAND_EXPAK, 
    156         "Reserved (255)"                  : const.PROTOCOL_RESERVED255 
     128        "Reserved (0)"                    : _consts.PROTOCOL_RESERVED0, 
     129        "ICMP"                            : _consts.PROTOCOL_ICMP, 
     130        "Gateway-to-Gateway"              : _consts.PROTOCOL_GATEWAY_TO_GATEWAY, 
     131        "CMCC Gateway Monitoring Message" : _consts.PROTOCOL_CMCC, 
     132        "ST"                              : _consts.PROTOCOL_ST, 
     133        "TCP"                             : _consts.PROTOCOL_TCP, 
     134        "UCL"                             : _consts.PROTOCOL_UCL, 
     135        "Secure"                          : _consts.PROTOCOL_SECURE, 
     136        "BBN RCC Monitoring"              : _consts.PROTOCOL_BBN_RCC_MONITORING, 
     137        "NVP"                             : _consts.PROTOCOL_NVP, 
     138        "PUP"                             : _consts.PROTOCOL_PUP, 
     139        "Pluribus"                        : _consts.PROTOCOL_PLURIBUS, 
     140        "Telenet"                         : _consts.PROTOCOL_TELENET, 
     141        "XNET"                            : _consts.PROTOCOL_XNET, 
     142        "Chaos"                           : _consts.PROTOCOL_CHAOS, 
     143        "UDP"                             : _consts.PROTOCOL_UDP, 
     144        "Multiplexing"                    : _consts.PROTOCOL_MULTIPLEXING, 
     145        "DCN"                             : _consts.PROTOCOL_DCN, 
     146        "TAC Monitoring"                  : _consts.PROTOCOL_TAC_MONITORING, 
     147        "any local network"               : _consts.PROTOCOL_ANY, 
     148        "SATNET and Backroom EXPAK"       : _consts.PROTOCOL_SATNET_BACKROOM_EXPAK, 
     149        "MIT Subnet Support"              : _consts.PROTOCOL_MIT_SUBNET_SUPPORT, 
     150        "SATNET Monitoring"               : _consts.PROTOCOL_SATNET_MONITORING, 
     151        "Internet Packet Core Utility"    : _consts.PROTOCOL_INTERNET_PACKET_CORE_UTILITY, 
     152        "Backroom SATNET Monitoring"      : _consts.PROTOCOL_BACKROOM_SATNET_MONITORING, 
     153        "WIDEBAND Monitoring"             : _consts.PROTOCOL_WIDEBAND_MONITORING, 
     154        "WIDEBAND EXPAK"                  : _consts.PROTOCOL_WIDEBAND_EXPAK, 
     155        "Reserved (255)"                  : _consts.PROTOCOL_RESERVED255 
    157156    } 
    158157 
     
    160159        return self._tmp_value 
    161160 
    162 class HHeaderChecksum(IntField): 
     161class _HHeaderChecksum(_fields.IntField): 
    163162    """A checksum on the header only. 
    164163     
     
    172171# main IP class 
    173172 
    174 class IP(Protocol): 
     173class IP(_protocols.Protocol): 
    175174    """This is Internet Protocol. 
    176175    The main protocol in third layer of OSI model. 
    177176    """ 
    178177    layer = 3      # layer of OSI 
    179     protocol_id = const.ETHERTYPE_IP 
     178    protocol_id = _consts.ETHERTYPE_IP 
    180179    name = "IP" 
    181180 
     
    201200        #       to be more reliable we should generate default value depends on 
    202201        #       user platform. does anyone know every values of sys.platform? :) 
    203         fields_list = [ HVersion("Version", 4), HIHL("IHL"), 
    204                         Flags("TOS", tos, **tos_predefined), 
    205                         HTotalLength("Total Length"), 
    206                         HIdentification("Identification", 0), 
    207                         Flags("Flags", flags, **flags_predefined), 
    208                         HFragmentOffset("Fragment Offset", 0), 
    209                         HTTL("TTL", const.TTL_LINUX), HProtocol("Protocol"), 
    210                         HHeaderChecksum("Header Checksum", 0), 
    211                         IPv4AddrField("Source Address", "127.0.0.1"), 
    212                         IPv4AddrField("Destination Address", "127.0.0.1"), 
    213                         Flags("Options", ()), PaddingField("Padding") ] 
     202        fields_list = [ _HVersion("Version", 4), 
     203                        _HIHL("IHL"), 
     204                        _fields.Flags("TOS", tos, **tos_predefined), 
     205                        _HTotalLength("Total Length"), 
     206                        _HIdentification("Identification", 0), 
     207                        _fields.Flags("Flags", flags, **flags_predefined), 
     208                        _HFragmentOffset("Fragment Offset", 0), 
     209                        _HTTL("TTL", _consts.TTL_LINUX), 
     210                        _HProtocol("Protocol"), 
     211                        _HHeaderChecksum("_Header Checksum", 0), 
     212                        _fields.IPv4AddrField("Source Address", "127.0.0.1"), 
     213                        _fields.IPv4AddrField("Destination Address", 
     214                                                                "127.0.0.1"), 
     215                        _fields.Flags("Options", ()), 
     216                        _fields.PaddingField("Padding") ] 
    214217 
    215218        # we call super.__init__ after prepared necessary data 
     
    267270                                    self._get_field('_header_checksum').bits 
    268271        # check if user doesn't provide own values of bits 
    269         if bits.get_bits(raw_value, 
     272        if _bits.get_bits(raw_value, 
    270273                        self._get_field('_header_checksum').bits, 
    271274                        cksum_offset, 
    272275                        rev_offset=True) == 0: 
    273276            # calculate and add checksum to the raw_value 
    274             cksum = net.in_cksum(raw_value) 
     277            cksum = _net.in_cksum(raw_value) 
    275278            raw_value |= cksum << cksum_offset 
    276279 
     
    278281 
    279282protocols = [ IP, ] 
     283__all__ = [ "IP", ] 
  • branch/UMPA/umpa/protocols/TCP.py

    r3478 r3479  
    2020# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
    2121 
    22 import umpa.protocols._consts as const 
    23  
    24 from umpa.protocols._fields import * 
    25 from umpa.protocols._protocols import * 
    26 from umpa.protocols._layer4 import * 
     22from umpa.protocols import _consts 
     23from umpa.protocols import _fields 
     24from umpa.protocols import _protocols 
     25from umpa.protocols import _layer4 
    2726from umpa.utils import net 
    2827from umpa.utils import bits 
    2928 
    30 class HPort(EnumField): 
     29class _HPort(_fields.EnumField): 
    3130    bits = 16 
    3231    auto = False 
    3332    enumerable = { 
    34         "TCPMUX" : const.PORT_TCP_TCPMUX, 
    35         "ECHO" : const.PORT_TCP_ECHO, 
    36         "DISCARD" : const.PORT_TCP_DISCARD, 
    37         "SYSTAT" : const.PORT_TCP_SYSTAT, 
    38         "DAYTIME" : const.PORT_TCP_DAYTIME, 
    39         "NETSTAT" : const.PORT_TCP_NETSTAT, 
    40         "QOTD" : const.PORT_TCP_QOTD, 
    41         "MSP" : const.PORT_TCP_MSP, 
    42         "CHARGEN" : const.PORT_TCP_CHARGEN, 
    43         "DATA" : const.PORT_TCP_DATA, 
    44         "FTP" : const.PORT_TCP_FTP, 
    45         "SSH" : const.PORT_TCP_SSH, 
    46         "TELNET" : const.PORT_TCP_TELNET, 
    47         "SMTP" : const.PORT_TCP_SMTP, 
    48         "TIME" : const.PORT_TCP_TIME, 
    49         "NAMESERVER" : const.PORT_TCP_NAMESERVER, 
    50         "WHOIS" : const.PORT_TCP_WHOIS, 
    51         "TACACS" : const.PORT_TCP_TACACS, 
    52         "CK" : const.PORT_TCP_CK, 
    53         "DOMAIN" : const.PORT_TCP_DOMAIN, 
    54         "MTP" : const.PORT_TCP_MTP, 
    55         "DS" : const.PORT_TCP_DS, 
    56         "BOOTPS" : const.PORT_TCP_BOOTPS, 
    57         "BOOTPC" : const.PORT_TCP_BOOTPC, 
    58         "GOPHER" : const.PORT_TCP_GOPHER, 
    59         "RJE" : const.PORT_TCP_RJE, 
    60         "FINGER" : const.PORT_TCP_FINGER, 
    61         "WWW" : const.PORT_TCP_WWW, 
    62         "LINK" : const.PORT_TCP_LINK, 
    63         "KERBEROS" : const.PORT_TCP_KERBEROS, 
    64         "SUPDUP" : const.PORT_TCP_SUPDUP, 
    65         "HOSTNAMES" : const.PORT_TCP_HOSTNAMES, 
    66         "TSAP" : const.PORT_TCP_TSAP, 
    67         "NEMA" : const.PORT_TCP_NEMA, 
    68         "NS" : const.PORT_TCP_NS, 
    69         "RTELNET" : const.PORT_TCP_RTELNET, 
    70         "POP2" : const.PORT_TCP_POP2, 
    71         "POP3" : const.PORT_TCP_POP3, 
    72         "SUNRPC" : const.PORT_TCP_SUNRPC, 
    73         "AUTH" : const.PORT_TCP_AUTH, 
    74         "SFTP" : const.PORT_TCP_SFTP, 
    75         "PATH" : const.PORT_TCP_PATH, 
    76         "NNTP" : const.PORT_TCP_NNTP, 
    77         "NTP" : const.PORT_TCP_NTP, 
    78         "PWDGEN" : const.PORT_TCP_PWDGEN, 
    79         "SRV" : const.PORT_TCP_SRV, 
    80         "NS" : const.PORT_TCP_NS, 
    81         "DGM" : const.PORT_TCP_DGM, 
    82         "SSN" : const.PORT_TCP_SSN, 
    83         "IMAP2" : const.PORT_TCP_IMAP2, 
    84         "SNMP" : const.PORT_TCP_SNMP, 
    85         "TRAP" : const.PORT_TCP_TRAP, 
    86         "MAN" : const.PORT_TCP_MAN, 
    87         "AGENT" : const.PORT_TCP_AGENT, 
    88         "MAILQ" : const.PORT_TCP_MAILQ, 
    89         "XDMCP" : const.PORT_TCP_XDMCP, 
    90         "NEXTSTEP" : const.PORT_TCP_NEXTSTEP, 
    91         "BGP" : const.PORT_TCP_BGP, 
    92         "PROSPERO" : const.PORT_TCP_PROSPERO, 
    93         "IRC" : const.PORT_TCP_IRC, 
    94         "SMUX" : const.PORT_TCP_SMUX, 
    95         "RTMP" : const.PORT_TCP_RTMP, 
    96         "NBP" : const.PORT_TCP_NBP, 
    97         "ECHO" : const.PORT_TCP_ECHO, 
    98         "ZIS" : const.PORT_TCP_ZIS, 
    99         "QMTP" : const.PORT_TCP_QMTP, 
    100         "Z3950" : const.PORT_TCP_Z3950, 
    101         "IPX" : const.PORT_TCP_IPX, 
    102         "IMAP3" : const.PORT_TCP_IMAP3, 
    103         "PAWSERV" : const.PORT_TCP_PAWSERV, 
    104         "ZSERV" : const.PORT_TCP_ZSERV, 
    105         "FATSERV" : const.PORT_TCP_FATSERV, 
    106         "RPC2PORTMAP" : const.PORT_TCP_RPC2PORTMAP, 
    107         "CODAAUTH2" : const.PORT_TCP_CODAAUTH2, 
    108         "CLEARCASE" : const.PORT_TCP_CLEARCASE, 
    109         "ULISTSERV" : const.PORT_TCP_ULISTSERV, 
    110         "LDAP" : const.PORT_TCP_LDAP, 
    111         "IMSP" : const.PORT_TCP_IMSP, 
    112         "HTTPS" : const.PORT_TCP_HTTPS, 
    113         "SNPP" : const.PORT_TCP_SNPP, 
    114         "DS" : const.PORT_TCP_DS, 
    115         "KPASSWD" : const.PORT_TCP_KPASSWD, 
    116         "SAFT" : const.PORT_TCP_SAFT, 
    117         "ISAKMP" : const.PORT_TCP_ISAKMP, 
    118         "RTSP" : const.PORT_TCP_RTSP, 
    119         "NQS" : const.PORT_TCP_NQS, 
    120         "LOCAL" : const.PORT_TCP_LOCAL, 
    121         "GUI" : const.PORT_TCP_GUI, 
    122         "IND" : const.PORT_TCP_IND, 
    123         "IPP" : const.PORT_TCP_IPP, 
    124         "EXEC" : const.PORT_TCP_EXEC, 
    125         "LOGIN" : const.PORT_TCP_LOGIN, 
    126         "SHELL" : const.PORT_TCP_SHELL, 
    127         "PRINTER" : const.PORT_TCP_PRINTER, 
    128         "TEMPO" : const.PORT_TCP_TEMPO, 
    129         "COURIER" : const.PORT_TCP_COURIER, 
    130         "CONFERENCE" : const.PORT_TCP_CONFERENCE, 
    131         "NETNEWS" : const.PORT_TCP_NETNEWS, 
    132         "GDOMAP" : const.PORT_TCP_GDOMAP, 
    133         "UUCP" : const.PORT_TCP_UUCP, 
    134         "KLOGIN" : const.PORT_TCP_KLOGIN, 
    135         "KSHELL" : const.PORT_TCP_KSHELL, 
    136         "AFPOVERTCP" : const.PORT_TCP_AFPOVERTCP, 
    137         "REMOTEFS" : const.PORT_TCP_REMOTEFS, 
    138         "NNTPS" : const.PORT_TCP_NNTPS, 
    139         "SUBMISSION" : const.PORT_TCP_SUBMISSION, 
    140         "LDAPS" : const.PORT_TCP_LDAPS, 
    141         "TINC" : const.PORT_TCP_TINC, 
    142         "SILC" : const.PORT_TCP_SILC, 
    143         "ADM" : const.PORT_TCP_ADM, 
    144         "WEBSTER" : const.PORT_TCP_WEBSTER, 
    145         "RSYNC" : const.PORT_TCP_RSYNC, 
    146         "DATA" : const.PORT_TCP_DATA, 
    147         "FTPS" : const.PORT_TCP_FTPS, 
    148         "TELNETS" : const.PORT_TCP_TELNETS, 
    149         "IMAPS" : const.PORT_TCP_IMAPS, 
    150         "IRCS" : const.PORT_TCP_IRCS, 
    151         "POP3S" : const.PORT_TCP_POP3S, 
    152         "SOCKS" : const.PORT_TCP_SOCKS, 
    153         "PROOFD" : const.PORT_TCP_PROOFD, 
    154         "ROOTD" : const.PORT_TCP_ROOTD, 
    155         "OPENVPN" : const.PORT_TCP_OPENVPN, 
    156         "RMIREGISTRY" : const.PORT_TCP_RMIREGISTRY, 
    157         "KAZAA" : const.PORT_TCP_KAZAA, 
    158         "NESSUS" : const.PORT_TCP_NESSUS, 
    159         "LOTUSNOTE" : const.PORT_TCP_LOTUSNOTE, 
    160         "S" : const.PORT_TCP_S, 
    161         "M" : const.PORT_TCP_M, 
    162         "INGRESLOCK" : const.PORT_TCP_INGRESLOCK, 
    163         "NP" : const.PORT_TCP_NP, 
    164         "DATAMETRICS" : const.PORT_TCP_DATAMETRICS, 
    165         "PORT" : const.PORT_TCP_PORT, 
    166         "KERMIT" : const.PORT_TCP_KERMIT, 
    167         "L2F" : const.PORT_TCP_L2F, 
    168         "RADIUS" : const.PORT_TCP_RADIUS, 
    169         "ACCT" : const.PORT_TCP_ACCT, 
    170         "MSNP" : const.PORT_TCP_MSNP, 
    171         "STATUS" : const.PORT_TCP_STATUS, 
    172         "SERVER" : const.PORT_TCP_SERVER, 
    173         "REMOTEPING" : const.PORT_TCP_REMOTEPING, 
    174         "NFS" : const.PORT_TCP_NFS, 
    175         "SC104" : const.PORT_TCP_SC104, 
    176         "CVSPSERVER" : const.PORT_TCP_CVSPSERVER, 
    177         "VENUS" : const.PORT_TCP_VENUS, 
    178         "SE" : const.PORT_TCP_SE, 
    179         "CODASRV" : const.PORT_TCP_CODASRV, 
    180         "SE" : const.PORT_TCP_SE, 
    181         "MON" : const.PORT_TCP_MON, 
    182         "DICT" : const.PORT_TCP_DICT, 
    183         "GPSD" : const.PORT_TCP_GPSD, 
    184         "GDS_DB" : const.PORT_TCP_GDS_DB, 
    185         "ICPV2" : const.PORT_TCP_ICPV2, 
    186         "MYSQL" : const.PORT_TCP_MYSQL, 
    187         "NUT" : const.PORT_TCP_NUT, 
    188         "DISTCC" : const.PORT_TCP_DISTCC, 
    189         "DAAP" : const.PORT_TCP_DAAP, 
    190         "SVN" : const.PORT_TCP_SVN, 
    191         "SUUCP" : const.PORT_TCP_SUUCP, 
    192         "SYSRQD" : const.PORT_TCP_SYSRQD, 
    193         "IAX" : const.PORT_TCP_IAX, 
    194         "PORT" : const.PORT_TCP_PORT, 
    195         "RFE" : const.PORT_TCP_RFE, 
    196         "MMCC" : const.PORT_TCP_MMCC, 
    197         "SIP" : const.PORT_TCP_SIP, 
    198         "TLS" : const.PORT_TCP_TLS, 
    199         "AOL" : const.PORT_TCP_AOL, 
    200         "CLIENT" : const.PORT_TCP_CLIENT, 
    201         "SERVER" : const.PORT_TCP_SERVER, 
    202         "CFENGINE" : const.PORT_TCP_CFENGINE, 
    203         "MDNS" : const.PORT_TCP_MDNS, 
    204         "POSTGRESQL" : const.PORT_TCP_POSTGRESQL, 
    205         "GGZ" : const.PORT_TCP_GGZ, 
    206         "X11" : const.PORT_TCP_X11, 
    207         "1" : const.PORT_TCP_1, 
    208         "2" : const.PORT_TCP_2, 
    209         "3" : const.PORT_TCP_3, 
    210         "4" : const.PORT_TCP_4, 
    211         "5" : const.PORT_TCP_5, 
    212         "6" : const.PORT_TCP_6, 
    213         "7" : const.PORT_TCP_7, 
    214         "SVC" : const.PORT_TCP_SVC, 
    215         "RTR" : const.PORT_TCP_RTR, 
    216         "SGE_QMASTER" : const.PORT_TCP_SGE_QMASTER, 
    217         "SGE_EXECD" : const.PORT_TCP_SGE_EXECD, 
    218         "FILESERVER" : const.PORT_TCP_FILESERVER, 
    219         "CALLBACK" : const.PORT_TCP_CALLBACK, 
    220         "PRSERVER" : const.PORT_TCP_PRSERVER, 
    221         "VLSERVER" : const.PORT_TCP_VLSERVER, 
    222         "KASERVER" : const.PORT_TCP_KASERVER, 
    223         "VOLSER" : const.PORT_TCP_VOLSER, 
    224         "ERRORS" : const.PORT_TCP_ERRORS, 
    225         "BOS" : const.PORT_TCP_BOS, 
    226         "UPDATE" : const.PORT_TCP_UPDATE, 
    227         "RMTSYS" : const.PORT_TCP_RMTSYS, 
    228         "SERVICE" : const.PORT_TCP_SERVICE, 
    229         "DIR" : const.PORT_TCP_DIR, 
    230         "FD" : const.PORT_TCP_FD, 
    231         "SD" : const.PORT_TCP_SD, 
    232         "AMANDA" : const.PORT_TCP_AMANDA, 
    233         "HKP" : const.PORT_TCP_HKP, 
    234         "BPRD" : const.PORT_TCP_BPRD, 
    235         "BPDBM" : const.PORT_TCP_BPDBM, 
    236         "MSVC" : const.PORT_TCP_MSVC, 
    237         "VNETD" : const.PORT_TCP_VNETD, 
    238         "BPCD" : const.PORT_TCP_BPCD, 
    239         "VOPIED" : const.PORT_TCP_VOPIED, 
    240         "WNN6" : const.PORT_TCP_WNN6, 
    241         "KERBEROS4" : const.PORT_TCP_KERBEROS4, 
    242         "KERBEROS_MASTER" : const.PORT_TCP_KERBEROS_MASTER, 
    243         "KRB_PROP" : const.PORT_TCP_KRB_PROP, 
    244         "KRBUPDATE" : const.PORT_TCP_KRBUPDATE, 
    245         "SWAT" : const.PORT_TCP_SWAT, 
    246         "KPOP" : const.PORT_TCP_KPOP, 
    247         "KNETD" : const.PORT_TCP_KNETD, 
    248         "EKLOGIN" : const.PORT_TCP_EKLOGIN, 
    249         "KX" : const.PORT_TCP_KX, 
    250         "IPROP" : const.PORT_TCP_IPROP, 
    251         "SUPFILESRV" : const.PORT_TCP_SUPFILESRV, 
    252         "SUPFILEDBG" : const.PORT_TCP_SUPFILEDBG, 
    253         "LINUXCONF" : const.PORT_TCP_LINUXCONF, 
    254         "POPPASSD" : const.PORT_TCP_POPPASSD, 
    255         "SSMTP" : const.PORT_TCP_SSMTP, 
    256         "MOIRA_DB" : const.PORT_TCP_MOIRA_DB, 
    257         "MOIRA_UPDATE" : const.PORT_TCP_MOIRA_UPDATE, 
    258         "SPAMD" : const.PORT_TCP_SPAMD, 
    259         "OMIRR" : const.PORT_TCP_OMIRR, 
    260         "CUSTOMS" : const.PORT_TCP_CUSTOMS, 
    261         "SKKSERV" : const.PORT_TCP_SKKSERV, 
    262         "RMTCFG" : const.PORT_TCP_RMTCFG, 
    263         "WIPLD" : const.PORT_TCP_WIPLD, 
    264         "XTEL" : const.PORT_TCP_XTEL, 
    265         "XTELW" : const.PORT_TCP_XTELW, 
    266         "SUPPORT" : const.PORT_TCP_SUPPORT, 
    267         "SIEVE" : const.PORT_TCP_SIEVE, 
    268         "CFINGER" : const.PORT_TCP_CFINGER, 
    269         "NDTP" : const.PORT_TCP_NDTP, 
    270         "FROX" : const.PORT_TCP_FROX, 
    271         "NINSTALL" : const.PORT_TCP_NINSTALL, 
    272         "ZEBRASRV" : const.PORT_TCP_ZEBRASRV, 
    273         "ZEBRA" : const.PORT_TCP_ZEBRA, 
    274         "RIPD" : const.PORT_TCP_RIPD, 
    275         "RIPNGD" : const.PORT_TCP_RIPNGD, 
    276         "OSPFD" : const.PORT_TCP_OSPFD, 
    277         "BGPD" : const.PORT_TCP_BGPD, 
    278         "OSPF6D" : const.PORT_TCP_OSPF6D, 
    279         "OSPFAPI" : const.PORT_TCP_OSPFAPI, 
    280         "ISISD" : const.PORT_TCP_ISISD, 
    281         "AFBACKUP" : const.PORT_TCP_AFBACKUP, 
    282         "AFMBACKUP" : const.PORT_TCP_AFMBACKUP, 
    283         "XTELL" : const.PORT_TCP_XTELL, 
    284         "FAX" : const.PORT_TCP_FAX, 
    285         "HYLAFAX" : const.PORT_TCP_HYLAFAX, 
    286         "DISTMP3" : const.PORT_TCP_DISTMP3, 
    287         "MUNIN" : const.PORT_TCP_MUNIN, 
    288         "CSTATD" : const.PORT_TCP_CSTATD, 
    289         "SSTATD" : const.PORT_TCP_SSTATD, 
    290         "PCRD" : const.PORT_TCP_PCRD, 
    291         "NOCLOG" : const.PORT_TCP_NOCLOG, 
    292         "HOSTMON" : const.PORT_TCP_HOSTMON, 
    293         "RPLAY" : const.PORT_TCP_RPLAY, 
    294         "RPTP" : const.PORT_TCP_RPTP, 
    295         "NSCA" : const.PORT_TCP_NSCA, 
    296         "MRTD" : const.PORT_TCP_MRTD, 
    297         "BGPSIM" : const.PORT_TCP_BGPSIM, 
    298         "CANNA" : const.PORT_TCP_CANNA, 
    299         "PORT" : const.PORT_TCP_PORT, 
    300         "IRCD" : const.PORT_TCP_IRCD, 
    301         "FTP" : const.PORT_TCP_FTP, 
    302         "WEBCACHE" : const.PORT_TCP_WEBCACHE, 
    303         "TPROXY" : const.PORT_TCP_TPROXY, 
    304         "OMNIORB" : const.PORT_TCP_OMNIORB, 
    305         "DAEMON" : const.PORT_TCP_DAEMON, 
    306         "XINETD" : const.PORT_TCP_XINETD, 
    307         "GIT" : const.PORT_TCP_GIT, 
    308         "ZOPE" : const.PORT_TCP_ZOPE, 
    309         "WEBMIN" : const.PORT_TCP_WEBMIN, 
    310         "KAMANDA" : const.PORT_TCP_KAMANDA, 
    311         "AMANDAIDX" : const.PORT_TCP_AMANDAIDX, 
    312         "AMIDXTAPE" : const.PORT_TCP_AMIDXTAPE, 
    313         "SMSQP" : const.PORT_TCP_SMSQP, 
    314         "XPILOT" : const.PORT_TCP_XPILOT, 
    315         "CAD" : const.PORT_TCP_CAD, 
    316         "ISDNLOG" : const.PORT_TCP_ISDNLOG, 
    317         "VBOXD" : const.PORT_TCP_VBOXD, 
    318         "BINKP" : const.PORT_TCP_BINKP, 
    319         "ASP" : const.PORT_TCP_ASP, 
    320         "CSYNC2" : const.PORT_TCP_CSYNC2, 
    321         "DIRCPROXY" : const.PORT_TCP_DIRCPROXY, 
    322         "TFIDO" : const.PORT_TCP_TFIDO, 
    323         "FIDO" : const.PORT_TCP_FIDO, 
     33        "TCPMUX" : _consts.PORT_TCP_TCPMUX, 
     34        "ECHO" : _consts.PORT_TCP_ECHO, 
     35        "DISCARD" : _consts.PORT_TCP_DISCARD, 
     36        "SYSTAT" : _consts.PORT_TCP_SYSTAT, 
     37        "DAYTIME" : _consts.PORT_TCP_DAYTIME, 
     38        "NETSTAT" : _consts.PORT_TCP_NETSTAT, 
     39        "QOTD" : _consts.PORT_TCP_QOTD, 
     40        "MSP" : _consts.PORT_TCP_MSP, 
     41        "CHARGEN" : _consts.PORT_TCP_CHARGEN, 
     42        "DATA" : _consts.PORT_TCP_DATA, 
     43        "FTP" : _consts.PORT_TCP_FTP, 
     44        "SSH" : _consts.PORT_TCP_SSH, 
     45        "TELNET" : _consts.PORT_TCP_TELNET, 
     46        "SMTP" : _consts.PORT_TCP_SMTP, 
     47        "TIME" : _consts.PORT_TCP_TIME, 
     48        "NAMESERVER" : _consts.PORT_TCP_NAMESERVER, 
     49        "WHOIS" : _consts.PORT_TCP_WHOIS, 
     50        "TACACS" : _consts.PORT_TCP_TACACS, 
     51        "CK" : _consts.PORT_TCP_CK, 
     52        "DOMAIN" : _consts.PORT_TCP_DOMAIN, 
     53        "MTP" : _consts.PORT_TCP_MTP, 
     54        "DS" : _consts.PORT_TCP_DS, 
     55        "BOOTPS" : _consts.PORT_TCP_BOOTPS, 
     56        "BOOTPC" : _consts.PORT_TCP_BOOTPC, 
     57        "GOPHER" : _consts.PORT_TCP_GOPHER, 
     58        "RJE" : _consts.PORT_TCP_RJE, 
     59        "FINGER" : _consts.PORT_TCP_FINGER, 
     60        "WWW" : _consts.PORT_TCP_WWW, 
     61        "LINK" : _consts.PORT_TCP_LINK, 
     62        "KERBEROS" : _consts.PORT_TCP_KERBEROS, 
     63        "SUPDUP" : _consts.PORT_TCP_SUPDUP, 
     64        "HOSTNAMES" : _consts.PORT_TCP_HOSTNAMES, 
     65        "TSAP" : _consts.PORT_TCP_TSAP, 
     66        "NEMA" : _consts.PORT_TCP_NEMA, 
     67        "NS" : _consts.PORT_TCP_NS, 
     68        "RTELNET" : _consts.PORT_TCP_RTELNET, 
     69        "POP2" : _consts.PORT_TCP_POP2, 
     70        "POP3" : _consts.PORT_TCP_POP3, 
     71        "SUNRPC" : _consts.PORT_TCP_SUNRPC, 
     72        "AUTH" : _consts.PORT_TCP_AUTH, 
     73        "SFTP" : _consts.PORT_TCP_SFTP, 
     74        "PATH" : _consts.PORT_TCP_PATH, 
     75        "NNTP" : _consts.PORT_TCP_NNTP, 
     76        "NTP" : _consts.PORT_TCP_NTP, 
     77        "PWDGEN" : _consts.PORT_TCP_PWDGEN, 
     78        "SRV" : _consts.PORT_TCP_SRV, 
     79        "NS" : _consts.PORT_TCP_NS, 
     80        "DGM" : _consts.PORT_TCP_DGM, 
     81        "SSN" : _consts.PORT_TCP_SSN, 
     82        "IMAP2" : _consts.PORT_TCP_IMAP2, 
     83        "SNMP" : _consts.PORT_TCP_SNMP, 
     84        "TRAP" : _consts.PORT_TCP_TRAP, 
     85        "MAN" : _consts.PORT_TCP_MAN, 
     86        "AGENT" : _consts.PORT_TCP_AGENT, 
     87        "MAILQ" : _consts.PORT_TCP_MAILQ, 
     88        "XDMCP" : _consts.PORT_TCP_XDMCP, 
     89        "NEXTSTEP" : _consts.PORT_TCP_NEXTSTEP, 
     90        "BGP" : _consts.PORT_TCP_BGP, 
     91        "PROSPERO" : _consts.PORT_TCP_PROSPERO, 
     92        "IRC" : _consts.PORT_TCP_IRC, 
     93        "SMUX" : _consts.PORT_TCP_SMUX, 
     94        "RTMP" : _consts.PORT_TCP_RTMP, 
     95        "NBP" : _consts.PORT_TCP_NBP, 
     96        "ECHO" : _consts.PORT_TCP_ECHO, 
     97        "ZIS" : _consts.PORT_TCP_ZIS, 
     98        "QMTP" : _consts.PORT_TCP_QMTP, 
     99        "Z3950" : _consts.PORT_TCP_Z3950, 
     100        "IPX" : _consts.PORT_TCP_IPX, 
     101        "IMAP3" : _consts.PORT_TCP_IMAP3, 
     102        "PAWSERV" : _consts.PORT_TCP_PAWSERV, 
     103        "ZSERV" : _consts.PORT_TCP_ZSERV, 
     104        "FATSERV" : _consts.PORT_TCP_FATSERV, 
     105        "RPC2PORTMAP" : _consts.PORT_TCP_RPC2PORTMAP, 
     106        "CODAAUTH2" : _consts.PORT_TCP_CODAAUTH2, 
     107        "CLEARCASE" : _consts.PORT_TCP_CLEARCASE, 
     108        "ULISTSERV" : _consts.PORT_TCP_ULISTSERV, 
     109        "LDAP" : _consts.PORT_TCP_LDAP, 
     110        "IMSP" : _consts.PORT_TCP_IMSP, 
     111        "HTTPS" : _consts.PORT_TCP_HTTPS, 
     112        "SNPP" : _consts.PORT_TCP_SNPP, 
     113        "DS" : _consts.PORT_TCP_DS, 
     114        "KPASSWD" : _consts.PORT_TCP_KPASSWD, 
     115        "SAFT" : _consts.PORT_TCP_SAFT, 
     116        "ISAKMP" : _consts.PORT_TCP_ISAKMP, 
     117        "RTSP" : _consts.PORT_TCP_RTSP, 
     118        "NQS" : _consts.PORT_TCP_NQS, 
     119        "LOCAL" : _consts.PORT_TCP_LOCAL, 
     120        "GUI" : _consts.PORT_TCP_GUI, 
     121        "IND" : _consts.PORT_TCP_IND, 
     122        "IPP" : _consts.PORT_TCP_IPP, 
     123        "EXEC" : _consts.PORT_TCP_EXEC, 
     124        "LOGIN" : _consts.PORT_TCP_LOGIN, 
     125        "SHELL" : _consts.PORT_TCP_SHELL, 
     126        "PRINTER" : _consts.PORT_TCP_PRINTER, 
     127        "TEMPO" : _consts.PORT_TCP_TEMPO, 
     128        "COURIER" : _consts.PORT_TCP_COURIER, 
     129        "CONFERENCE" : _consts.PORT_TCP_CONFERENCE, 
     130        "NETNEWS" : _consts.PORT_TCP_NETNEWS, 
     131        "GDOMAP" : _consts.PORT_TCP_GDOMAP, 
     132        "UUCP" : _consts.PORT_TCP_UUCP, 
     133        "KLOGIN" : _consts.PORT_TCP_KLOGIN, 
     134        "KSHELL" : _consts.PORT_TCP_KSHELL, 
     135        "AFPOVERTCP" : _consts.PORT_TCP_AFPOVERTCP, 
     136        "REMOTEFS" : _consts.PORT_TCP_REMOTEFS, 
     137        "NNTPS" : _consts.PORT_TCP_NNTPS, 
     138        "SUBMISSION" : _consts.PORT_TCP_SUBMISSION, 
     139        "LDAPS" : _consts.PORT_TCP_LDAPS, 
     140        "TINC" : _consts.PORT_TCP_TINC, 
     141        "SILC" : _consts.PORT_TCP_SILC, 
     142        "ADM" : _consts.PORT_TCP_ADM, 
     143        "WEBSTER" : _consts.PORT_TCP_WEBSTER, 
     144        "RSYNC" : _consts.PORT_TCP_RSYNC, 
     145        "DATA" : _consts.PORT_TCP_DATA, 
     146        "FTPS" : _consts.PORT_TCP_FTPS, 
     147        "TELNETS" : _consts.PORT_TCP_TELNETS, 
     148        "IMAPS" : _consts.PORT_TCP_IMAPS, 
     149        "IRCS" : _consts.PORT_TCP_IRCS, 
     150        "POP3S" : _consts.PORT_TCP_POP3S, 
     151        "SOCKS" : _consts.PORT_TCP_SOCKS, 
     152        "PROOFD" : _consts.PORT_TCP_PROOFD, 
     153        "ROOTD" : _consts.PORT_TCP_ROOTD, 
     154        "OPENVPN" : _consts.PORT_TCP_OPENVPN, 
     155        "RMIREGISTRY" : _consts.PORT_TCP_RMIREGISTRY, 
     156        "KAZAA" : _consts.PORT_TCP_KAZAA, 
     157        "NESSUS" : _consts.PORT_TCP_NESSUS, 
     158        "LOTUSNOTE" : _consts.PORT_TCP_LOTUSNOTE, 
     159        "S" : _consts.PORT_TCP_S, 
     160        "M" : _consts.PORT_TCP_M, 
     161        "INGRESLOCK" : _consts.PORT_TCP_INGRESLOCK, 
     162        "NP" : _consts.PORT_TCP_NP, 
     163        "DATAMETRICS" : _consts.PORT_TCP_DATAMETRICS, 
     164        "PORT" : _consts.PORT_TCP_PORT, 
     165        "KERMIT" : _consts.PORT_TCP_KERMIT, 
     166        "L2F" : _consts.PORT_TCP_L2F, 
     167        "RADIUS" : _consts.PORT_TCP_RADIUS, 
     168        "ACCT" : _consts.PORT_TCP_ACCT, 
     169        "MSNP" : _consts.PORT_TCP_MSNP, 
     170        "STATUS" : _consts.PORT_TCP_STATUS, 
     171        "SERVER" : _consts.PORT_TCP_SERVER, 
     172        "REMOTEPING" : _consts.PORT_TCP_REMOTEPING, 
     173        "NFS" : _consts.PORT_TCP_NFS, 
     174        "SC104" : _consts.PORT_TCP_SC104, 
     175        "CVSPSERVER" : _consts.PORT_TCP_CVSPSERVER, 
     176        "VENUS" : _consts.PORT_TCP_VENUS, 
     177        "SE" : _consts.PORT_TCP_SE, 
     178        "CODASRV" : _consts.PORT_TCP_CODASRV, 
     179        "SE" : _consts.PORT_TCP_SE, 
     180        "MON" : _consts.PORT_TCP_MON, 
     181        "DICT" : _consts.PORT_TCP_DICT, 
     182        "GPSD" : _consts.PORT_TCP_GPSD, 
     183        "GDS_DB" : _consts.PORT_TCP_GDS_DB, 
     184        "ICPV2" : _consts.PORT_TCP_ICPV2, 
     185        "MYSQL" : _consts.PORT_TCP_MYSQL, 
     186        "NUT" : _consts.PORT_TCP_NUT, 
     187        "DISTCC" : _consts.PORT_TCP_DISTCC, 
     188        "DAAP" : _consts.PORT_TCP_DAAP, 
     189        "SVN" : _consts.PORT_TCP_SVN, 
     190        "SUUCP" : _consts.PORT_TCP_SUUCP, 
     191        "SYSRQD" : _consts.PORT_TCP_SYSRQD, 
     192        "IAX" : _consts.PORT_TCP_IAX, 
     193        "PORT" : _consts.PORT_TCP_PORT, 
     194        "RFE" : _consts.PORT_TCP_RFE, 
     195        "MMCC" : _consts.PORT_TCP_MMCC, 
     196        "SIP" : _consts.PORT_TCP_SIP, 
     197        "TLS" : _consts.PORT_TCP_TLS, 
     198        "AOL" : _consts.PORT_TCP_AOL, 
     199        "CLIENT" : _consts.PORT_TCP_CLIENT, 
     200        "SERVER" : _consts.PORT_TCP_SERVER, 
     201        "CFENGINE" : _consts.PORT_TCP_CFENGINE, 
     202        "MDNS" : _consts.PORT_TCP_MDNS, 
     203        "POSTGRESQL" : _consts.PORT_TCP_POSTGRESQL, 
     204        "GGZ" : _consts.PORT_TCP_GGZ, 
     205        "X11" : _consts.PORT_TCP_X11, 
     206        "1" : _consts.PORT_TCP_1, 
     207        "2" : _consts.PORT_TCP_2, 
     208        "3" : _consts.PORT_TCP_3, 
     209        "4" : _consts.PORT_TCP_4, 
     210        "5" : _consts.PORT_TCP_5, 
     211        "6" : _consts.PORT_TCP_6, 
     212        "7" : _consts.PORT_TCP_7, 
     213        "SVC" : _consts.PORT_TCP_SVC, 
     214        "RTR" : _consts.PORT_TCP_RTR, 
     215        "SGE_QMASTER" : _consts.PORT_TCP_SGE_QMASTER, 
     216        "SGE_EXECD" : _consts.PORT_TCP_SGE_EXECD, 
     217        "FILESERVER" : _consts.PORT_TCP_FILESERVER, 
     218        "CALLBACK" : _consts.PORT_TCP_CALLBACK, 
     219        "PRSERVER" : _consts.PORT_TCP_PRSERVER, 
     220        "VLSERVER" : _consts.PORT_TCP_VLSERVER, 
     221        "KASERVER" : _consts.PORT_TCP_KASERVER, 
     222        "VOLSER" : _consts.PORT_TCP_VOLSER, 
     223        "ERRORS" : _consts.PORT_TCP_ERRORS, 
     224        "BOS" : _consts.PORT_TCP_BOS, 
     225        "UPDATE" : _consts.PORT_TCP_UPDATE, 
     226        "RMTSYS" : _consts.PORT_TCP_RMTSYS, 
     227        "SERVICE" : _consts.PORT_TCP_SERVICE, 
     228        "DIR" : _consts.PORT_TCP_DIR, 
     229        "FD" : _consts.PORT_TCP_FD, 
     230        "SD" : _consts.PORT_TCP_SD, 
     231        "AMANDA" : _consts.PORT_TCP_AMANDA, 
     232        "HKP" : _consts.PORT_TCP_HKP, 
     233        "BPRD" : _consts.PORT_TCP_BPRD, 
     234        "BPDBM" : _consts.PORT_TCP_BPDBM, 
     235        "MSVC" : _consts.PORT_TCP_MSVC, 
     236        "VNETD" : _consts.PORT_TCP_VNETD, 
     237        "BPCD" : _consts.PORT_TCP_BPCD, 
     238        "VOPIED" : _consts.PORT_TCP_VOPIED, 
     239        "WNN6" : _consts.PORT_TCP_WNN6, 
     240        "KERBEROS4" : _consts.PORT_TCP_KERBEROS4, 
     241        "KERBEROS_MASTER" : _consts.PORT_TCP_KERBEROS_MASTER, 
     242        "KRB_PROP" : _consts.PORT_TCP_KRB_PROP, 
     243        "KRBUPDATE" : _consts.PORT_TCP_KRBUPDATE, 
     244        "SWAT" : _consts.PORT_TCP_SWAT, 
     245        "KPOP" : _consts.PORT_TCP_KPOP, 
     246        "KNETD" : _consts.PORT_TCP_KNETD, 
     247        "EKLOGIN" : _consts.PORT_TCP_EKLOGIN, 
     248        "KX" : _consts.PORT_TCP_KX, 
     249        "IPROP" : _consts.PORT_TCP_IPROP, 
     250        "SUPFILESRV" : _consts.PORT_TCP_SUPFILESRV, 
     251        "SUPFILEDBG" : _consts.PORT_TCP_SUPFILEDBG, 
     252        "LINUXCONF" : _consts.PORT_TCP_LINUXCONF, 
     253        "POPPASSD" : _consts.PORT_TCP_POPPASSD, 
     254        "SSMTP" : _consts.PORT_TCP_SSMTP, 
     255        "MOIRA_DB" : _consts.PORT_TCP_MOIRA_DB, 
     256        "MOIRA_UPDATE" : _consts.PORT_TCP_MOIRA_UPDATE, 
     257        "SPAMD" : _consts.PORT_TCP_SPAMD, 
     258        "OMIRR" : _consts.PORT_TCP_OMIRR, 
     259        "CUSTOMS" : _consts.PORT_TCP_CUSTOMS, 
     260        "SKKSERV" : _consts.PORT_TCP_SKKSERV, 
     261        "RMTCFG" : _consts.PORT_TCP_RMTCFG, 
     262        "WIPLD" : _consts.PORT_TCP_WIPLD, 
     263        "XTEL" : _consts.PORT_TCP_XTEL, 
     264        "XTELW" : _consts.PORT_TCP_XTELW, 
     265        "SUPPORT" : _consts.PORT_TCP_SUPPORT, 
     266        "SIEVE" : _consts.PORT_TCP_SIEVE, 
     267        "CFINGER" : _consts.PORT_TCP_CFINGER, 
     268        "NDTP" : _consts.PORT_TCP_NDTP, 
     269        "FROX" : _consts.PORT_TCP_FROX, 
     270        "NINSTALL" : _consts.PORT_TCP_NINSTALL, 
     271        "ZEBRASRV" : _consts.PORT_TCP_ZEBRASRV, 
     272        "ZEBRA" : _consts.PORT_TCP_ZEBRA, 
     273        "RIPD" : _consts.PORT_TCP_RIPD, 
     274        "RIPNGD" : _consts.PORT_TCP_RIPNGD, 
     275        "OSPFD" : _consts.PORT_TCP_OSPFD, 
     276        "BGPD" : _consts.PORT_TCP_BGPD, 
     277        "OSPF6D" : _consts.PORT_TCP_OSPF6D, 
     278        "OSPFAPI" : _consts.PORT_TCP_OSPFAPI, 
     279        "ISISD" : _consts.PORT_TCP_ISISD, 
     280        "AFBACKUP" : _consts.PORT_TCP_AFBACKUP, 
     281        "AFMBACKUP" : _consts.PORT_TCP_AFMBACKUP, 
     282        "XTELL" : _consts.PORT_TCP_XTELL, 
     283        "FAX" : _consts.PORT_TCP_FAX, 
     284        "HYLAFAX" : _consts.PORT_TCP_HYLAFAX, 
     285        "DISTMP3" : _consts.PORT_TCP_DISTMP3, 
     286        "MUNIN" : _consts.PORT_TCP_MUNIN, 
     287        "CSTATD" : _consts.PORT_TCP_CSTATD, 
     288        "SSTATD" : _consts.PORT_TCP_SSTATD, 
     289        "PCRD" : _consts.PORT_TCP_PCRD, 
     290        "NOCLOG" : _consts.PORT_TCP_NOCLOG, 
     291        "HOSTMON" : _consts.PORT_TCP_HOSTMON, 
     292        "RPLAY" : _consts.PORT_TCP_RPLAY, 
     293        "RPTP" : _consts.PORT_TCP_RPTP, 
     294        "NSCA" : _consts.PORT_TCP_NSCA, 
     295        "MRTD" : _consts.PORT_TCP_MRTD, 
     296        "BGPSIM" : _consts.PORT_TCP_BGPSIM, 
     297        "CANNA" : _consts.PORT_TCP_CANNA, 
     298        "PORT" : _consts.PORT_TCP_PORT, 
     299        "IRCD" : _consts.PORT_TCP_IRCD, 
     300        "FTP" : _consts.PORT_TCP_FTP, 
     301        "WEBCACHE" : _consts.PORT_TCP_WEBCACHE, 
     302        "TPROXY" : _consts.PORT_TCP_TPROXY, 
     303        "OMNIORB" : _consts.PORT_TCP_OMNIORB, 
     304        "DAEMON" : _consts.PORT_TCP_DAEMON, 
     305        "XINETD" : _consts.PORT_TCP_XINETD, 
     306        "GIT" : _consts.PORT_TCP_GIT, 
     307        "ZOPE" : _consts.PORT_TCP_ZOPE, 
     308        "WEBMIN" : _consts.PORT_TCP_WEBMIN, 
     309        "KAMANDA" : _consts.PORT_TCP_KAMANDA, 
     310        "AMANDAIDX" : _consts.PORT_TCP_AMANDAIDX, 
     311        "AMIDXTAPE" : _consts.PORT_TCP_AMIDXTAPE, 
     312        "SMSQP" : _consts.PORT_TCP_SMSQP, 
     313        "XPILOT" : _consts.PORT_TCP_XPILOT, 
     314        "CAD" : _consts.PORT_TCP_CAD, 
     315        "ISDNLOG" : _consts.PORT_TCP_ISDNLOG, 
     316        "VBOXD" : _consts.PORT_TCP_VBOXD, 
     317        "BINKP" : _consts.PORT_TCP_BINKP, 
     318        "ASP" : _consts.PORT_TCP_ASP, 
     319        "CSYNC2" : _consts.PORT_TCP_CSYNC2, 
     320        "DIRCPROXY" : _consts.PORT_TCP_DIRCPROXY, 
     321        "TFIDO" : _consts.PORT_TCP_TFIDO, 
     322        "FIDO" : _consts.PORT_TCP_FIDO, 
    324323    } 
    325324 
    326 class HSequenceNumber(IntField): 
     325class _HSequenceNumber(_fields.IntField): 
    327326    """The sequence number of the first data octet in this segment (except 
    328327    when SYN is present). 
     
    337336        return 0 
    338337 
    339 class HAcknowledgmentNumber(IntField): 
     338class _HAcknowledgmentNumber(_fields.IntField): 
    340339    """If the ACK control bit is set this field contains the value of the 
    341340    next sequence number the sender of the segment is expecting to receive. 
     
    350349        return 1 
    351350 
    352 class HDataOffset(SpecialIntField): 
     351class _HDataOffset(_fields.SpecialIntField): 
    353352    """The number of 32 bit words in the TCP Header. This indicates where 
    354353    the data begins. 
     
    362361        return 5 + self._tmp_value / 32 # 5 is a minimum value 
    363362 
    364 class HReserved(IntField): 
     363class _HReserved(_fields.IntField): 
    365364    """Reserved for future use. 
    366365 
     
    372371        return 0 
    373372 
    374 class HWindow(IntField): 
     373class _HWindow(_fields.IntField): 
    375374    """The number of data octets beginning with the one indicated in the 
    376375    acknowledgment field which the sender of this segment is willing to accept. 
     
    385384        return 512 
    386385 
    387 class HUrgentPointer(IntField): 
     386class _HUrgentPointer(_fields.IntField): 
    388387    """This field communicates the current value of the urgent pointer as a 
    389388    positive offset from the sequence number in this segment. 
     
    398397        return 0 
    399398 
    400 class TCP(Protocol): 
     399class TCP(_protocols.Protocol): 
    401400    """This is Transmission Control Protocol. 
    402401    It the most common protocol in the Internet on fourth layer 
     
    404403    """ 
    405404    layer = 4       # layer of the OSI 
    406     protocol_id = const.PROTOCOL_TCP 
     405    protocol_id = _consts.PROTOCOL_TCP 
    407406    name = "TCP" 
    408407 
     
    416415        control_bits_predefined = dict.fromkeys(control_bits, 0) 
    417416 
    418         fields_list = [ HPort("Source Port", 0), 
    419                         HPort("Destination Port", 0), 
    420                         HSequenceNumber("Sequence Number"), 
    421                         HAcknowledgmentNumber("Acknowledgment Number"), 
    422                         HDataOffset("DataOffset"), HReserved("Reserved", 0), 
    423                         Flags("Control Bits", control_bits, 
     417        fields_list = [ _HPort("Source Port", 0), 
     418                        _HPort("Destination Port", 0), 
     419                        _HSequenceNumber("Sequence Number"), 
     420                        _HAcknowledgmentNumber("Acknowledgment Number"), 
     421                        _HDataOffset("DataOffset"), 
     422                        _HReserved("Reserved", 0), 
     423                        _fields.Flags("Control Bits", control_bits, 
    424424                        **control_bits_predefined), 
    425                         HWindow("Window"), Layer4ChecksumField("Checksum"), 
    426                         HUrgentPointer("Urgent Pointer"), Flags("Options", ()), 
    427                         PaddingField("Padding") ] 
     425                        _HWindow("Window"), 
     426                        _layer4.Layer4ChecksumField("Checksum"), 
     427                        _HUrgentPointer("Urgent Pointer"), 
     428                        _fields.Flags("Options", ()), 
     429                        _fields.PaddingField("Padding") ] 
    428430 
    429431        # we call super.__init__ after prepared necessary data 
     
    486488 
    487489            # create pseudo header object 
    488             pheader = PseudoHeader(self.protocol_id, total_length) 
     490            pheader = _layer4.PseudoHeader(self.protocol_id, total_length) 
    489491            # generate raw value of it 
    490492            pheader_raw = pheader._get_raw(protocol_container, 
     
    500502 
    501503protocols = [ TCP, ] 
     504__all__ = [ "TCP", ] 
  • branch/UMPA/umpa/protocols/UDP.py

    r3478 r3479  
    2020# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
    2121 
    22 import umpa.protocols._consts as const 
    23  
    24 from umpa.protocols._fields import * 
    25 from umpa.protocols._protocols import * 
    26 from umpa.protocols._layer4 import * 
     22from umpa.protocols import _consts 
     23from umpa.protocols import _fields 
     24from umpa.protocols import _protocols 
     25from umpa.protocols import _layer4 
    2726from umpa.utils import net 
    2827from umpa.utils import bits 
    2928 
    30 class HPort(EnumField): 
     29class _HPort(_fields.EnumField): 
    3130    bits = 16 
    3231    auto = False 
    3332    enumerable = { 
    34         "ECHO" : const.PORT_UDP_ECHO, 
    35         "DISCARD" : const.PORT_UDP_DISCARD, 
    36         "DAYTIME" : const.PORT_UDP_DAYTIME, 
    37         "MSP" : const.PORT_UDP_MSP, 
    38         "CHARGEN" : const.PORT_UDP_CHARGEN, 
    39         "FSP" : const.PORT_UDP_FSP, 
    40         "SSH" : const.PORT_UDP_SSH, 
    41         "TIME" : const.PORT_UDP_TIME, 
    42         "RLP" : const.PORT_UDP_RLP, 
    43         "TACACS" : const.PORT_UDP_TACACS, 
    44         "CK" : const.PORT_UDP_CK, 
    45         "DOMAIN" : const.PORT_UDP_DOMAIN, 
    46         "DS" : const.PORT_UDP_DS, 
    47         "BOOTPS" : const.PORT_UDP_BOOTPS, 
    48         "BOOTPC" : const.PORT_UDP_BOOTPC, 
    49         "TFTP" : const.PORT_UDP_TFTP, 
    50         "GOPHER" : const.PORT_UDP_GOPHER, 
    51         "WWW" : const.PORT_UDP_WWW, 
    52         "KERBEROS" : const.PORT_UDP_KERBEROS, 
    53         "NEMA" : const.PORT_UDP_NEMA, 
    54         "NS" : const.PORT_UDP_NS, 
    55         "RTELNET" : const.PORT_UDP_RTELNET, 
    56         "POP2" : const.PORT_UDP_POP2, 
    57         "POP3" : const.PORT_UDP_POP3, 
    58         "SUNRPC" : const.PORT_UDP_SUNRPC, 
    59         "NTP" : const.PORT_UDP_NTP, 
    60         "PWDGEN" : const.PORT_UDP_PWDGEN, 
    61         "SRV" : const.PORT_UDP_SRV, 
    62         "NS" : const.PORT_UDP_NS, 
    63         "DGM" : const.PORT_UDP_DGM, 
    64         "SSN" : const.PORT_UDP_SSN, 
    65         "IMAP2" : const.PORT_UDP_IMAP2, 
    66         "SNMP" : const.PORT_UDP_SNMP, 
    67         "TRAP" : const.PORT_UDP_TRAP, 
    68         "MAN" : const.PORT_UDP_MAN, 
    69         "AGENT" : const.PORT_UDP_AGENT, 
    70         "MAILQ" : const.PORT_UDP_MAILQ, 
    71         "XDMCP" : const.PORT_UDP_XDMCP, 
    72         "NEXTSTEP" : const.PORT_UDP_NEXTSTEP, 
    73         "BGP" : const.PORT_UDP_BGP, 
    74         "PROSPERO" : const.PORT_UDP_PROSPERO, 
    75         "IRC" : const.PORT_UDP_IRC, 
    76         "SMUX" : const.PORT_UDP_SMUX, 
    77         "RTMP" : const.PORT_UDP_RTMP, 
    78         "NBP" : const.PORT_UDP_NBP, 
    79         "ECHO" : const.PORT_UDP_ECHO, 
    80         "ZIS" : const.PORT_UDP_ZIS, 
    81         "QMTP" : const.PORT_UDP_QMTP, 
    82         "Z3950" : const.PORT_UDP_Z3950, 
    83         "IPX" : const.PORT_UDP_IPX, 
    84         "IMAP3" : const.PORT_UDP_IMAP3, 
    85         "PAWSERV" : const.PORT_UDP_PAWSERV, 
    86         "ZSERV" : const.PORT_UDP_ZSERV, 
    87         "FATSERV" : const.PORT_UDP_FATSERV, 
    88         "RPC2PORTMAP" : const.PORT_UDP_RPC2PORTMAP, 
    89         "CODAAUTH2" : const.PORT_UDP_CODAAUTH2, 
    90         "CLEARCASE" : const.PORT_UDP_CLEARCASE, 
    91         "ULISTSERV" : const.PORT_UDP_ULISTSERV, 
    92         "LDAP" : const.PORT_UDP_LDAP, 
    93         "IMSP" : const.PORT_UDP_IMSP, 
    94         "HTTPS" : const.PORT_UDP_HTTPS, 
    95         "SNPP" : const.PORT_UDP_SNPP, 
    96         "DS" : const.PORT_UDP_DS, 
    97         "KPASSWD" : const.PORT_UDP_KPASSWD, 
    98         "SAFT" : const.PORT_UDP_SAFT, 
    99         "ISAKMP" : const.PORT_UDP_ISAKMP, 
    100         "RTSP" : const.PORT_UDP_RTSP, 
    101         "NQS" : const.PORT_UDP_NQS, 
    102         "LOCAL" : const.PORT_UDP_LOCAL, 
    103         "GUI" : const.PORT_UDP_GUI, 
    104         "IND" : const.PORT_UDP_IND, 
    105         "IPP" : const.PORT_UDP_IPP, 
    106         "BIFF" : const.PORT_UDP_BIFF, 
    107         "WHO" : const.PORT_UDP_WHO, 
    108         "SYSLOG" : const.PORT_UDP_SYSLOG, 
    109         "TALK" : const.PORT_UDP_TALK, 
    110         "NTALK" : const.PORT_UDP_NTALK, 
    111         "ROUTE" : const.PORT_UDP_ROUTE, 
    112         "TIMED" : const.PORT_UDP_TIMED, 
    113         "NETWALL" : const.PORT_UDP_NETWALL, 
    114         "GDOMAP" : const.PORT_UDP_GDOMAP, 
    115         "AFPOVERTCP" : const.PORT_UDP_AFPOVERTCP, 
    116         "NNTPS" : const.PORT_UDP_NNTPS, 
    117         "SUBMISSION" : const.PORT_UDP_SUBMISSION, 
    118         "LDAPS" : const.PORT_UDP_LDAPS, 
    119         "TINC" : const.PORT_UDP_TINC, 
    120         "SILC" : const.PORT_UDP_SILC, 
    121         "WEBSTER" : const.PORT_UDP_WEBSTER, 
    122         "RSYNC" : const.PORT_UDP_RSYNC, 
    123         "TELNETS" : const.PORT_UDP_TELNETS, 
    124         "IMAPS" : const.PORT_UDP_IMAPS, 
    125         "IRCS" : const.PORT_UDP_IRCS, 
    126         "POP3S" : const.PORT_UDP_POP3S, 
    127         "SOCKS" : const.PORT_UDP_SOCKS, 
    128         "PROOFD" : const.PORT_UDP_PROOFD, 
    129         "ROOTD" : const.PORT_UDP_ROOTD, 
    130         "OPENVPN" : const.PORT_UDP_OPENVPN, 
    131         "RMIREGISTRY" : const.PORT_UDP_RMIREGISTRY, 
    132         "KAZAA" : const.PORT_UDP_KAZAA, 
    133         "NESSUS" : const.PORT_UDP_NESSUS, 
    134         "LOTUSNOTE" : const.PORT_UDP_LOTUSNOTE, 
    135         "S" : const.PORT_UDP_S, 
    136         "M" : const.PORT_UDP_M, 
    137         "INGRESLOCK" : const.PORT_UDP_INGRESLOCK, 
    138         "NP" : const.PORT_UDP_NP, 
    139         "DATAMETRICS" : const.PORT_UDP_DATAMETRICS, 
    140         "PORT" : const.PORT_UDP_PORT, 
    141         "KERMIT" : const.PORT_UDP_KERMIT, 
    142         "L2F" : const.PORT_UDP_L2F, 
    143         "RADIUS" : const.PORT_UDP_RADIUS, 
    144         "ACCT" : const.PORT_UDP_ACCT, 
    145         "MSNP" : const.PORT_UDP_MSNP, 
    146         "NFS" : const.PORT_UDP_NFS, 
    147         "SC104" : const.PORT_UDP_SC104, 
    148         "CVSPSERVER" : const.PORT_UDP_CVSPSERVER, 
    149         "VENUS" : const.PORT_UDP_VENUS, 
    150         "SE" : const.PORT_UDP_SE, 
    151         "CODASRV" : const.PORT_UDP_CODASRV, 
    152         "SE" : const.PORT_UDP_SE, 
    153         "MON" : const.PORT_UDP_MON, 
    154         "DICT" : const.PORT_UDP_DICT, 
    155         "GPSD" : const.PORT_UDP_GPSD, 
    156         "GDS_DB" : const.PORT_UDP_GDS_DB, 
    157         "ICPV2" : const.PORT_UDP_ICPV2, 
    158         "MYSQL" : const.PORT_UDP_MYSQL, 
    159         "NUT" : const.PORT_UDP_NUT, 
    160         "DISTCC" : const.PORT_UDP_DISTCC, 
    161         "DAAP" : const.PORT_UDP_DAAP, 
    162         "SVN" : const.PORT_UDP_SVN, 
    163         "SUUCP" : const.PORT_UDP_SUUCP, 
    164         "SYSRQD" : const.PORT_UDP_SYSRQD, 
    165         "IAX" : const.PORT_UDP_IAX, 
    166         "PORT" : const.PORT_UDP_PORT, 
    167         "RFE" : const.PORT_UDP_RFE, 
    168         "MMCC" : const.PORT_UDP_MMCC, 
    169         "SIP" : const.PORT_UDP_SIP, 
    170         "TLS" : const.PORT_UDP_TLS, 
    171         "AOL" : const.PORT_UDP_AOL, 
    172         "CLIENT" : const.PORT_UDP_CLIENT, 
    173         "SERVER" : const.PORT_UDP_SERVER, 
    174         "CFENGINE" : const.PORT_UDP_CFENGINE, 
    175         "MDNS" : const.PORT_UDP_MDNS, 
    176         "POSTGRESQL" : const.PORT_UDP_POSTGRESQL, 
    177         "GGZ" : const.PORT_UDP_GGZ, 
    178         "X11" : const.PORT_UDP_X11, 
    179         "1" : const.PORT_UDP_1, 
    180         "2" : const.PORT_UDP_2, 
    181         "3" : const.PORT_UDP_3, 
    182         "4" : const.PORT_UDP_4, 
    183         "5" : const.PORT_UDP_5, 
    184         "6" : const.PORT_UDP_6, 
    185         "7" : const.PORT_UDP_7, 
    186         "SVC" : const.PORT_UDP_SVC, 
    187         "RTR" : const.PORT_UDP_RTR, 
    188         "SGE_QMASTER" : const.PORT_UDP_SGE_QMASTER, 
    189         "SGE_EXECD" : const.PORT_UDP_SGE_EXECD, 
    190         "FILESERVER" : const.PORT_UDP_FILESERVER, 
    191         "CALLBACK" : const.PORT_UDP_CALLBACK, 
    192         "PRSERVER" : const.PORT_UDP_PRSERVER, 
    193         "VLSERVER" : const.PORT_UDP_VLSERVER, 
    194         "KASERVER" : const.PORT_UDP_KASERVER, 
    195         "VOLSER" : const.PORT_UDP_VOLSER, 
    196         "ERRORS" : const.PORT_UDP_ERRORS, 
    197         "BOS" : const.PORT_UDP_BOS, 
    198         "UPDATE" : const.PORT_UDP_UPDATE, 
    199         "RMTSYS" : const.PORT_UDP_RMTSYS, 
    200         "SERVICE" : const.PORT_UDP_SERVICE, 
    201         "DIR" : const.PORT_UDP_DIR, 
    202         "FD" : const.PORT_UDP_FD, 
    203         "SD" : const.PORT_UDP_SD, 
    204         "AMANDA" : const.PORT_UDP_AMANDA, 
    205         "HKP" : const.PORT_UDP_HKP, 
    206         "BPRD" : const.PORT_UDP_BPRD, 
    207         "BPDBM" : const.PORT_UDP_BPDBM, 
    208         "MSVC" : const.PORT_UDP_MSVC, 
    209         "VNETD" : const.PORT_UDP_VNETD, 
    210         "BPCD" : const.PORT_UDP_BPCD, 
    211         "VOPIED" : const.PORT_UDP_VOPIED, 
    212         "WNN6" : const.PORT_UDP_WNN6, 
    213         "KERBEROS4" : const.PORT_UDP_KERBEROS4, 
    214         "KERBEROS_MASTER" : const.PORT_UDP_KERBEROS_MASTER, 
    215         "PASSWD_SERVER" : const.PORT_UDP_PASSWD_SERVER, 
    216         "SRV" : const.PORT_UDP_SRV, 
    217         "CLT" : const.PORT_UDP_CLT, 
    218         "HM" : const.PORT_UDP_HM, 
    219         "POPPASSD" : const.PORT_UDP_POPPASSD, 
    220         "MOIRA_UREG" : const.PORT_UDP_MOIRA_UREG, 
    221         "OMIRR" : const.PORT_UDP_OMIRR, 
    222         "CUSTOMS" : const.PORT_UDP_CUSTOMS, 
    223         "PREDICT" : const.PORT_UDP_PREDICT, 
    224         "NINSTALL" : const.PORT_UDP_NINSTALL, 
    225         "AFBACKUP" : const.PORT_UDP_AFBACKUP, 
    226         "AFMBACKUP" : const.PORT_UDP_AFMBACKUP, 
    227         "NOCLOG" : const.PORT_UDP_NOCLOG, 
    228         "HOSTMON" : const.PORT_UDP_HOSTMON, 
    229         "RPLAY" : const.PORT_UDP_RPLAY, 
    230         "RPTP" : const.PORT_UDP_RPTP, 
    231         "OMNIORB" : const.PORT_UDP_OMNIORB, 
    232         "MANDELSPAWN" : const.PORT_UDP_MANDELSPAWN, 
    233         "KAMANDA" : const.PORT_UDP_KAMANDA, 
    234         "SMSQP" : const.PORT_UDP_SMSQP, 
    235         "XPILOT" : const.PORT_UDP_XPILOT, 
    236         "CMSD" : const.PORT_UDP_CMSD, 
    237         "CRSD" : const.PORT_UDP_CRSD, 
    238         "GCD" : const.PORT_UDP_GCD, 
    239         "ISDNLOG" : const.PORT_UDP_ISDNLOG, 
    240         "VBOXD" : const.PORT_UDP_VBOXD, 
    241         "ASP" : const.PORT_UDP_ASP 
     33        "ECHO" : _consts.PORT_UDP_ECHO, 
     34        "DISCARD" : _consts.PORT_UDP_DISCARD, 
     35        "DAYTIME" : _consts.PORT_UDP_DAYTIME, 
     36        "MSP" : _consts.PORT_UDP_MSP, 
     37        "CHARGEN" : _consts.PORT_UDP_CHARGEN, 
     38        "FSP" : _consts.PORT_UDP_FSP, 
     39        "SSH" : _consts.PORT_UDP_SSH, 
     40        "TIME" : _consts.PORT_UDP_TIME, 
     41        "RLP" : _consts.PORT_UDP_RLP, 
     42        "TACACS" : _consts.PORT_UDP_TACACS, 
     43        "CK" : _consts.PORT_UDP_CK, 
     44        "DOMAIN" : _consts.PORT_UDP_DOMAIN, 
     45        "DS" : _consts.PORT_UDP_DS, 
     46        "BOOTPS" : _consts.PORT_UDP_BOOTPS, 
     47        "BOOTPC" : _consts.PORT_UDP_BOOTPC, 
     48        "TFTP" : _consts.PORT_UDP_TFTP, 
     49        "GOPHER" : _consts.PORT_UDP_GOPHER, 
     50        "WWW" : _consts.PORT_UDP_WWW, 
     51        "KERBEROS" : _consts.PORT_UDP_KERBEROS, 
     52        "NEMA" : _consts.PORT_UDP_NEMA, 
     53        "NS" : _consts.PORT_UDP_NS, 
     54        "RTELNET" : _consts.PORT_UDP_RTELNET, 
     55        "POP2" : _consts.PORT_UDP_POP2, 
     56        "POP3" : _consts.PORT_UDP_POP3, 
     57        "SUNRPC" : _consts.PORT_UDP_SUNRPC, 
     58        "NTP" : _consts.PORT_UDP_NTP, 
     59        "PWDGEN" : _consts.PORT_UDP_PWDGEN, 
     60        "SRV" : _consts.PORT_UDP_SRV, 
     61        "NS" : _consts.PORT_UDP_NS, 
     62        "DGM" : _consts.PORT_UDP_DGM, 
     63        "SSN" : _consts.PORT_UDP_SSN, 
     64        "IMAP2" : _consts.PORT_UDP_IMAP2, 
     65        "SNMP" : _consts.PORT_UDP_SNMP, 
     66        "TRAP" : _consts.PORT_UDP_TRAP, 
     67        "MAN" : _consts.PORT_UDP_MAN, 
     68        "AGENT" : _consts.PORT_UDP_AGENT, 
     69        "MAILQ" : _consts.PORT_UDP_MAILQ, 
     70        "XDMCP" : _consts.PORT_UDP_XDMCP, 
     71        "NEXTSTEP" : _consts.PORT_UDP_NEXTSTEP, 
     72        "BGP" : _consts.PORT_UDP_BGP, 
     73        "PROSPERO" : _consts.PORT_UDP_PROSPERO, 
     74        "IRC" : _consts.PORT_UDP_IRC, 
     75        "SMUX" : _consts.PORT_UDP_SMUX, 
     76        "RTMP" : _consts.PORT_UDP_RTMP, 
     77        "NBP" : _consts.PORT_UDP_NBP, 
     78        "ECHO" : _consts.PORT_UDP_ECHO, 
     79        "ZIS" : _consts.PORT_UDP_ZIS, 
     80        "QMTP" : _consts.PORT_UDP_QMTP, 
     81        "Z3950" : _consts.PORT_UDP_Z3950, 
     82        "IPX" : _consts.PORT_UDP_IPX, 
     83        "IMAP3" : _consts.PORT_UDP_IMAP3, 
     84        "PAWSERV" : _consts.PORT_UDP_PAWSERV, 
     85        "ZSERV" : _consts.PORT_UDP_ZSERV, 
     86        "FATSERV" : _consts.PORT_UDP_FATSERV, 
     87        "RPC2PORTMAP" : _consts.PORT_UDP_RPC2PORTMAP, 
     88        "CODAAUTH2" : _consts.PORT_UDP_CODAAUTH2, 
     89        "CLEARCASE" : _consts.PORT_UDP_CLEARCASE, 
     90        "ULISTSERV" : _consts.PORT_UDP_ULISTSERV, 
     91        "LDAP" : _consts.PORT_UDP_LDAP, 
     92        "IMSP" : _consts.PORT_UDP_IMSP, 
     93        "HTTPS" : _consts.PORT_UDP_HTTPS, 
     94        "SNPP" : _consts.PORT_UDP_SNPP, 
     95        "DS" : _consts.PORT_UDP_DS, 
     96        "KPASSWD" : _consts.PORT_UDP_KPASSWD, 
     97        "SAFT" : _consts.PORT_UDP_SAFT, 
     98        "ISAKMP" : _consts.PORT_UDP_ISAKMP, 
     99        "RTSP" : _consts.PORT_UDP_RTSP, 
     100        "NQS" : _consts.PORT_UDP_NQS, 
     101        "LOCAL" : _consts.PORT_UDP_LOCAL, 
     102        "GUI" : _consts.PORT_UDP_GUI, 
     103        "IND" : _consts.PORT_UDP_IND, 
     104        "IPP" : _consts.PORT_UDP_IPP, 
     105        "BIFF" : _consts.PORT_UDP_BIFF, 
     106        "WHO" : _consts.PORT_UDP_WHO, 
     107        "SYSLOG" : _consts.PORT_UDP_SYSLOG, 
     108        "TALK" : _consts.PORT_UDP_TALK, 
     109        "NTALK" : _consts.PORT_UDP_NTALK, 
     110        "ROUTE" : _consts.PORT_UDP_ROUTE, 
     111        "TIMED" : _consts.PORT_UDP_TIMED, 
     112        "NETWALL" : _consts.PORT_UDP_NETWALL, 
     113        "GDOMAP" : _consts.PORT_UDP_GDOMAP, 
     114        "AFPOVERTCP" : _consts.PORT_UDP_AFPOVERTCP, 
     115        "NNTPS" : _consts.PORT_UDP_NNTPS, 
     116        "SUBMISSION" : _consts.PORT_UDP_SUBMISSION, 
     117        "LDAPS" : _consts.PORT_UDP_LDAPS, 
     118        "TINC" : _consts.PORT_UDP_TINC, 
     119        "SILC" : _consts.PORT_UDP_SILC, 
     120        "WEBSTER" : _consts.PORT_UDP_WEBSTER, 
     121        "RSYNC" : _consts.PORT_UDP_RSYNC, 
     122        "TELNETS" : _consts.PORT_UDP_TELNETS, 
     123        "IMAPS" : _consts.PORT_UDP_IMAPS, 
     124        "IRCS" : _consts.PORT_UDP_IRCS, 
     125        "POP3S" : _consts.PORT_UDP_POP3S, 
     126        "SOCKS" : _consts.PORT_UDP_SOCKS, 
     127        "PROOFD" : _consts.PORT_UDP_PROOFD, 
     128        "ROOTD" : _consts.PORT_UDP_ROOTD, 
     129        "OPENVPN" : _consts.PORT_UDP_OPENVPN, 
     130        "RMIREGISTRY" : _consts.PORT_UDP_RMIREGISTRY, 
     131        "KAZAA" : _consts.PORT_UDP_KAZAA, 
     132        "NESSUS" : _consts.PORT_UDP_NESSUS, 
     133        "LOTUSNOTE" : _consts.PORT_UDP_LOTUSNOTE, 
     134        "S" : _consts.PORT_UDP_S, 
     135        "M" : _consts.PORT_UDP_M, 
     136        "INGRESLOCK" : _consts.PORT_UDP_INGRESLOCK, 
     137        "NP" : _consts.PORT_UDP_NP, 
     138        "DATAMETRICS" : _consts.PORT_UDP_DATAMETRICS, 
     139        "PORT" : _consts.PORT_UDP_PORT, 
     140        "KERMIT" : _consts.PORT_UDP_KERMIT, 
     141        "L2F" : _consts.PORT_UDP_L2F, 
     142        "RADIUS" : _consts.PORT_UDP_RADIUS, 
     143        "ACCT" : _consts.PORT_UDP_ACCT, 
     144        "MSNP" : _consts.PORT_UDP_MSNP, 
     145        "NFS" : _consts.PORT_UDP_NFS, 
     146        "SC104" : _consts.PORT_UDP_SC104, 
     147        "CVSPSERVER" : _consts.PORT_UDP_CVSPSERVER, 
     148        "VENUS" : _consts.PORT_UDP_VENUS, 
     149        "SE" : _consts.PORT_UDP_SE, 
     150        "CODASRV" : _consts.PORT_UDP_CODASRV, 
     151        "SE" : _consts.PORT_UDP_SE, 
     152        "MON" : _consts.PORT_UDP_MON, 
     153        "DICT" : _consts.PORT_UDP_DICT, 
     154        "GPSD" : _consts.PORT_UDP_GPSD, 
     155        "GDS_DB" : _consts.PORT_UDP_GDS_DB, 
     156        "ICPV2" : _consts.PORT_UDP_ICPV2, 
     157        "MYSQL" : _consts.PORT_UDP_MYSQL, 
     158        "NUT" : _consts.PORT_UDP_NUT, 
     159        "DISTCC" : _consts.PORT_UDP_DISTCC, 
     160        "DAAP" : _consts.PORT_UDP_DAAP, 
     161        "SVN" : _consts.PORT_UDP_SVN, 
     162        "SUUCP" : _consts.PORT_UDP_SUUCP, 
     163        "SYSRQD" : _consts.PORT_UDP_SYSRQD, 
     164        "IAX" : _consts.PORT_UDP_IAX, 
     165        "PORT" : _consts.PORT_UDP_PORT, 
     166        "RFE" : _consts.PORT_UDP_RFE, 
     167        "MMCC" : _consts.PORT_UDP_MMCC, 
     168        "SIP" : _consts.PORT_UDP_SIP, 
     169        "TLS" : _consts.PORT_UDP_TLS, 
     170        "AOL" : _consts.PORT_UDP_AOL, 
     171        "CLIENT" : _consts.PORT_UDP_CLIENT, 
     172        "SERVER" : _consts.PORT_UDP_SERVER, 
     173        "CFENGINE" : _consts.PORT_UDP_CFENGINE, 
     174        "MDNS" : _consts.PORT_UDP_MDNS, 
     175        "POSTGRESQL" : _consts.PORT_UDP_POSTGRESQL, 
     176        "GGZ" : _consts.PORT_UDP_GGZ, 
     177        "X11" : _consts.PORT_UDP_X11, 
     178        "1" : _consts.PORT_UDP_1, 
     179        "2" : _consts.PORT_UDP_2, 
     180        "3" : _consts.PORT_UDP_3, 
     181        "4" : _consts.PORT_UDP_4, 
     182        "5" : _consts.PORT_UDP_5, 
     183        "6" : _consts.PORT_UDP_6, 
     184        "7" : _consts.PORT_UDP_7, 
     185        "SVC" : _consts.PORT_UDP_SVC, 
     186        "RTR" : _consts.PORT_UDP_RTR, 
     187        "SGE_QMASTER" : _consts.PORT_UDP_SGE_QMASTER, 
     188        "SGE_EXECD" : _consts.PORT_UDP_SGE_EXECD, 
     189        "FILESERVER" : _consts.PORT_UDP_FILESERVER, 
     190        "CALLBACK" : _consts.PORT_UDP_CALLBACK, 
     191        "PRSERVER" : _consts.PORT_UDP_PRSERVER, 
     192        "VLSERVER" : _consts.PORT_UDP_VLSERVER, 
     193        "KASERVER" : _consts.PORT_UDP_KASERVER, 
     194        "VOLSER" : _consts.PORT_UDP_VOLSER, 
     195        "ERRORS" : _consts.PORT_UDP_ERRORS, 
     196        "BOS" : _consts.PORT_UDP_BOS, 
     197        "UPDATE" : _consts.PORT_UDP_UPDATE, 
     198        "RMTSYS" : _consts.PORT_UDP_RMTSYS, 
     199        "SERVICE" : _consts.PORT_UDP_SERVICE, 
     200        "DIR" : _consts.PORT_UDP_DIR, 
     201        "FD" : _consts.PORT_UDP_FD, 
     202        "SD" : _consts.PORT_UDP_SD, 
     203        "AMANDA" : _consts.PORT_UDP_AMANDA, 
     204        "HKP" : _consts.PORT_UDP_HKP, 
     205        "BPRD" : _consts.PORT_UDP_BPRD, 
     206        "BPDBM" : _consts.PORT_UDP_BPDBM, 
     207        "MSVC" : _consts.PORT_UDP_MSVC, 
     208        "VNETD" : _consts.PORT_UDP_VNETD, 
     209        "BPCD" : _consts.PORT_UDP_BPCD, 
     210        "VOPIED" : _consts.PORT_UDP_VOPIED, 
     211        "WNN6" : _consts.PORT_UDP_WNN6, 
     212        "KERBEROS4" : _consts.PORT_UDP_KERBEROS4, 
     213        "KERBEROS_MASTER" : _consts.PORT_UDP_KERBEROS_MASTER, 
     214        "PASSWD_SERVER" : _consts.PORT_UDP_PASSWD_SERVER, 
     215        "SRV" : _consts.PORT_UDP_SRV, 
     216        "CLT" : _consts.PORT_UDP_CLT, 
     217        "HM" : _consts.PORT_UDP_HM, 
     218        "POPPASSD" : _consts.PORT_UDP_POPPASSD, 
     219        "MOIRA_UREG" : _consts.PORT_UDP_MOIRA_UREG, 
     220        "OMIRR" : _consts.PORT_UDP_OMIRR, 
     221        "CUSTOMS" : _consts.PORT_UDP_CUSTOMS, 
     222        "PREDICT" : _consts.PORT_UDP_PREDICT, 
     223        "NINSTALL" : _consts.PORT_UDP_NINSTALL, 
     224        "AFBACKUP" : _consts.PORT_UDP_AFBACKUP, 
     225        "AFMBACKUP" : _consts.PORT_UDP_AFMBACKUP, 
     226        "NOCLOG" : _consts.PORT_UDP_NOCLOG, 
     227        "HOSTMON" : _consts.PORT_UDP_HOSTMON, 
     228        "RPLAY" : _consts.PORT_UDP_RPLAY, 
     229        "RPTP" : _consts.PORT_UDP_RPTP, 
     230        "OMNIORB" : _consts.PORT_UDP_OMNIORB, 
     231        "MANDELSPAWN" : _consts.PORT_UDP_MANDELSPAWN, 
     232        "KAMANDA" : _consts.PORT_UDP_KAMANDA, 
     233        "SMSQP" : _consts.PORT_UDP_SMSQP, 
     234        "XPILOT" : _consts.PORT_UDP_XPILOT, 
     235        "CMSD" : _consts.PORT_UDP_CMSD, 
     236        "CRSD" : _consts.PORT_UDP_CRSD, 
     237        "GCD" : _consts.PORT_UDP_GCD, 
     238        "ISDNLOG" : _consts.PORT_UDP_ISDNLOG, 
     239        "VBOXD" : _consts.PORT_UDP_VBOXD, 
     240        "ASP" : _consts.PORT_UDP_ASP 
    242241    } 
    243242 
    244 class HLength(SpecialIntField): 
     243class _HLength(_fields.SpecialIntField): 
    245244    """Length  is the length  in octets  of this user datagram  including  this 
    246245    header  and the data. 
     
    252251        return 8 + self._tmp_value/8    # minimum is 8 
    253252 
    254 class UDP(Protocol): 
     253class UDP(_protocols.Protocol): 
    255254    """This is User Datagram Protocol. 
    256255     
     
    261260    """ 
    262261    layer = 4 
    263     protocol_id = const.PROTOCOL_UDP 
     262    protocol_id = _consts.PROTOCOL_UDP 
    264263    name = "UDP" 
    265264 
     
    268267 
    269268    def __init__(self, **kw): 
    270         fields_list = [ HPort("Source Port", 0), 
    271                         HPort("Destination Port", 0), 
    272                         HLength("Length"), 
    273                         Layer4ChecksumField("Checksum"), ] 
     269        fields_list = [ _HPort("Source Port", 0), 
     270                        _HPort("Destination Port", 0), 
     271                        _HLength("Length"), 
     272                        _layer4.Layer4ChecksumField("Checksum"), ] 
    274273 
    275274        # we call super.__init__ after prepared necessary data 
     
    310309            # 
    311310            # create pseudo header object 
    312             pheader = PseudoHeader(self.protocol_id, 
     311            pheader = _layer4.PseudoHeader(self.protocol_id, 
    313312                                        self._get_field('_length').fillout()) 
    314313            # generate raw value of it 
     
    325324 
    326325protocols = [ UDP, ] 
     326__all__ = [ "UDP", ]