/// <summary>
        /// Returns true if all sites have been pinged successfully.
        /// </summary>
        public bool AllSitesHaveBeenPigned()
        {
            bool allPinged = false;
            int  code      = i3d_ping_pingers_all_sites_have_been_pinged(_ptr, out allPinged);

            I3dErrorValidator.Validate(code);
            return(allPinged);
        }
        /// <summary>
        /// Gets the size of the IpList being pinged by an instance of the <see cref="I3dPingersWrapper"/> class.
        /// </summary>
        public uint Size()
        {
            uint size = 0;
            int  code = i3d_ping_pingers_size(_ptr, out size);

            I3dErrorValidator.Validate(code);
            return(size);
        }
        /// <summary>
        /// Returns true if at least one site has been pinged successfully.
        /// </summary>
        public bool AtLeastOneSiteHasBeenPinged()
        {
            bool atLeastOne = false;
            int  code       = i3d_ping_pingers_at_least_one_site_has_been_pinged(_ptr, out atLeastOne);

            I3dErrorValidator.Validate(code);
            return(atLeastOne);
        }
        /// <summary>
        /// Gets the size of the Sites that has been retrieved by an instance of the <see cref="I3dSitesGetterWrapper"/> class.
        /// </summary>
        public uint Size()
        {
            uint size = 0;
            int  code = i3d_ping_sites_getter_site_list_size(_ptr, out size);

            I3dErrorValidator.Validate(code);
            return(size);
        }
Example #5
0
        private uint GetStringSize(uint position)
        {
            uint size;
            int  code = i3d_ping_ip_list_ip_size(_ptr, position, out size);

            I3dErrorValidator.Validate(code);
            return(size);
        }
        /// <summary>
        /// Gets the size of the IPv6 for the site at the given position.
        /// </summary>
        public uint ipv6Size(uint position)
        {
            uint size = 0;
            int  code = i3d_ping_sites_getter_list_site_ipv6_size(_ptr, position, out size);

            I3dErrorValidator.Validate(code);
            return(size);
        }
Example #7
0
        /// <summary>
        /// Adds an Ip into the list.
        /// </summary>
        public void PushIp(string value)
        {
            int code;

            using (var value1 = new Utf8ByteArray(value))
            {
                code = i3d_ping_ip_list_push_back(_ptr, value1);
            }

            I3dErrorValidator.Validate(code);
        }
        /// <summary>
        /// Retrieves the IPv6 <see cref="string"/> at the ip position in the ip list of the site at the given position.
        /// </summary>
        public string GetIPv6(uint position, uint ipPosition)
        {
            using (var result = new Utf8ByteArray((int)46))
            {
                int code = i3d_ping_sites_getter_list_site_ipv6_ip(_ptr, position, ipPosition, result);
                I3dErrorValidator.Validate(code);

                result.ReadPtr();
                return(result.ToString());
            }
        }
        /// <summary>
        /// Retrieves the hostname <see cref="string"/> value for the site at the given position.
        /// </summary>
        public string GetHostname(uint position)
        {
            using (var result = new Utf8ByteArray((int)64))
            {
                int code = i3d_ping_sites_getter_list_site_hostname(_ptr, position, result);
                I3dErrorValidator.Validate(code);

                result.ReadPtr();
                return(result.ToString());
            }
        }
Example #10
0
        /// <summary>
        /// Retrieves the IP <see cref="string"/> value from the ip list.
        /// </summary>
        public string GetIp(uint position)
        {
            uint size = GetStringSize(position);

            using (var result = new Utf8ByteArray((int)size))
            {
                int code = i3d_ping_ip_list_ip(_ptr, position, result, size);
                I3dErrorValidator.Validate(code);

                result.ReadPtr();
                return(result.ToString());
            }
        }
        /// <summary>
        /// Init an instance of the <see cref="I3dSitesGetterWrapper"/> class.
        /// </summary>
        public void Init(Action <I3dLogLevel, string> logCallback, I3dHttpGetCallback callback, IntPtr userdata)
        {
            _logCallback = logCallback;

            int code = i3d_ping_sites_getter_create(out _ptr, callback, userdata);

            I3dErrorValidator.Validate(code);

            code = i3d_ping_sites_getter_set_logger(_ptr, LogCallback, _ptr);
            I3dErrorValidator.Validate(code);

            lock (SitesGetter)
            {
                SitesGetter.Add(_ptr, this);
            }
        }
        /// <summary>
        /// Creates a new instance of the <see cref="I3dPingersWrapper"/> class.
        /// Should be disposed.
        /// </summary>
        /// <param name="logCallback">The logging callback.</param>
        public I3dPingersWrapper(Action <I3dLogLevel, string> logCallback, I3dIpList ipList)
        {
            _logCallback = logCallback;

            int code = i3d_ping_pingers_create(out _ptr, ipList.Ptr);

            I3dErrorValidator.Validate(code);

            code = i3d_ping_pingers_set_logger(_ptr, LogCallback, _ptr);
            I3dErrorValidator.Validate(code);

            lock (Pingers)
            {
                Pingers.Add(_ptr, this);
            }
        }
        /// <summary>
        /// Updates an instance of the <see cref="I3dPingersWrapper"/> class. This will update the ping statistics.
        /// </summary>
        public void Update()
        {
            int code = i3d_ping_pingers_update(_ptr);

            I3dErrorValidator.Validate(code);
        }
        /// <summary>
        /// Gets IPv6 list for all the sites.
        /// </summary>
        public void ipv6List(I3dIpList list)
        {
            int code = i3d_ping_sites_getter_ipv6_list(_ptr, list.Ptr);

            I3dErrorValidator.Validate(code);
        }
Example #15
0
        /// <summary>
        /// Clears the list to an empty initialized state.
        /// </summary>
        public void Clear()
        {
            int code = i3d_ping_ip_list_clear(_ptr);

            I3dErrorValidator.Validate(code);
        }
Example #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="I3dIpList"/>. Should be disposed.
        /// </summary>
        public I3dIpList()
        {
            int code = i3d_ping_ip_list_create(out _ptr);

            I3dErrorValidator.Validate(code);
        }
        /// <summary>
        /// Updates an instance of the <see cref="I3dSitesGetterWrapper"/> class. This will update the status to ready when the HTTP Get response has been successfully finished.
        /// </summary>
        public void Update()
        {
            int code = i3d_ping_sites_getter_update(_ptr);

            I3dErrorValidator.Validate(code);
        }
        /// <summary>
        /// Gets the ping statistics for the pinger at position pos.
        /// </summary>
        public void Statistics(uint pos, out int lastTime, out double averageTime, out int minTime, out int maxTime, out double medianTime, out uint pingResponseCount)
        {
            int code = i3d_ping_pingers_statistics(_ptr, pos, out lastTime, out averageTime, out minTime, out maxTime, out medianTime, out pingResponseCount);

            I3dErrorValidator.Validate(code);
        }