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

📄 dns.module

📁 DNS 的实现代码
💻 MODULE
📖 第 1 页 / 共 2 页
字号:
% ############################################################################
% (c) Copyright Virata Limited 2001, 2002
%
% Virata Limited Confidential and Proprietary
%
% The following software source code ("Software") is strictly confidential and
% is proprietary to Virata Limited ("Virata").  It may only be read, used,
% copied, adapted, modified or otherwise dealt with by you if you have
% entered into a confidentiality agreement with Virata and then subject to the
% terms of that confidentiality agreement and any other applicable agreement
% between you and Virata.  If you are in any doubt as to whether you are
% entitled to access, read, use, copy, adapt, modify or otherwise deal with
% the Software or whether you are entitled to disclose the Software to any
% other person you should contact Virata.  If you have not entered into a
% confidentiality agreement with Virata granting access to this Software you
% should forthwith return all media, copies and printed listings containing
% the Software to Virata.
%
% Virata reserves the right to take legal action against you should you breach
% the above provisions.
%
% If you are unsure, or to report violations, please contact
% support@virata.com
% ############################################################################
${gcc_warnings_are_errors}
If !__dns_module__

    set __dns_module__

    % ATMOS DNS module
    % Included via use of "set" directives in system file
    %          set DNS_RELAY for relay support
    % prior to "Package dns" declaration

    Make.cc dns_client_packet
    Make.cc dns_client_resource

    % Define MessageId range
    MessageId 0x00012900

    If dns_relay



	% This sets a global param by name DNS_QUERY_RESPONCE_TABLE_SIZE in config.h
	% This param can be used to govern the size of query responce table 
	% supported by the system.
	If num_of_dns_query_responce_table_entries
	% set the number of PPP sessions
		Config.h DNS_QUERY_RESPONCE_TABLE_SIZE ${num_of_dns_query_responce_table_entries}
	Else
		Config.h DNS_QUERY_RESPONCE_TABLE_SIZE 256
	Endif

        Config.h DNSRELAY_QUEUE_NAME  "dnsrelay"
        Config.h use_landb_support

        %------------------------------------------------------
        % DNS Relay Version 2.02
        %
        % DNS Relay now has VMI support for the DNS relay local
        % LAN database, and has added a configurable local FDQN
        % facility in addition to the compile-time #define for
        % specifying the DNS relay's local name.
        %------------------------------------------------------
        
        % DNS Relay Version 2.00
        % DNS Relay now supports primary and secondary DNS
        % server addresses, and uses a Linux-style algorithm
        % to choose between them.
        
        % DNS Relay Version 1.02
        % DNS Relay now functional on both ATMOS and VxWorks
        % platforms.
        
        % DNS Relay Version 1.01
        % DNS Relay implementation completed.
     
        % DNS Relay Version 1.00
        % First cut of ATMOS DNS incorporating just a DNS relay.

        % debug define for use in debugging the lan database

        Config dns.h DNS_LAN_DEBUG

        Config.hs DNS_RELAY
        Config.hs DNS_NAMEMAX  128

If dnsrelay_v6 
	If ipstack_ipv6
		Set dnsrelay_mapi_v6
        Config.hs DNS_V6_FWDR
	Endif
Endif

        %  DNS relay enhancements for TR-068  

         If option_tr68
            Config.hs DNS_ENHANCE_TR68
         Endif 



        % Requests for the following name will be intercepted by the relay.
        % It will send back the device's own IP address in the response.
        % It *must* contain at least one '.' in order to function with 
        % windows.  you need the trailing dot.
        allow moduleconfig
        Config dns.h DNS_LOCAL_NAME "local.gateway."


        % DNS relay cache define.  uncomment this if you want
        % the cache to be a linked list instead of a hash table.
        %
        % Config.hs DNS_RELAY_LL_CACHE

        % DNS relay defines for the relay's cache.  pool size is the total 
        % number of available cache entries.  DNS_RELAY_CACHE is the size
        % of the cache hash table if used.  the no hit period is used to 
        % time out cache entries that have not been used for a while. this
        % comes into play when all the cache entries are used and the
        % normal time out does not free up any entries.

        Config.h DNS_CACHE_POOLSIZE             10     /* max number of entries */
        Config.h DNS_RELAY_CACHE                97     /* hash table size, prime */
        Config.h DNS_RELAY_CACHE_NOHIT_PERIOD  (10*60) /* 10 minutes */

        % DNS relay lan database define.  uncomment this if you prefer
        % the database to be a linked list instead of a hash table.
        %
        % Config.hs DNS_RELAY_LL_DB

        % DNS relay defines for the relay's database.  the max lan entry and
        % IP entry do not limit the size of the database.  they are the size
        % of the hash tables if used (there's no need for the tables to be
        % bigger than the number of entries you have).  you may want to
        % experiment to find a good destribution.  the time to live value is
        % what will be used as the time to live for the resource records of
        % the dns replies.

        Config.h DNS_LANENTRYMAX      51  /* size of the host databsae hash table */
        Config.h DNS_LANIPMAX         71  /* size of the IP database hash table */
        Config.h DNS_LANDB_STDTTL  28800  /* standard time to live for DB entries */

        Config dns.h DNS_MAXALIAS   5  /* max number of aliases a host can have */
        Config dns.h DNS_MAXIPADDR  5  /* max number of IP addresses for one host */

        Export Header dns_relay.h

        % tokens used in the lan database config file.
        
        Config dns.h DR_DNAME    "domain_name"  /* flags the domain name */
        Config dns.h DR_LANIP    "lan_address"  /* flags the IP address of the local lan */
        Config dns.h DR_LANMASK  "lan_mask"     /* flags the mask for the lan subnet */
        Config dns.h DR_HOSTNAME "host_name"    /* domain and start of information for it */
        Config dns.h DR_ALIAS    "alias"        /* flags an alias for the host name */
        Config dns.h DR_ADDRESS  "address"      /* flags an IP address for host name */

        Make.cc dns_relay_${os}
        Make.cc dns_relay_engine
        Make.cc dns_trace
        Make.cc dns_relay_lib
        Make.cc dns_relay_cache
        Make.cc dns_relay_ext
        Make.cc dns_relay_localrr
        Make.cc dns_relay_landb
        Make.c++ dns_relay_process   
        % (C++ only needed for ConfigSaver class (VxWorks))

        If !platform_atmos
            Export slibrary dnsrelay.o
            Export Header dns_relay_vxworks.h
            Make.cat dnsrelay.o dns_relay_process.o dns_relay_${os}.o dns_relay_engine.o dns_trace.o dns_relay_lib.o dns_relay_localrr.o 
        Else
            % API library (e.g. for systems without a standard console)
            if make_apis
                set api     = dnsRelayLib
                set apisrvr = dns
                set ${api}_ = `${apigen} -p ${api} ${atmosroot}/${apisrvr}/${api}.spec`
                module ${api}
            endif

			Export sLibrary dns_relay_ext.o
           
       % if use_landb_support
        %     set landb_objs = dns_relay_landb.o dns_relay_localrr.o
        %Else
         %    set landb_objs = 
	%endif

            Make.cat dnsrelay.o dns_relay_process.o dns_relay_${os}.o dns_relay_engine.o dns_trace.o dns_relay_lib.o dns_relay_landb.o  dns_relay_cache.o dns_relay_localrr.o  dns_client_resource.o dns_client_packet.o ../llibc/llibc.o

            If option_tr68
            Object dnsrelay.o
           {
                Executable dnsrelay stack 5120 prologue dns_relay_prologue 
           }
            Else
            Object dnsrelay.o
           {
                Executable dnsrelay stack 4608 prologue dns_relay_prologue 
           }	
            
            Endif
            Process dnsrelay is dns/dnsrelay
        Endif

        if mapi
            module dns_relay_mapi from dns/mapi
        endif

        % note that host names and aliases should be complete domain names

        Message DNS_RELAY_INSERT_LANHOST
        {
            struct dns_host *dhost;  /* lan database host information (see dns_relay.h) */
            int             error;   /* error return value */
        }

        Message DNS_RELAY_DELETE_LANHOST
        {
            const char  *hname;  /* name of host to be removed from database */
			BOOL        is_ipv6; /* whether ipv4 or ipv6 */
            int         error;   /* error return value */
        }

        % insert an individual host name alias or LAN IP alias into
        % the database. The "host_name" argument is, in both cases,
        % the host name belonging to the original database entry for   
        % which we want to add an alias.
        Message DNS_RELAY_INSERT_LANHOST_ALIAS
        {       
            const char *host_name;
            const char *host_alias; /* name alias to insert */
			BOOL        is_ipv6; /* whether ipv4 or ipv6 */
            int         error;
        }

        Message DNS_RELAY_INSERT_LANIP_ALIAS
        {
            const char   *host_name;
            unsigned long *ip_alias; /* IP address alias to insert */
            BOOL          is_ipv6; /* whether ipv6 or ipv4 */
            int           error;
        }

        Message DNS_RELAY_DELETE_LANIP
        {
            unsigned long  *ipaddr; /* IP address to remove from the database */
            BOOL          is_ipv6; /* whether ipv6 or ipv4 */
            int            error;  /* error return value */
        }

        Message DNS_RELAY_FLUSH_LANDB
        {
        }

        Message DNS_RELAY_FLUSH_CACHE
        {
        }

        Message DNS_RELAY_LOAD_LANDB
        {
            const char  *filename;   /* name of database file (complete path) */
            BOOL        dbreset;     /* indicates whether or not to clear first */
            int         error;       /* error return value */
        }

        % The following messages are used to get and set the local domain name 
        % for the local database. 
        Message DNS_RELAY_SET_LOCAL_DOMAIN
        {
            const char *domain;        /* local domain name for local database */
            int        error;          /* error return value */
        }

        Message DNS_RELAY_GET_LOCAL_DOMAIN
        {
            const char *domain;        /* local domain name */
        }

        % Allow dynamic configuration of the DNS relay's local host name,
        % to supplement the compile time define of what FQDN the relay
        % responds to. This is useful if we want to change the local
        % FQDN without recompiling, e.g. through a factory defaults file.
        Message DNS_RELAY_SET_LOCAL_HOSTNAME
        {       
            const char *hostname;      /* DNS relay device's host name */
        }

        % this message is used for asking the relay to print out elements
        % of its database.  this is meant to be used for debugging only.
        Message DNS_RELAY_DUMP_DB
        {
        }

        % Enable and disable DNS relay
        Message DNS_RELAY_ENABLE
        {
            BOOL enable;
        }

        Message DNS_RELAY_ADD_WKSLU_ADDR
        {
			int              type;
			int              sock_type;
            struct in6_addr  *addr; /* IP address alias to insert */
			int              intf;
			int              sock_idx;
            int              error;
        }

        Message DNS_RELAY_DELETE_WKSLU_ADDR
        {
			int              sock_idx;
            int              error;
        }

⌨️ 快捷键说明

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