コード例 #1
0
 public void AddEndpoint(NWEndpoint endpoint)
 {
     if (endpoint == null)
     {
         throw new ArgumentNullException(nameof(endpoint));
     }
     nw_group_descriptor_add_endpoint(GetCheckedHandle(), endpoint.GetCheckedHandle());
 }
コード例 #2
0
        public NWMulticastGroup(NWEndpoint endpoint)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException(nameof(endpoint));
            }

            InitializeHandle(nw_group_descriptor_create_multicast(endpoint.GetCheckedHandle()));
        }
コード例 #3
0
        static void TrampolineGatewaysHandler(IntPtr block, IntPtr endpoint)
        {
            var del = BlockLiteral.GetTarget <Action <NWEndpoint> > (block);

            if (del != null)
            {
                var nwEndpoint = new NWEndpoint(endpoint, owns: false);
                del(nwEndpoint);
            }
        }
コード例 #4
0
        static void TrampolineAdvertisedEndpointChangedHandler(IntPtr block, IntPtr endpoint, byte added)
        {
            var del = BlockLiteral.GetTarget <AdvertisedEndpointChanged> (block);

            if (del != null)
            {
                using var nwendpoint = new NWEndpoint(endpoint, owns: false);
                del(nwendpoint, added != 0 ? true : false);
            }
        }
コード例 #5
0
        static void TrampolineResolutionEnumeratorHandler(IntPtr block, NWReportResolutionSource source, nuint milliseconds, int endpoint_count, nw_endpoint_t successful_endpoint, nw_endpoint_t preferred_endpoint)
        {
            var del = BlockLiteral.GetTarget <Action <NWReportResolutionSource, TimeSpan, int, NWEndpoint, NWEndpoint> > (block);

            if (del != null)
            {
                using (var nwSuccesfulEndpoint = new NWEndpoint(successful_endpoint, owns: false))
                    using (var nwPreferredEndpoint = new NWEndpoint(preferred_endpoint, owns: false))
                        del(source, TimeSpan.FromMilliseconds(milliseconds), endpoint_count, nwSuccesfulEndpoint, nwPreferredEndpoint);
            }
        }
コード例 #6
0
 public NWConnection(NWEndpoint endpoint, NWParameters parameters)
 {
     if (endpoint == null)
     {
         throw new ArgumentNullException(nameof(endpoint));
     }
     if (parameters == null)
     {
         throw new ArgumentNullException(nameof(parameters));
     }
     InitializeHandle(nw_connection_create(endpoint.Handle, parameters.Handle));
 }
コード例 #7
0
        public NWResolverConfig(NWEndpoint urlEndpoint, NWResolverConfigEndpointType endpointType)
        {
            if (urlEndpoint is null)
            {
                throw new ArgumentNullException(nameof(urlEndpoint));
            }
            switch (endpointType)
            {
            case NWResolverConfigEndpointType.Https:
                InitializeHandle(nw_resolver_config_create_https(urlEndpoint.Handle));
                break;

            case NWResolverConfigEndpointType.Tls:
                InitializeHandle(nw_resolver_config_create_tls(urlEndpoint.Handle));
                break;

            default:
                throw new ArgumentOutOfRangeException($"Unknown endpoint type: {endpointType}");
            }
        }
コード例 #8
0
 public void AddServerAddress(NWEndpoint serverAddress)
 => nw_resolver_config_add_server_address(GetCheckedHandle(), serverAddress.Handle);
コード例 #9
0
        public NWConnection?ExtractConnection(NWEndpoint endpoint, NWProtocolOptions protocolOptions)
        {
            var ptr = nw_connection_group_extract_connection(GetCheckedHandle(), endpoint.GetCheckedHandle(), protocolOptions.GetCheckedHandle());

            return(ptr == IntPtr.Zero ? null : new NWConnection(ptr, true));
        }
コード例 #10
0
 public NWMultiplexGroup(NWEndpoint endpoint)
     : base(nw_group_descriptor_create_multiplex(endpoint.GetCheckedHandle()), true)
 {
 }