Beispiel #1
0
        public void EnumerateProtocols(Action <NWProtocolDefinition, TimeSpan, TimeSpan> handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            BlockLiteral block_handler = new BlockLiteral();

            block_handler.SetupBlockUnsafe(static_EnumerateProtocolsHandler, handler);
            try {
                nw_establishment_report_enumerate_protocols(GetCheckedHandle(), ref block_handler);
            } finally {
                block_handler.CleanupBlock();
            }
        }
Beispiel #2
0
 public static void RegisterFonts(string[] assetNames, CFBundle bundle, CTFontManagerScope scope, bool enabled, CTFontRegistrationHandler registrationHandler)
 {
     using (var arr = EnsureNonNullArray(assetNames, nameof(assetNames))) {
         if (registrationHandler == null)
         {
             CTFontManagerRegisterFontsWithAssetNames(arr.Handle, bundle.GetHandle(), scope, enabled, IntPtr.Zero);
         }
         else
         {
             BlockLiteral block_handler = new BlockLiteral();
             block_handler.SetupBlockUnsafe(callback, registrationHandler);
             CTFontManagerRegisterFontsWithAssetNames(arr.Handle, bundle.GetHandle(), scope, enabled, ref block_handler);
             block_handler.CleanupBlock();
         }
     }
 }
Beispiel #3
0
        public void EnumerateResolutions(Action <NWReportResolutionSource, TimeSpan, int, NWEndpoint, NWEndpoint> handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            BlockLiteral block_handler = new BlockLiteral();

            block_handler.SetupBlockUnsafe(static_ResolutionEnumeratorHandler, handler);
            try {
                nw_establishment_report_enumerate_resolutions(GetCheckedHandle(), ref block_handler);
            } finally {
                block_handler.CleanupBlock();
            }
        }
Beispiel #4
0
 public static void UnregisterFontDescriptors(CTFontDescriptor[] fontDescriptors, CTFontManagerScope scope, CTFontRegistrationHandler registrationHandler)
 {
     using (var arr = EnsureNonNullArray(fontDescriptors, nameof(fontDescriptors))) {
         if (registrationHandler == null)
         {
             CTFontManagerUnregisterFontDescriptors(arr.Handle, scope, IntPtr.Zero);
         }
         else
         {
             BlockLiteral block_handler = new BlockLiteral();
             block_handler.SetupBlockUnsafe(callback, registrationHandler);
             CTFontManagerUnregisterFontDescriptors(arr.Handle, scope, ref block_handler);
             block_handler.CleanupBlock();
         }
     }
 }
Beispiel #5
0
        static IntPtr create(DispatchBlockFlags flags, DispatchQualityOfService qosClass, int relative_priority, Action action)
        {
            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }

            BlockLiteral block_handler = new BlockLiteral();

            try {
                block_handler.SetupBlockUnsafe(BlockStaticDispatchClass.static_dispatch_block, action);
                return(dispatch_block_create_with_qos_class((nuint)(ulong)flags, qosClass, relative_priority, ref block_handler));
            } finally {
                block_handler.CleanupBlock();
            }
        }
Beispiel #6
0
        public void EnumerateInterfaces(Action <NWInterface> handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            BlockLiteral block_handler = new BlockLiteral();

            block_handler.SetupBlockUnsafe(static_EnumerateInterfacesHandler, handler);
            try {
                nw_browse_result_enumerate_interfaces(GetCheckedHandle(), ref block_handler);
            } finally {
                block_handler.CleanupBlock();
            }
        }
        public void SetNewConnectionHandler(Action <NWConnection> handler)
        {
            if (handler is null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            var block_handler = new BlockLiteral();

            block_handler.SetupBlockUnsafe(static_SetNewConnectionHandler, handler);
            try {
                nw_connection_group_set_new_connection_handler(GetCheckedHandle(), ref block_handler);
            } finally {
                block_handler.CleanupBlock();
            }
        }
        public void Receive(uint minimumIncompleteLength, uint maximumLength, NWConnectionReceiveCompletion callback)
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            BlockLiteral block_handler = new BlockLiteral();

            block_handler.SetupBlockUnsafe(static_ReceiveCompletion, callback);
            try {
                nw_connection_receive(GetCheckedHandle(), minimumIncompleteLength, maximumLength, ref block_handler);
            } finally {
                block_handler.CleanupBlock();
            }
        }
Beispiel #9
0
 		public void SetOcspResponseForPeerHandler (Action<DispatchData> callback)
 		{
			if (callback == null)
				throw new ArgumentNullException (nameof (callback));

			var block_handler = new BlockLiteral ();
			block_handler.SetupBlockUnsafe (static_OcspReposeForPeer, callback);

			try {
				if (!sec_protocol_metadata_access_ocsp_response (GetCheckedHandle (), ref block_handler)) {
					throw new InvalidOperationException ("The OSCP response is not accessible.");
				}
			} finally {
				block_handler.CleanupBlock ();
			}
 		}
Beispiel #10
0
 public static void RegisterFonts(NSUrl [] fontUrls, CTFontManagerScope scope, bool enabled, CTFontRegistrationHandler registrationHandler)
 {
     using (var arr = EnsureNonNullArray(fontUrls, nameof(fontUrls))) {
         if (registrationHandler == null)
         {
             CTFontManagerRegisterFontURLs(arr.Handle, scope, enabled, IntPtr.Zero);
         }
         else
         {
             BlockLiteral block_handler = new BlockLiteral();
             block_handler.SetupBlockUnsafe(callback, registrationHandler);
             CTFontManagerRegisterFontURLs(arr.Handle, scope, enabled, ref block_handler);
             block_handler.CleanupBlock();
         }
     }
 }
Beispiel #11
0
        static IntPtr create(Action action, DispatchBlockFlags flags)
        {
            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }

            BlockLiteral block_handler = new BlockLiteral();

            try {
                block_handler.SetupBlockUnsafe(BlockStaticDispatchClass.static_dispatch_block, action);
                return(dispatch_block_create((nuint)(ulong)flags, ref block_handler));
            } finally {
                block_handler.CleanupBlock();
            }
        }
Beispiel #12
0
        public bool GetValue(string key, NWTxtRecordGetValueDelegete handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            BlockLiteral block_handler = new BlockLiteral();

            block_handler.SetupBlockUnsafe(static_AccessKeyHandler, handler);
            try {
                return(nw_txt_record_access_key(GetCheckedHandle(), key, ref block_handler));
            } finally {
                block_handler.CleanupBlock();
            }
        }
Beispiel #13
0
        public bool GetRawBytes(NWTxtRecordGetRawByteDelegate handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            BlockLiteral block_handler = new BlockLiteral();

            block_handler.SetupBlockUnsafe(static_RawBytesHandler, handler);
            try {
                return(nw_txt_record_access_bytes(GetCheckedHandle(), ref block_handler));
            } finally {
                block_handler.CleanupBlock();
            }
        }
        public void EnumerateSubprotocols(Action <string> handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            BlockLiteral block_handler = new BlockLiteral();

            block_handler.SetupBlockUnsafe(static_EnumerateSubprotocolHandler, handler);
            try {
                nw_ws_request_enumerate_subprotocols(GetCheckedHandle(), ref block_handler);
            } finally {
                block_handler.CleanupBlock();
            }
        }
Beispiel #15
0
        public bool Apply(NWTxtRecordApplyDelegate2 handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            BlockLiteral block_handler = new BlockLiteral();

            block_handler.SetupBlockUnsafe(static_ApplyHandler, handler);
            try {
                return(nw_txt_record_apply(GetCheckedHandle(), ref block_handler));
            } finally {
                block_handler.CleanupBlock();
            }
        }
Beispiel #16
0
 		public void SetDistinguishedNamesForPeerHandler (Action<DispatchData> callback)
 		{
			if (callback == null)
				throw new ArgumentNullException (nameof (callback));

			var block_handler = new BlockLiteral ();
			block_handler.SetupBlockUnsafe (static_DistinguishedNamesForPeer, callback);

			try {
				if (!sec_protocol_metadata_access_distinguished_names (GetCheckedHandle (), ref block_handler)) {
					throw new InvalidOperationException ("Distinguished names are not accessible.");
				}
			} finally {
				block_handler.CleanupBlock ();
			}
 		}
Beispiel #17
0
 		public void SetSignatureAlgorithmsForPeerHandler (Action<ushort> callback)
 		{
			if (callback == null)
				throw new ArgumentNullException (nameof (callback));

			var block_handler = new BlockLiteral ();
			block_handler.SetupBlockUnsafe (static_SignatureAlgorithmsForPeer, callback);

			try {
				if (!sec_protocol_metadata_access_supported_signature_algorithms (GetCheckedHandle (), ref block_handler)) {
					throw new InvalidOperationException ("The supported signature list is not accessible.");
				}
			} finally {
				block_handler.CleanupBlock ();
			}
 		}
Beispiel #18
0
 		public void SetCertificateChainForPeerHandler (Action<SecCertificate> callback)
 		{
			if (callback == null)
				throw new ArgumentNullException (nameof (callback));

			var block_handler = new BlockLiteral ();
			block_handler.SetupBlockUnsafe (static_CertificateChainForPeer, callback);

			try {
				if (!sec_protocol_metadata_access_peer_certificate_chain (GetCheckedHandle (), ref block_handler)) {
					throw new InvalidOperationException ("The peer certificates are not accessible.");
				}
			} finally {
				block_handler.CleanupBlock ();
			}
 		}
        void SetupBlockOptimized_LoadLocalVariable2(Action callback)
        {
            int dummy0 = 0, dummy1 = 0;
            var block_callback = BaseOptimizeGeneratedCodeTest.block_callback;             // ldloc_2

            // Load the trampoline from a instance method call
            BlockLiteral block = new BlockLiteral();

            block.SetupBlock(block_callback, callback);
            Bindings.Test.CFunctions.x_call_block(ref block);
            block.CleanupBlock();

            // Use the variables so that the compiler doesn't optimize them away
            GC.KeepAlive(dummy0);
            GC.KeepAlive(dummy1);
        }
Beispiel #20
0
        public bool AccessCertificates(Action </* sec_identity_t */ SecCertificate2> handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            BlockLiteral block_handler = new BlockLiteral();

            try {
                block_handler.SetupBlockUnsafe(access, handler);
                return(sec_identity_access_certificates(GetCheckedHandle(), ref block_handler));
            }
            finally {
                block_handler.CleanupBlock();
            }
        }
Beispiel #21
0
 public bool ParseInput(nuint minimumIncompleteLength, nuint maximumLength, Memory <byte> tempBuffer, NWFramerParseCompletionDelegate handler)
 {
     if (handler == null)
     {
         throw new ArgumentNullException(nameof(handler));
     }
     unsafe {
         BlockLiteral block_handler = new BlockLiteral();
         block_handler.SetupBlockUnsafe(static_ParseInputHandler, handler);
         try {
             using (var mh = tempBuffer.Pin())
                 return(nw_framer_parse_input(GetCheckedHandle(), minimumIncompleteLength, maximumLength, (byte *)mh.Pointer, ref block_handler));
         } finally {
             block_handler.CleanupBlock();
         }
     }
 }
Beispiel #22
0
        public void ReceiveMessageReadOnlyData(NWConnectionReceiveReadOnlySpanCompletion callback)
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            BlockLiteral block_handler = new BlockLiteral();

            block_handler.SetupBlockUnsafe(static_ReceiveCompletionDispatchReadnOnlyData, callback);

            try {
                nw_connection_receive_message(GetCheckedHandle(), ref block_handler);
            } finally {
                block_handler.CleanupBlock();
            }
        }
Beispiel #23
0
		public void ScheduleAsync (Action handler)
		{
			unsafe {
				if (handler == null) {
					nw_framer_async (GetCheckedHandle (), null);
					return;
				}
				BlockLiteral block_handler = new BlockLiteral ();
				BlockLiteral *block_ptr_handler = &block_handler;
				block_handler.SetupBlockUnsafe (static_ScheduleHandler, handler);
				try {
					nw_framer_async (GetCheckedHandle (), (void*) block_ptr_handler);
				} finally {
					block_handler.CleanupBlock ();
				}
			}
		}
Beispiel #24
0
        public static void Read(int fd, nuint size, DispatchQueue dispatchQueue, DispatchIOHandler handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }
            if (dispatchQueue == null)
            {
                throw new ArgumentNullException(nameof(dispatchQueue));
            }

            BlockLiteral block_handler = new BlockLiteral();

            block_handler.SetupBlockUnsafe(static_DispatchReadWriteHandler, handler);
            dispatch_read(fd, size, dispatchQueue.Handle, ref block_handler);
            block_handler.CleanupBlock();
        }
 public void SetStateChangesHandler(Action <NWBrowserState, NWError?> handler)
 {
     unsafe {
         if (handler == null)
         {
             nw_ethernet_channel_set_state_changed_handler(GetCheckedHandle(), null);
             return;
         }
         BlockLiteral block_handler = new BlockLiteral();
         block_handler.SetupBlockUnsafe(static_StateChangesHandler, handler);
         try {
             nw_ethernet_channel_set_state_changed_handler(GetCheckedHandle(), &block_handler);
         } finally {
             block_handler.CleanupBlock();
         }
     }
 }
Beispiel #26
0
        public void EnumerateGateways(Action <NWEndpoint> callback)
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            BlockLiteral block_handler = new BlockLiteral();

            block_handler.SetupBlockUnsafe(static_Enumerator, callback);

            try {
                nw_path_enumerate_gateways(GetCheckedHandle(), ref block_handler);
            } finally {
                block_handler.CleanupBlock();
            }
        }
Beispiel #27
0
        public void EnumerateInterfaces(Action <NWInterface> callback)
        {
            if (callback == null)
            {
                return;
            }

            BlockLiteral block_handler = new BlockLiteral();

            block_handler.SetupBlockUnsafe(static_Enumerator, callback);

            try {
                nw_path_enumerate_interfaces(GetCheckedHandle(), ref block_handler);
            } finally {
                block_handler.CleanupBlock();
            }
        }
Beispiel #28
0
        void SetupBlockOptimized_SpecificArgument(
            Action callback,
            int dummy000 = 0, int dummy010 = 0, int dummy020 = 0, int dummy030 = 0, int dummy040 = 0, int dummy050 = 0, int dummy060 = 0, int dummy070 = 0, int dummy080 = 0, int dummy090 = 0,
            int dummy001 = 0, int dummy011 = 0, int dummy021 = 0, int dummy031 = 0, int dummy041 = 0, int dummy051 = 0, int dummy061 = 0, int dummy071 = 0, int dummy081 = 0, int dummy091 = 0,
            int dummy002 = 0, int dummy012 = 0, int dummy022 = 0, int dummy032 = 0, int dummy042 = 0, int dummy052 = 0, int dummy062 = 0, int dummy072 = 0, int dummy082 = 0, int dummy092 = 0,
            int dummy003 = 0, int dummy013 = 0, int dummy023 = 0, int dummy033 = 0, int dummy043 = 0, int dummy053 = 0, int dummy063 = 0, int dummy073 = 0, int dummy083 = 0, int dummy093 = 0,
            int dummy004 = 0, int dummy014 = 0, int dummy024 = 0, int dummy034 = 0, int dummy044 = 0, int dummy054 = 0, int dummy064 = 0, int dummy074 = 0, int dummy084 = 0, int dummy094 = 0,
            int dummy005 = 0, int dummy015 = 0, int dummy025 = 0, int dummy035 = 0, int dummy045 = 0, int dummy055 = 0, int dummy065 = 0, int dummy075 = 0, int dummy085 = 0, int dummy095 = 0,
            int dummy006 = 0, int dummy016 = 0, int dummy026 = 0, int dummy036 = 0, int dummy046 = 0, int dummy056 = 0, int dummy066 = 0, int dummy076 = 0, int dummy086 = 0, int dummy096 = 0,
            int dummy007 = 0, int dummy017 = 0, int dummy027 = 0, int dummy037 = 0, int dummy047 = 0, int dummy057 = 0, int dummy067 = 0, int dummy077 = 0, int dummy087 = 0, int dummy097 = 0,
            int dummy008 = 0, int dummy018 = 0, int dummy028 = 0, int dummy038 = 0, int dummy048 = 0, int dummy058 = 0, int dummy068 = 0, int dummy078 = 0, int dummy088 = 0, int dummy098 = 0,
            int dummy009 = 0, int dummy019 = 0, int dummy029 = 0, int dummy039 = 0, int dummy049 = 0, int dummy059 = 0, int dummy069 = 0, int dummy079 = 0, int dummy089 = 0, int dummy099 = 0,

            int dummy100 = 0, int dummy110 = 0, int dummy120 = 0, int dummy130 = 0, int dummy140 = 0, int dummy150 = 0, int dummy160 = 0, int dummy170 = 0, int dummy180 = 0, int dummy190 = 0,
            int dummy101 = 0, int dummy111 = 0, int dummy121 = 0, int dummy131 = 0, int dummy141 = 0, int dummy151 = 0, int dummy161 = 0, int dummy171 = 0, int dummy181 = 0, int dummy191 = 0,
            int dummy102 = 0, int dummy112 = 0, int dummy122 = 0, int dummy132 = 0, int dummy142 = 0, int dummy152 = 0, int dummy162 = 0, int dummy172 = 0, int dummy182 = 0, int dummy192 = 0,
            int dummy103 = 0, int dummy113 = 0, int dummy123 = 0, int dummy133 = 0, int dummy143 = 0, int dummy153 = 0, int dummy163 = 0, int dummy173 = 0, int dummy183 = 0, int dummy193 = 0,
            int dummy104 = 0, int dummy114 = 0, int dummy124 = 0, int dummy134 = 0, int dummy144 = 0, int dummy154 = 0, int dummy164 = 0, int dummy174 = 0, int dummy184 = 0, int dummy194 = 0,
            int dummy105 = 0, int dummy115 = 0, int dummy125 = 0, int dummy135 = 0, int dummy145 = 0, int dummy155 = 0, int dummy165 = 0, int dummy175 = 0, int dummy185 = 0, int dummy195 = 0,
            int dummy106 = 0, int dummy116 = 0, int dummy126 = 0, int dummy136 = 0, int dummy146 = 0, int dummy156 = 0, int dummy166 = 0, int dummy176 = 0, int dummy186 = 0, int dummy196 = 0,
            int dummy107 = 0, int dummy117 = 0, int dummy127 = 0, int dummy137 = 0, int dummy147 = 0, int dummy157 = 0, int dummy167 = 0, int dummy177 = 0, int dummy187 = 0, int dummy197 = 0,
            int dummy108 = 0, int dummy118 = 0, int dummy128 = 0, int dummy138 = 0, int dummy148 = 0, int dummy158 = 0, int dummy168 = 0, int dummy178 = 0, int dummy188 = 0, int dummy198 = 0,
            int dummy109 = 0, int dummy119 = 0, int dummy129 = 0, int dummy139 = 0, int dummy149 = 0, int dummy159 = 0, int dummy169 = 0, int dummy179 = 0, int dummy189 = 0, int dummy199 = 0,

            int dummy200 = 0, int dummy210 = 0, int dummy220 = 0, int dummy230 = 0, int dummy240 = 0, int dummy250 = 0, int dummy260 = 0, int dummy270 = 0, int dummy280 = 0, int dummy290 = 0,
            int dummy201 = 0, int dummy211 = 0, int dummy221 = 0, int dummy231 = 0, int dummy241 = 0, int dummy251 = 0, int dummy261 = 0, int dummy271 = 0, int dummy281 = 0, int dummy291 = 0,
            int dummy202 = 0, int dummy212 = 0, int dummy222 = 0, int dummy232 = 0, int dummy242 = 0, int dummy252 = 0, int dummy262 = 0, int dummy272 = 0, int dummy282 = 0, int dummy292 = 0,
            int dummy203 = 0, int dummy213 = 0, int dummy223 = 0, int dummy233 = 0, int dummy243 = 0, int dummy253 = 0, int dummy263 = 0, int dummy273 = 0, int dummy283 = 0, int dummy293 = 0,
            int dummy204 = 0, int dummy214 = 0, int dummy224 = 0, int dummy234 = 0, int dummy244 = 0, int dummy254 = 0, int dummy264 = 0, int dummy274 = 0, int dummy284 = 0, int dummy294 = 0,
            int dummy205 = 0, int dummy215 = 0, int dummy225 = 0, int dummy235 = 0, int dummy245 = 0, int dummy255 = 0, int dummy265 = 0, int dummy275 = 0, int dummy285 = 0, int dummy295 = 0,
            int dummy206 = 0, int dummy216 = 0, int dummy226 = 0, int dummy236 = 0, int dummy246 = 0, int dummy256 = 0, int dummy266 = 0, int dummy276 = 0, int dummy286 = 0, int dummy296 = 0,
            int dummy207 = 0, int dummy217 = 0, int dummy227 = 0, int dummy237 = 0, int dummy247 = 0, int dummy257 = 0, int dummy267 = 0, int dummy277 = 0, int dummy287 = 0, int dummy297 = 0,
            int dummy208 = 0, int dummy218 = 0, int dummy228 = 0, int dummy238 = 0, int dummy248 = 0, int dummy258 = 0, int dummy268 = 0, int dummy278 = 0, int dummy288 = 0, int dummy298 = 0,
            int dummy209 = 0, int dummy219 = 0, int dummy229 = 0, int dummy239 = 0, int dummy249 = 0, int dummy259 = 0, int dummy269 = 0, int dummy279 = 0, int dummy289 = 0, int dummy299 = 0,

            Action <IntPtr> block_callback = null
            )
        {
            // ldarg
            BlockLiteral block = new BlockLiteral();

            block.SetupBlock(block_callback, callback);
            Bindings.Test.CFunctions.x_call_block(ref block);
            block.CleanupBlock();
        }
        public void SetKeyUpdateCallback(SecProtocolKeyUpdate keyUpdate, DispatchQueue keyUpdateQueue)
        {
            if (keyUpdate == null)
            {
                throw new ArgumentNullException(nameof(keyUpdate));
            }
            if (keyUpdateQueue == null)
            {
                throw new ArgumentNullException(nameof(keyUpdateQueue));
            }

            BlockLiteral block_handler = new BlockLiteral();

            block_handler.SetupBlockUnsafe(Trampolines.SDSecProtocolKeyUpdate.Handler, keyUpdate);

            sec_protocol_options_set_key_update_block(Handle, ref block_handler, keyUpdateQueue.Handle);
            block_handler.CleanupBlock();
        }
        public void SetReceiveHandler(NWEthernetChannelReceiveDelegate handler)
        {
            unsafe {
                if (handler == null)
                {
                    nw_ethernet_channel_set_receive_handler(GetCheckedHandle(), null);
                    return;
                }

                BlockLiteral block_handler = new BlockLiteral();
                block_handler.SetupBlockUnsafe(static_ReceiveHandler, handler);
                try {
                    nw_ethernet_channel_set_receive_handler(GetCheckedHandle(), &block_handler);
                } finally {
                    block_handler.CleanupBlock();
                }
            }
        }