public RasConnectionStatistics GetConnectionStatistics(IRasConnection connection)
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            var stats = GetConnectionStatisticsByHandle(connection.Handle);

            return(new RasConnectionStatistics(
                       stats.dwBytesXmited,
                       stats.dwBytesRcved,
                       stats.dwFramesXmited,
                       stats.dwFramesRcved,
                       stats.dwCrcErr,
                       stats.dwTimeoutErr,
                       stats.dwAlignmentErr,
                       stats.dwHardwareOverrunErr,
                       stats.dwFramingErr,
                       stats.dwBufferOverrunErr,
                       stats.dwCompressionRatioIn,
                       stats.dwCompressionRatioOut,
                       stats.dwBps,
                       TimeSpan.FromMilliseconds(stats.dwConnectDuration)));
        }
Esempio n. 2
0
        public void HangUp(IRasConnection connection, bool closeAllReferences, CancellationToken cancellationToken)
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            HangUpImpl(connection.Handle, closeAllReferences, cancellationToken);
        }
Esempio n. 3
0
        public Task HangUpAsync(IRasConnection connection, bool closeAllReferences, CancellationToken cancellationToken)
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            return(Task.Run(() => HangUpImpl(connection.Handle, closeAllReferences, cancellationToken), cancellationToken));
        }
        public void ClearConnectionStatistics(IRasConnection connection)
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            var ret = api.RasClearConnectionStatistics(connection.Handle);

            if (ret != SUCCESS)
            {
                throw exceptionPolicy.Create(ret);
            }
        }
        public RasConnectionStatus GetConnectionStatus(IRasConnection connection)
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            var rasConnStatus = GetConnectionStatusByHandle(connection.Handle);

            return(new RasConnectionStatus(
                       rasConnStatus.rasconnstate,
                       CreateDevice(rasConnStatus),
                       rasConnStatus.szPhoneNumber,
                       CreateLocalIPAddress(rasConnStatus),
                       CreateRemoteIPAddress(rasConnStatus),
                       rasConnStatus.rasconnsubstate));
        }