Example #1
0
        static void ExecutePacCallback(IntPtr client, IntPtr proxyList, IntPtr error)
        {
            // grab the required structure and set the data, according apple docs:
            // client
            // The client reference originally passed in the clientContext parameter of the
            // CFNetworkExecuteProxyAutoConfigurationScript or CFNetworkExecuteProxyAutoConfigurationURL call
            // that triggered this callback.
            // Well, that is NOT TRUE, the client passed is the client.Info pointer not the client.
            var pacCbData = (PACProxyCallbackData)Marshal.PtrToStructure(client, typeof(PACProxyCallbackData));

            // make sure is not released, will be released by the parsing method.
            if (proxyList != IntPtr.Zero)
            {
                CFObject.CFRetain(proxyList);
                pacCbData.ProxyListPtr = proxyList;
            }
            if (error != IntPtr.Zero)
            {
                NSObject.DangerousRetain(error);
                pacCbData.ErrorPtr = error;
            }
            // stop the CFRunLoop
            var runLoop = new CFRunLoop(pacCbData.CFRunLoopPtr);

            Marshal.StructureToPtr(pacCbData, client, false);
            runLoop.Stop();
        }
Example #2
0
 public CFDictionary(IntPtr handle, bool owns)
 {
     if (!owns)
     {
         CFObject.CFRetain(handle);
     }
     this.Handle = handle;
 }
Example #3
0
 public CFRunLoopSource(IntPtr handle, bool ownsHandle)
 {
     if (!ownsHandle)
     {
         CFObject.CFRetain(handle);
     }
     this.handle = handle;
 }
Example #4
0
 internal CFRunLoop(IntPtr handle, bool owns)
 {
     if (!owns)
     {
         CFObject.CFRetain(handle);
     }
     this.handle = handle;
 }
Example #5
0
 internal CFUrl(IntPtr handle, bool owned)
 {
     if (!owned)
     {
         CFObject.CFRetain(handle);
     }
     this.handle = handle;
 }
Example #6
0
 public CFAllocator(IntPtr handle, bool owns)
 {
     if (!owns)
     {
         CFObject.CFRetain(handle);
     }
     this.handle = handle;
 }
Example #7
0
 public CFPropertyList(IntPtr handle, bool owns)
 {
     this.handle = handle;
     if (owns == false)
     {
         CFObject.CFRetain(handle);
     }
 }
Example #8
0
 internal CFBoolean(IntPtr handle, bool owns)
 {
     this.handle = handle;
     if (!owns)
     {
         CFObject.CFRetain(handle);
     }
 }
Example #9
0
 public CFMachPort(IntPtr handle, bool ownsHandle)
 {
     if (!ownsHandle)
     {
         CFObject.CFRetain(handle);
     }
     this.handle = handle;
 }
 // If this becomes public for some reason, and more than three instances are created, you should revisit the lookup code
 internal CFNotificationCenter(CFNotificationCenterRef handle, bool ownsHandle)
 {
     if (!ownsHandle)
     {
         CFObject.CFRetain(handle);
     }
     this.handle = handle;
 }
 internal CFMessagePort(IntPtr handle, bool owns)
 {
     this.handle = handle;
     gch         = GCHandle.Alloc(this);
     if (!owns)
     {
         CFObject.CFRetain(handle);
     }
 }
Example #12
0
 internal CFBundle(IntPtr handle, bool owns)
 {
     if (handle == IntPtr.Zero)
     {
         throw new ArgumentNullException("handle");
     }
     this.handle = handle;
     if (!owns)
     {
         CFObject.CFRetain(this.handle);
     }
 }