⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 internetstandards.cpp

📁 发送邮件
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*=========================================================================== 
    (c) Copyright 2001, Emmanuel KARTMANN, all rights reserved
  =========================================================================== 
    File           : InternetStandards.h
    $Header: $
    Author         : Emmanuel KARTMANN <emmanuel@kartmann.org>
    Creation       : Friday 10/27/01 11:56:35 PM
    Remake         : 
  ------------------------------- Description ------------------------------- 

           Implementation of the CInternetStandards class.

  ------------------------------ Modifications ------------------------------ 
    $Log: $  
  =========================================================================== 
*/

#include "stdafx.h"
#include "InternetStandards.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CInternetStandards::CInternetStandards()
{

}

CInternetStandards::~CInternetStandards()
{

}

CString CInternetStandards::GetProtocolNameFromID(UCHAR chProtocol)
{
    CString szProtocolName = "Unknown";

    // This switch is built based on RFC 1010 - Assigned Numbers Protocol Numbers
    switch(chProtocol) {
    case 0:
        szProtocolName = "Reserved"; // Reserved
        break;
    case 1:
        szProtocolName = "ICMP"; // Internet Control Message
        break;
    case 2:
        szProtocolName = "IGMP"; // Internet Group Management
        break;
    case 3:
        szProtocolName = "GGP"; // Gateway-to-Gateway
        break;
    case 5:
        szProtocolName = "ST"; // Stream
        break;
    case 6:
        szProtocolName = "TCP"; // Transmission Control
        break;
    case 7:
        szProtocolName = "UCL"; // UCL
        break;
    case 8:
        szProtocolName = "EGP"; // Exterior Gateway Protocol
        break;
    case 9:
        szProtocolName = "IGP"; // any private interior gateway
        break;
    case 10:
        szProtocolName = "BBN-RCC-MON"; // BBN RCC Monitoring
        break;
    case 11:
        szProtocolName = "NVP-II"; // Network Voice Protocol
        break;
    case 12:
        szProtocolName = "PUP"; // PUP
        break;
    case 13:
        szProtocolName = "ARGUS"; // ARGUS
        break;
    case 14:
        szProtocolName = "EMCON"; // EMCON
        break;
    case 15:
        szProtocolName = "XNET"; // Cross Net Debugger
        break;
    case 16:
        szProtocolName = "CHAOS"; // Chaos
        break;
    case 17:
        szProtocolName = "UDP"; // User Datagram
        break;
    case 18:
        szProtocolName = "MUX"; // Multiplexing
        break;
    case 19:
        szProtocolName = "DCN-MEAS"; // DCN Measurement Subsystems
        break;
    case 20:
        szProtocolName = "HMP"; // Host Monitoring
        break;
    case 21:
        szProtocolName = "PRM"; // Packet Radio Measurement
        break;
    case 22:
        szProtocolName = "XNS-IDP"; // XEROX NS IDP
        break;
    case 23:
        szProtocolName = "TRUNK-1"; // Trunk-1
        break;
    case 24:
        szProtocolName = "TRUNK-2"; // Trunk-2
        break;
    case 25:
        szProtocolName = "LEAF-1"; // Leaf-1
        break;
    case 26:
        szProtocolName = "LEAF-2"; // Leaf-2
        break;
    case 27:
        szProtocolName = "RDP"; // Reliable Data Protocol
        break;
    case 28:
        szProtocolName = "IRTP"; // Internet Reliable Transaction
        break;
    case 29:
        szProtocolName = "ISO-TP4"; // ISO Transport Protocol Class 4
        break;
    case 30:
        szProtocolName = "NETBLT"; // Bulk Data Transfer Protocol
        break;
    case 31:
        szProtocolName = "MFE-NSP"; // MFE Network Services Protocol
        break;
    case 32:
        szProtocolName = "MERIT-INP"; // MERIT Internodal Protocol
        break;
    case 33:
        szProtocolName = "SEP"; // Sequential Exchange Protocol
        break;
    case 61:
        szProtocolName = "ANYHOST"; // any host internal protocol
        break;
    case 62:
        szProtocolName = "CFTP"; // CFTP
        break;
    case 63:
        szProtocolName = "ANYLAN"; // any local network
        break;
    case 64:
        szProtocolName = "SAT-EXPAK"; // SATNET and Backroom EXPAK
        break;
    case 65:
        szProtocolName = "MIT-SUBNET"; // MIT Subnet Support
        break;
    case 66:
        szProtocolName = "RVD"; // MIT Remote Virtual Disk Protocol
        break;
    case 67:
        szProtocolName = "IPPC"; // Internet Pluribus Packet Core
        break;
    case 68:
        szProtocolName = "ANYDFS"; // any distributed file system
        break;
    case 69:
        szProtocolName = "SAT-MON"; // SATNET Monitoring
        break;
    case 71:
        szProtocolName = "IPCV"; // Internet Packet Core Utility
        break;
    case 76:
        szProtocolName = "BR-SAT-MON"; // Backroom SATNET Monitoring
        break;
    case 78:
        szProtocolName = "WB-MON"; // WIDEBAND Monitoring
        break;
    case 79:
        szProtocolName = "WB-EXPAK"; // WIDEBAND EXPAK
        break;
    case 255:
        szProtocolName = "Reserved"; // Reserved
        break;
    case 4:
    case 70:
    case 77:
        szProtocolName = "Unassigned"; // Unassigned
        break;

    default:
        if ((chProtocol >=34 && chProtocol<=60) || 
            (chProtocol >=72 && chProtocol<=75) || 
            (chProtocol >=80 && chProtocol<=254)) {
            szProtocolName = "Unassigned"; // Unassigned
        } else {
            szProtocolName = "Unknown";
        }
        break;
    }

    return(szProtocolName);
}

int CInternetStandards::GetResourceTypeFromString(LPCTSTR lpszResourceType)
{
    CString szResourceType = lpszResourceType;

    if (szResourceType == "TYPE_A" || 
        szResourceType == "T_A" || 
        szResourceType == "A") {
        // host address
        return(DNS_TYPE_A);
    }

    if (szResourceType == "TYPE_NS" || 
        szResourceType == "T_NS" || 
        szResourceType == "NS") {
        // authoritative server
        return(DNS_TYPE_NS);
    }

    if (szResourceType == "TYPE_MD" ||
        szResourceType == "T_MD" ||
        szResourceType == "MD") {
        // mail destination
        return(DNS_TYPE_MD);
    }

    if (szResourceType == "TYPE_MF" ||
        szResourceType == "T_MF" ||
        szResourceType == "MF") {
        // mail forwarder
        return(DNS_TYPE_MF);
    }

    if (szResourceType == "TYPE_CNAME" ||
        szResourceType == "T_CNAME" ||
        szResourceType == "CNAME") {
        // canonical name
        return(DNS_TYPE_CNAME);
    }

    if (szResourceType == "TYPE_SOA" ||
        szResourceType == "T_SOA" ||
        szResourceType == "SOA") {
        // start of authority zone
        return(DNS_TYPE_SOA);
    }

    if (szResourceType == "TYPE_MB" ||
        szResourceType == "T_MB" ||
        szResourceType == "MB") {
        // mailbox domain name
        return(DNS_TYPE_MB);
    }

    if (szResourceType == "TYPE_MG" ||
        szResourceType == "T_MG" ||
        szResourceType == "MG") {
        // mail group member
        return(DNS_TYPE_MG);
    }

    if (szResourceType == "TYPE_MR" ||
        szResourceType == "T_MR" ||
        szResourceType == "MR") {
        // mail rename name
        return(DNS_TYPE_MR);
    }

    if (szResourceType == "TYPE_NULL" ||
        szResourceType == "T_NULL" ||
        szResourceType == "NULL") {
        // null resource record
        return(DNS_TYPE_NULL);
    }

    if (szResourceType == "TYPE_WKS" ||
        szResourceType == "T_WKS" ||
        szResourceType == "WKS") {
        // well known service
        return(DNS_TYPE_WKS);
    }

    if (szResourceType == "TYPE_PTR" ||
        szResourceType == "T_PTR" ||
        szResourceType == "PTR") {
        // domain name pointer
        return(DNS_TYPE_PTR);
    }

    if (szResourceType == "TYPE_HINFO" ||
        szResourceType == "T_HINFO" ||
        szResourceType == "HINFO") {
        // host information
        return(DNS_TYPE_HINFO);
    }

    if (szResourceType == "TYPE_MINFO" ||
        szResourceType == "T_MINFO" ||
        szResourceType == "MINFO") {
        // mailbox information
        return(DNS_TYPE_MINFO);
    }

    if (szResourceType == "TYPE_MX" ||
        szResourceType == "T_MX" ||
        szResourceType == "MX") {
        // mail routing information
        return(DNS_TYPE_MX);
    }

    if (szResourceType == "TYPE_TEXT" ||
        szResourceType == "T_TEXT" ||
        szResourceType == "TEXT") {
        // text strings

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -