Ejemplo n.º 1
0
        public void Send(DispatchData?content, NWEndpoint?endpoint, NWContentContext context, Action <NWError?>?handler)
        {
            unsafe {
                if (handler == null)
                {
                    nw_connection_group_send_message(GetCheckedHandle(),
                                                     content.GetHandle(),
                                                     endpoint.GetHandle(),
                                                     context.GetCheckedHandle(),
                                                     null);
                    return;
                }

                BlockLiteral block_handler = new BlockLiteral();
                block_handler.SetupBlockUnsafe(static_SendCompletion, handler);
                try {
                    nw_connection_group_send_message(GetCheckedHandle(),
                                                     content.GetHandle(),
                                                     endpoint.GetHandle(),
                                                     context.GetCheckedHandle(),
                                                     &block_handler);
                } finally {
                    block_handler.CleanupBlock();
                }
            }
        }
Ejemplo n.º 2
0
        public NWPath?GetPath(NWContentContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            var ptr = nw_connection_group_copy_path_for_message(GetCheckedHandle(), context.GetCheckedHandle());

            return(ptr == IntPtr.Zero ? null : new NWPath(ptr, owns: true));
        }
Ejemplo n.º 3
0
        public void Reply(NWContentContext inboundMessage, NWContentContext outboundMessage, DispatchData content)
        {
            if (inboundMessage == null)
            {
                throw new ArgumentNullException(nameof(inboundMessage));
            }
            if (outboundMessage == null)
            {
                throw new ArgumentNullException(nameof(outboundMessage));
            }

            nw_connection_group_reply(GetCheckedHandle(), inboundMessage.GetCheckedHandle(), outboundMessage.GetCheckedHandle(), content.GetHandle());
        }
Ejemplo n.º 4
0
        public NWEndpoint?GetRemmoteEndpoint(NWContentContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            var ptr = nw_connection_group_copy_remote_endpoint_for_message(GetCheckedHandle(), context.GetCheckedHandle());

            return(ptr == IntPtr.Zero ? null : new NWEndpoint(ptr, owns: true));
        }