Example #1
0
        /// <summary>
        /// Instantiates a WKS Type of RR based on the data in the method's input parameters: the record's DNS Server Name, Container Name, Owner Name, class (default = IN), time-to-live value, and the owner's Internet Address, IP protocol and port bit mask. It returns a reference to the new object as an output parameter. 
        /// </summary>
        /// <param name="server">Server object</param>
        /// <param name="dnsServerName">Fully Qualified Domain Name (FQDN) or IP address of the DNS Server that contains this RR.</param>
        /// <param name="containerName">Name of the Container for the Zone, Cache, or RootHints instance which contains this RR.</param>
        /// <param name="ownerName">Owner FQDN for the RR.</param>
        /// <param name="recordClass">Class of the RR.</param>
        /// <param name="ttl">Time, in seconds, that the RR can be cached by a DNS resolver.</param>
        /// <param name="internetAddress">Internet IP address for the record's owner.</param>
        /// <param name="ipProtocol">String representing the IP protocol for this record. Valid values are UDP or TCP.</param>
        /// <param name="services">String containing all services used by the Well Known Service (WKS) record.</param>
        /// <returns>the new object.</returns>
        public static WKSType CreateInstanceFromPropertyData(
            Server server,
            string dnsServerName,
            string containerName,
            string ownerName,
            RecordClassEnum? recordClass,
            TimeSpan? ttl,
            string internetAddress, string ipProtocol
                                            , string services)
        {
            if (server == null)
                throw new ArgumentNullException("server is required");

            ManagementClass dnsClass = new ManagementClass(server.m_scope, new ManagementPath("MicrosoftDNS_WKSType"), null);
            ManagementBaseObject inParams = dnsClass.GetMethodParameters("CreateInstanceFromPropertyData");
            inParams["DnsServerName"] = dnsServerName;
            inParams["ContainerName"] = containerName;
            inParams["OwnerName"] = ownerName;
            if (recordClass != null)
                inParams["RecordClass"] = (UInt32)recordClass.Value;
            if (ttl != null)
                inParams["TTL"] = ttl.Value.TotalSeconds;

            inParams["InternetAddress"] = internetAddress;
            inParams["IPProtocol"] = ipProtocol;
            inParams["Services"] = services;

            try
            {
                return new WKSType(new ManagementObject(server.m_scope, new ManagementPath(dnsClass.InvokeMethod("CreateInstanceFromPropertyData", inParams, null)["RR"].ToString()), null));
            }
            catch (ManagementException me)
            {
                throw new WMIException(me);
            }
        }
Example #2
0
        public static WINSRType CreateInstanceFromPropertyData(
            Server server,
            string dnsServerName,
            string containerName,
            string ownerName,
            RecordClassEnum? recordClass,
            TimeSpan? ttl,
            MappingFlagEnum mappingFlag,
            TimeSpan lookupTimeout,
            TimeSpan cacheTimeout,
            string resultDomain
            )
        {
            if (server == null)
                throw new ArgumentNullException("server is required");

            ManagementClass dnsClass = new ManagementClass(server.m_scope, new ManagementPath("MicrosoftDNS_WINSRType"), null);
            ManagementBaseObject inParams = dnsClass.GetMethodParameters("CreateInstanceFromPropertyData");
            inParams["DnsServerName"] = dnsServerName;
            inParams["ContainerName"] = containerName;
            inParams["OwnerName"] = ownerName;
            if (recordClass != null)
                inParams["RecordClass"] = (UInt32)recordClass.Value;
            if (ttl != null)
                inParams["TTL"] = ttl.Value.TotalSeconds;
            inParams["MappingFlag"] = (UInt32)mappingFlag;
            inParams["LookupTimeout"] = lookupTimeout.TotalSeconds;
            inParams["CacheTimeout"] = cacheTimeout.TotalSeconds;
            inParams["ResultDomain"] = resultDomain;

            //return new WINSRType((ManagementObject)dnsClass.InvokeMethod("CreateInstanceFromPropertyData", inParams, null));
            try
            {

                return new WINSRType(new ManagementObject(server.m_scope, new ManagementPath(dnsClass.InvokeMethod("CreateInstanceFromPropertyData", inParams, null)["RR"].ToString()), null));
            }
            catch (ManagementException me)
            {
                throw new WMIException(me);
            }
        }
Example #3
0
        /// <summary>
        /// Instantiates an SRV Type of RR based on the data in the method's input parameters: the record's DNS Server Name, Container Name, Owner/target Name, class (default = IN), time-to-live value, and target host's priority, weight, port, and domain name. It returns a reference to the new object as an output parameter. 
        /// </summary>
        /// <param name="server">Server object</param>
        /// <param name="dnsServerName">Fully Qualified Domain Name (FQDN) or IP address of the DNS Server that contains this RR.</param>
        /// <param name="containerName">Name of the Container for the Zone, Cache, or RootHints instance which contains this RR.</param>
        /// <param name="ownerName">Owner FQDN for the RR.</param>
        /// <param name="recordClass">Class of the RR.</param>
        /// <param name="ttl">Time, in seconds, that the RR can be cached by a DNS resolver.</param>
        /// <param name="domainName">FQDN of the target host. A target of \.\ means that the service is decidedly not available at this domain.</param>
        /// <param name="port">Port used on the target host of a protocol service.</param>
        /// <param name="priority">Priority of the target host specified in the owner name. Lower numbers imply higher priorities.</param>
        /// <param name="weight">Weight of the target host. This is useful when selecting among hosts that have the same priority. The chances of using this host should be proportional to its weight.</param>
        /// <returns>the new object.</returns>
        public static SRVType CreateInstanceFromPropertyData(
            Server server,
            string dnsServerName,
            string containerName,
            string ownerName,
            RecordClassEnum? recordClass,
            TimeSpan? ttl,
            UInt16 priority, UInt16 weight, UInt16 port,
            string domainName)
        {
            if (server == null)
                throw new ArgumentNullException("server is required");

            ManagementClass dnsClass = new ManagementClass(server.m_scope, new ManagementPath("MicrosoftDNS_SRVType"), null);
            ManagementBaseObject inParams = dnsClass.GetMethodParameters("CreateInstanceFromPropertyData");
            inParams["DnsServerName"] = dnsServerName;
            inParams["ContainerName"] = containerName;
            inParams["OwnerName"] = ownerName;
            if (recordClass != null)
                inParams["RecordClass"] = (UInt32)recordClass.Value;
            if (ttl != null)
                inParams["TTL"] = ttl.Value.TotalSeconds;

            inParams["Priority"] = priority;
            inParams["Weight"] = weight;
            inParams["Port"] = port;
            inParams["SRVDomainName"] = domainName;

            //return new SRVType((ManagementObject)dnsClass.InvokeMethod("CreateInstanceFromPropertyData", inParams, null));
            return new SRVType(new ManagementObject(server.m_scope, new ManagementPath(dnsClass.InvokeMethod("CreateInstanceFromPropertyData", inParams, null)["RR"].ToString()), null));
        }
Example #4
0
        /// <summary>
        /// Instantiates an SIG RR based on the data in the method's input parameters: the record's DNS Server Name, Container Name, Owner Name, class (default = IN), time-to-live value, and WINS mapping flag, reverse look-up time out, WINS cache time out and domain name to append. It returns a reference to the new object as an output parameter. 
        /// </summary>
        /// <param name="server">Server object</param>
        /// <param name="dnsServerName">Fully Qualified Domain Name (FQDN) or IP address of the DNS Server that contains this RR.</param>
        /// <param name="containerName">Name of the Container for the Zone, Cache, or RootHints instance which contains this RR.</param>
        /// <param name="ownerName">Owner FQDN for the RR.</param>
        /// <param name="recordClass">Class of the RR.</param>
        /// <param name="ttl">Time, in seconds, that the RR can be cached by a DNS resolver.</param>
        /// <param name="algorithm">Algorithm used with the key specified in the resource record. </param>
        /// <param name="keyTag">Method used to choose a key that verifies an SIG. See RFC 2535, Appendix C for the method used to calculate a KeyTag.</param>
        /// <param name="labels">Unsigned count of labels in the original SIG RR owner name. The count does not include the NULL label for the root, nor any initial wildcards.</param>
        /// <param name="originalTTL">TTL of the RR set signed by the SIG.</param>
        /// <param name="signature">Signature, represented in base 64, formatted as defined in RFC 2535, Appendix A.</param>
        /// <param name="signatureExpiration">Signature expiration date, expressed in seconds since the beginning of January 1, 1970, Greenwich Mean Time (GMT), excluding leap seconds.</param>
        /// <param name="signatureInception">Date and time at which the Signature becomes valid, expressed in seconds since the beginning of January 1, 1970, Greenwich Mean Time (GMT), excluding leap seconds.</param>
        /// <param name="signerName">Domain name of the signer that generated the SIG RR.</param>
        /// <param name="typeCovered">Type of RR covered by this SIG.</param>
        /// <returns>the new object.</returns>
        public static SIGType CreateInstanceFromPropertyData(
            Server server,
            string dnsServerName,
            string containerName,
            string ownerName,
            RecordClassEnum? recordClass,
            TimeSpan? ttl,
             UInt16 typeCovered,
             AlgorithmEnum algorithm,
             UInt16 labels,
             TimeSpan originalTTL,
             UnixDateTime signatureExpiration,
             UnixDateTime signatureInception,
             UInt16 keyTag,
             string signerName,
             string signature)
        {
            if (server == null)
                throw new ArgumentNullException("server is required");

            ManagementClass dnsClass = new ManagementClass(server.m_scope, new ManagementPath("MicrosoftDNS_SIGType"), null);
            ManagementBaseObject inParams = dnsClass.GetMethodParameters("CreateInstanceFromPropertyData");
            inParams["DnsServerName"] = dnsServerName;
            inParams["ContainerName"] = containerName;
            inParams["OwnerName"] = ownerName;
            if (recordClass != null)
                inParams["RecordClass"] = (UInt32)recordClass.Value;
            if (ttl != null)
                inParams["TTL"] = ttl.Value.TotalSeconds;
            inParams["Algorithm"] = (UInt16)algorithm;
            inParams["Labels"] = labels;
            inParams["OriginalTTL"] = originalTTL.TotalSeconds;
            inParams["SignatureExpiration"] = signatureExpiration.Unix;
            inParams["SignatureInception"] = signatureInception.Unix;
            inParams["KeyTag"] = keyTag;
            inParams["SignerName"] = signerName;
            inParams["Signature"] = signature;

            //return new SIGType((ManagementObject)dnsClass.InvokeMethod("CreateInstanceFromPropertyData", inParams, null));
            try
            {
                return new SIGType(new ManagementObject(server.m_scope, new ManagementPath(dnsClass.InvokeMethod("CreateInstanceFromPropertyData", inParams, null)["RR"].ToString()), null));
            }
            catch (ManagementException me)
            {
                throw new WMIException(me);
            }
        }
Example #5
0
        public static MINFOType CreateInstanceFromPropertyData(
            Server server,
            string dnsServerName,
            string containerName,
            string ownerName,
            RecordClassEnum? recordClass,
            TimeSpan? ttl,
            string responsibleMailbox, string errorMailbox)
        {
            if (server == null)
                throw new ArgumentNullException("server is required");

            ManagementClass dnsClass = new ManagementClass(server.m_scope, new ManagementPath("MicrosoftDNS_MINFOType"), null);
            ManagementBaseObject inParams = dnsClass.GetMethodParameters("CreateInstanceFromPropertyData");
            inParams["DnsServerName"] = dnsServerName;
            inParams["ContainerName"] = containerName;
            inParams["OwnerName"] = ownerName;
            if (recordClass != null)
                inParams["RecordClass"] = (UInt32)recordClass.Value;
            if (ttl != null)
                inParams["TTL"] = ttl.Value.TotalSeconds;
            inParams["ResponsibleMailbox"] = responsibleMailbox;
            inParams["ErrorMailbox"] = errorMailbox;

            //return new MINFOType((ManagementObject)dnsClass.InvokeMethod("CreateInstanceFromPropertyData", inParams, null));
            return new MINFOType(new ManagementObject(server.m_scope, new ManagementPath(dnsClass.InvokeMethod("CreateInstanceFromPropertyData", inParams, null)["RR"].ToString()), null));
        }
Example #6
0
        public static MXType CreateInstanceFromPropertyData(
           Server server,
           string dnsServerName,
           string containerName,
           string ownerName,
           RecordClassEnum? recordClass,
           TimeSpan? ttl,
            UInt16 preference, string mailExchange)
        {
            if (server == null)
                throw new ArgumentNullException("server is required");

            ManagementClass dnsClass = new ManagementClass(server.m_scope, new ManagementPath("MicrosoftDNS_MXType"), null);
            ManagementBaseObject inParams = dnsClass.GetMethodParameters("CreateInstanceFromPropertyData");
            inParams["DnsServerName"] = dnsServerName;
            inParams["ContainerName"] = containerName;
            inParams["OwnerName"] = ownerName;
            if (recordClass != null)
                inParams["RecordClass"] = (UInt32)recordClass.Value;
            if (ttl != null)
                inParams["TTL"] = ttl.Value.TotalSeconds;
            inParams["Preference"] = preference;
            inParams["MailExchange"] = mailExchange;

            //return new MXType((ManagementObject)dnsClass.InvokeMethod("CreateInstanceFromPropertyData", inParams, null));

            //non standard record implementation, workaround needed:
            return new MXType(new ManagementObject(server.m_scope, new ManagementPath(dnsClass.InvokeMethod("CreateInstanceFromPropertyData", inParams, null)["RR"].ToString()), null));
        }