Ejemplo n.º 1
0
        public DdnsNoIpClient(DdnsConfig ddnsConfig)
            : base(ddnsConfig)
        {
            // **** CHECK IP ADDRESS CONFIGURATION ****

            this.checkIpHost = String.Empty;

            // No-Ip service provider hasn't a check IP address endpoint
            this.checkIpEndPoint = null;

            // No-Ip service provider hasn't a check IP address command
            this.checkIpCmd = null;

            // **** UPDATE IP ADDRESS CONFIGURATION ****

            this.updateIpHost = DDNS_UPDATE_IP_HOST;

            // get IP address for Ddns service provider hostname and create endpoint
            IPHostEntry hostEntry = Dns.GetHostEntry(this.updateIpHost);

            this.updateIpEndPoint = new IPEndPoint(hostEntry.AddressList[0], this.ddnsConfig.SSL ? DDNS_UPDATE_IP_SSL_PORT : DDNS_UPDATE_IP_PORT);

            // create command for update IP address
            this.updateIpCmd = new DdnsUpdateIpCommand
            {
                Path          = DDNS_UPDATE_IP_PATH,
                Host          = DDNS_UPDATE_IP_HOST,
                HostName      = this.ddnsConfig.Account.Hostname,
                Authorization = Encoder.ToBase64String(Encoding.UTF8.GetBytes(this.ddnsConfig.Account.Username + ":" + this.ddnsConfig.Account.Password)),
                UserAgent     = DDNS_CLIENT_USER_AGENT
            };
        }
Ejemplo n.º 2
0
        public DdnsNoIpClient(DdnsConfig ddnsConfig)
            : base(ddnsConfig)
        {
            // **** CHECK IP ADDRESS CONFIGURATION ****

            this.checkIpHost = String.Empty;

            // No-Ip service provider hasn't a check IP address endpoint
            this.checkIpEndPoint = null;

            // No-Ip service provider hasn't a check IP address command
            this.checkIpCmd = null;

            // **** UPDATE IP ADDRESS CONFIGURATION ****

            this.updateIpHost = DDNS_UPDATE_IP_HOST;

            // get IP address for Ddns service provider hostname and create endpoint
            IPHostEntry hostEntry = Dns.GetHostEntry(this.updateIpHost);
            this.updateIpEndPoint = new IPEndPoint(hostEntry.AddressList[0], this.ddnsConfig.SSL ? DDNS_UPDATE_IP_SSL_PORT : DDNS_UPDATE_IP_PORT);

            // create command for update IP address
            this.updateIpCmd = new DdnsUpdateIpCommand
            {
                Path = DDNS_UPDATE_IP_PATH,
                Host = DDNS_UPDATE_IP_HOST,
                HostName = this.ddnsConfig.Account.Hostname,
                Authorization =  Encoder.ToBase64String(Encoding.UTF8.GetBytes(this.ddnsConfig.Account.Username + ":" + this.ddnsConfig.Account.Password)),
                UserAgent = DDNS_CLIENT_USER_AGENT
            };
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="ddnsConfig">Ddns configuration information</param>
        public DdnsClient(DdnsConfig ddnsConfig)
        {
            this.ddnsConfig = ddnsConfig;

            // create timer for periodic and automatic check/update but not start it
            this.updaterIpTimer = new Timer(this.CheckUpdateIpAddressCallback, null, Timeout.Infinite, this.ddnsConfig.Period);

            this.receiveBuffer = new byte[RECEIVE_BUFFER_SIZE];
            this.checkIpHost   = String.Empty;
            this.updateIpHost  = String.Empty;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="ddnsConfig">Ddns configuration information</param>
        public DdnsClient(DdnsConfig ddnsConfig)
        {
            this.ddnsConfig = ddnsConfig;

            // create timer for periodic and automatic check/update but not start it
            this.updaterIpTimer = new Timer(this.CheckUpdateIpAddressCallback, null, Timeout.Infinite, this.ddnsConfig.Period);

            this.receiveBuffer = new byte[RECEIVE_BUFFER_SIZE];
            this.checkIpHost = String.Empty;
            this.updateIpHost = String.Empty;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Return the requested DdnsClient instance based on specified Ddns Service Provider
        /// </summary>
        /// <param name="ddnsServiceProvider">Ddns Service Provider for create the right DdnsClient instance</param>
        /// <param name="ddnsConfig">Ddns configuration information</param>
        /// <returns>Concrete DdnsClient instance</returns>
        public static DdnsClient GetDdnsClient(DdnsServiceProvider ddnsServiceProvider, DdnsConfig ddnsConfig)
        {
            DdnsClient ddnsClient = null;

            switch (ddnsServiceProvider)
            {
                case DdnsServiceProvider.NoIp:
                    ddnsClient = new DdnsNoIpClient(ddnsConfig);
                    break;
                case DdnsServiceProvider.DynDns:
                    ddnsClient = new DdnsDynDnsClient(ddnsConfig);
                    break;
                default:
                    break;
            }

            return ddnsClient;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Return the requested DdnsClient instance based on specified Ddns Service Provider
        /// </summary>
        /// <param name="ddnsServiceProvider">Ddns Service Provider for create the right DdnsClient instance</param>
        /// <param name="ddnsConfig">Ddns configuration information</param>
        /// <returns>Concrete DdnsClient instance</returns>
        public static DdnsClient GetDdnsClient(DdnsServiceProvider ddnsServiceProvider, DdnsConfig ddnsConfig)
        {
            DdnsClient ddnsClient = null;

            switch (ddnsServiceProvider)
            {
            case DdnsServiceProvider.NoIp:
                ddnsClient = new DdnsNoIpClient(ddnsConfig);
                break;

            case DdnsServiceProvider.DynDns:
                ddnsClient = new DdnsDynDnsClient(ddnsConfig);
                break;

            default:
                break;
            }

            return(ddnsClient);
        }