Exemple #1
0
        private void DataReceived(object sender, string data)
        {
            if (data.Trim() == "")
            {
                return;
            }
            buffer += data;
            if (buffer.EndsWith("!\n"))
            {
                DataPacket packet = new DataPacket();
                var        lines  = buffer.Split("\n");
                for (var i = 0; i < lines.Length; i++)
                {
                    if (lines[i].StartsWith("0-1:24.3"))
                    {
                        packet.ParseLine("0-1:24.2.1" + lines[i + 1]);
                    }
                    else
                    {
                        packet.ParseLine(lines[i]);
                    }
                }

                if (packet.IsValid)
                {
                    OnData?.Invoke(this, packet);
                }
                else
                {
                    Console.WriteLine($"Invalid packet: {packet.ToString()}");
                }
                buffer = "";
            }
        }
Exemple #2
0
        //private
        private async void queryInternal(string q, Tuple <string, dynamic>[] parameters, Guid g)
        {
            command = new MySqlCommand(q, conn);

            if (parameters != null && parameters.Length > 0)
            {
                for (int i = 0; i < parameters.Length; i++)
                {
                    command.Parameters.AddWithValue(parameters[i].Item1, parameters[i].Item2);
                }
            }

            DbDataReader reader = null;

            try {
                reader = await command.ExecuteReaderAsync();
            } catch (Exception ex) {
                OnError?.Invoke(this, new SQLEventArgs(q, parameters, new SQLError()
                {
                    ex = ex
                }, new SQLData(), g));
                return;
            }

            SQLData d = new SQLData();

            d.recordsAffected = reader.RecordsAffected;

            DataColumnCollection columns  = reader.GetSchemaTable().Columns;
            List <string>        tColumns = new List <string>();

            for (int i = 0; i < columns.Count; i++)
            {
                tColumns.Add(columns[i].ColumnName);
            }
            d.columns = tColumns.ToArray();

            List <object[]> tData = new List <object[]>();

            while (await reader.ReadAsync())
            {
                object[] tVals = new object[tColumns.Count];
                reader.GetValues(tVals);
                tData.Add(tVals);
            }

            d.data = new object[tData.Count, tColumns.Count];
            for (int i = 0; i < tData.Count; i++)
            {
                for (int j = 0; j < tColumns.Count; j++)
                {
                    d.data[i, j] = tData[i][j];
                }
            }

            OnData?.Invoke(this, new SQLEventArgs(q, parameters, new SQLError(), d, g));
            new Thread(delegate() {
                sendNext();
            }).Start();
        }
Exemple #3
0
        void Conexion_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            try
            {
                if (OnMessage != null || OnData != null)
                {
                    Thread.Sleep(250);

                    if (Conexion.BytesToRead > 0)
                    {
                        int    count = Conexion.BytesToRead;
                        byte[] Data  = new byte[count];

                        Conexion.Read(Data, 0, count);

                        string Message = Encoding.ASCII.GetString(Data, 0, Data.Length);

                        OnData?.Invoke(Conexion, Data);
                        OnMessage?.Invoke(Conexion, Message);
                    }
                }
            }
            catch (Exception ex)
            {
                OnError?.Invoke(Conexion, ex);
            }
        }
Exemple #4
0
        /// <summary>
        /// Override to submit a task to use the thread pool given to the constructor.
        /// Also wrap the supplied onData, onTimeout and onNetworkNack callbacks in an
        /// outer callback which submits a task to the thread pool to call the supplied
        /// callback. See Face.expressInterest for calling details.
        /// </summary>
        ///
        public override long expressInterest(Interest interest_0, OnData onData,
                                             OnTimeout onTimeout, OnNetworkNack onNetworkNack,
                                             WireFormat wireFormat_1)
        {
            long pendingInterestId_2 = node_.getNextEntryId();

            // Wrap callbacks to submit to the thread pool.
            OnData finalOnData_3  = onData;
            OnData onDataSubmit_4 = new ThreadPoolFace.Anonymous_C14(this, finalOnData_3);

            OnTimeout finalOnTimeout_5  = onTimeout;
            OnTimeout onTimeoutSubmit_6 = (onTimeout == null) ? null
                                        : new ThreadPoolFace.Anonymous_C13(this, finalOnTimeout_5);

            OnNetworkNack finalOnNetworkNack_7  = onNetworkNack;
            OnNetworkNack onNetworkNackSubmit_8 = (onNetworkNack == null) ? null
                                        : new ThreadPoolFace.Anonymous_C12(this, finalOnNetworkNack_7);

            // Make an interest copy as required by Node.expressInterest.
            Interest interestCopy_9 = new Interest(interest_0);

            threadPool_.submit(new ThreadPoolFace.Anonymous_C11(this, onNetworkNackSubmit_8, interestCopy_9,
                                                                onDataSubmit_4, pendingInterestId_2, wireFormat_1, onTimeoutSubmit_6));

            return(pendingInterestId_2);
        }
Exemple #5
0
 private void Received(SocketAsyncEventArgs e)
 {
     try
     {
         if ((e.SocketError == SocketError.Success) && e.AcceptSocket.Connected)
         {
             var userToken = (IUserToken)e.UserToken;
             var buffer    = new byte[e.BytesTransferred];
             Buffer.BlockCopy(userToken.ReceiveArgs.Buffer, e.Offset, buffer, 0, buffer.Length);
             OnData?.Invoke(this, buffer);
             // OnData(this, buffer);
             //Array.Clear(buffer, 0, buffer.Length);
             buffer = null;
             if (clientSocket.Connected)
             {
                 if (!clientSocket.ReceiveAsync(ReceiveSocket))
                 {
                     Received(ReceiveSocket);
                 }
             }
         }
         else
         {
             RaiseOnError(new SocketException((int)SocketError.Shutdown), "已断开服务连接");
             RaiseOnMsg("已断开服务连接166");
         }
     }
     catch (Exception ex)
     {
         RaiseOnError(ex, "ClientSocketOperation.Received");
         RaiseOnMsg("未将对象设置为引用172" + ex.ToString() + clientSocket.Connected);
     }
 }
        /// <summary>
        /// Override to submit a task to use the thread pool given to the constructor.
        /// Also wrap the supplied onData, onTimeout and onNetworkNack callbacks in an
        /// outer callback which submits a task to the thread pool to call the supplied
        /// callback. See Face.expressInterest for calling details.
        /// </summary>
        ///
        public override long expressInterest(Interest interest_0, OnData onData,
				OnTimeout onTimeout, OnNetworkNack onNetworkNack,
				WireFormat wireFormat_1)
        {
            long pendingInterestId_2 = node_.getNextEntryId();

            // Wrap callbacks to submit to the thread pool.
            OnData finalOnData_3 = onData;
            OnData onDataSubmit_4 = new ThreadPoolFace.Anonymous_C14 (this, finalOnData_3);

            OnTimeout finalOnTimeout_5 = onTimeout;
            OnTimeout onTimeoutSubmit_6 = (onTimeout == null) ? null
                    : new ThreadPoolFace.Anonymous_C13 (this, finalOnTimeout_5);

            OnNetworkNack finalOnNetworkNack_7 = onNetworkNack;
            OnNetworkNack onNetworkNackSubmit_8 = (onNetworkNack == null) ? null
                    : new ThreadPoolFace.Anonymous_C12 (this, finalOnNetworkNack_7);

            // Make an interest copy as required by Node.expressInterest.
            Interest interestCopy_9 = new Interest(interest_0);
            threadPool_.submit(new ThreadPoolFace.Anonymous_C11 (this, onNetworkNackSubmit_8, onDataSubmit_4,
                    interestCopy_9, onTimeoutSubmit_6, pendingInterestId_2, wireFormat_1));

            return pendingInterestId_2;
        }
Exemple #7
0
        /// <summary>
        /// Override to submit a task to use the thread pool given to the constructor.
        /// Also wrap the supplied onData, onTimeout and onNetworkNack callbacks in an
        /// outer callback which submits a task to the thread pool to call the supplied
        /// callback. See Face.expressInterest for calling details. We make a separate
        /// expressInterest overload for supplying a Name vs. Interest to avoid making
        /// multiple copies of the Interest.
        /// </summary>
        ///
        public override long expressInterest(Name name, Interest interestTemplate,
                                             OnData onData, OnTimeout onTimeout,
                                             OnNetworkNack onNetworkNack, WireFormat wireFormat_0)
        {
            long pendingInterestId_1 = node_.getNextEntryId();

            // Wrap callbacks to submit to the thread pool.
            OnData finalOnData_2  = onData;
            OnData onDataSubmit_3 = new ThreadPoolFace.Anonymous_C10(this, finalOnData_2);

            OnTimeout finalOnTimeout_4  = onTimeout;
            OnTimeout onTimeoutSubmit_5 = (onTimeout == null) ? null
                                        : new ThreadPoolFace.Anonymous_C9(this, finalOnTimeout_4);

            OnNetworkNack finalOnNetworkNack_6  = onNetworkNack;
            OnNetworkNack onNetworkNackSubmit_7 = (onNetworkNack == null) ? null
                                        : new ThreadPoolFace.Anonymous_C8(this, finalOnNetworkNack_6);

            // Make an interest copy as required by Node.expressInterest.
            Interest interestCopy_8 = net.named_data.jndn.Face.getInterestCopy(name, interestTemplate);

            threadPool_.submit(new ThreadPoolFace.Anonymous_C7(this, onTimeoutSubmit_5, onDataSubmit_3, interestCopy_8,
                                                               wireFormat_0, pendingInterestId_1, onNetworkNackSubmit_7));

            return(pendingInterestId_1);
        }
Exemple #8
0
            private async Task WorkerAsync()
            {
                try
                {
                    using (var reader = new StreamReader(_stream, Encoding.UTF8,
                                                         detectEncodingFromByteOrderMarks: false,
                                                         4096,
                                                         leaveOpen: true))
                    {
                        while (true)
                        {
                            var line = await reader.ReadLineAsync();

                            if (line == null)
                            {
                                return;
                            }

                            Debug.WriteLine("RECEIVED : " + line);
                            OnData?.Invoke(line);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("WORKER CRASHED: " + ex.Message);
                }
            }
        public async void SetLinearMode()
        {
            await this.DirectSet("/gp/gpWebcam/SETTINGS?fov=4");

            Lens = 4;
            OnData?.Invoke(this, null);
        }
        async void Connect()
        {
            try
            {
                Socket = new System.Net.WebSockets.ClientWebSocket();
                await Socket.ConnectAsync(new Uri(this.Url), CancellationToken.None);

                var receiveBytes  = new byte[4096];
                var receiveBuffer = new ArraySegment <byte>(receiveBytes);

                while (Socket.State == WebSocketState.Open)
                {
                    var receivedMessage = await Socket.ReceiveAsync(receiveBuffer, CancellationToken.None);

                    if (receivedMessage.MessageType == WebSocketMessageType.Close)
                    {
                        await
                        Socket.CloseAsync(WebSocketCloseStatus.NormalClosure, "closing websocket",
                                          CancellationToken.None);
                    }
                    else
                    {
                        var messageBytes = receiveBuffer.Skip(receiveBuffer.Offset).Take(receivedMessage.Count).ToArray();

                        var rawMessage = new UTF8Encoding().GetString(messageBytes);
                        OnData.Invoke(this, rawMessage);
                    }
                }
            }
            catch (System.Exception)
            {
                Connect();
            }
        }
            public override long expressInterest(Interest interest, OnData onData,
                                                 OnTimeout onTimeout, OnNetworkNack onNetworkNack,
                                                 WireFormat wireFormat)
            {
                if (interest.matchesName(contentData_.getName()))
                {
                    contentCount_[0] = 1;
                    onData.onData(interest, contentData_);
                }
                else if (interest.matchesName(cKeyData_.getName()))
                {
                    cKeyCount_[0] = 1;
                    onData.onData(interest, cKeyData_);
                }
                else if (interest.matchesName(dKeyData_.getName()))
                {
                    dKeyCount_[0] = 1;
                    onData.onData(interest, dKeyData_);
                }
                else
                {
                    onTimeout.onTimeout(interest);
                }

                return(0);
            }
            public override long expressInterest(Interest interest, OnData onData,
                                                 OnTimeout onTimeout, OnNetworkNack onNetworkNack,
                                                 WireFormat wireFormat)
            {
                try {
                    Assert.AssertEquals(3, interest.getLink().getDelegations().size());
                } catch (EncodingException ex) {
                    Assert.Fail("Error in getLink: " + ex);
                }

                if (interest.matchesName(contentData_.getName()))
                {
                    contentCount_[0] = 1;
                    onData.onData(interest, contentData_);
                }
                else if (interest.matchesName(cKeyData_.getName()))
                {
                    cKeyCount_[0] = 1;
                    onData.onData(interest, cKeyData_);
                }
                else if (interest.matchesName(dKeyData_.getName()))
                {
                    dKeyCount_[0] = 1;
                    onData.onData(interest, dKeyData_);
                }
                else
                {
                    onTimeout.onTimeout(interest);
                }

                return(0);
            }
Exemple #13
0
        private async Task ReadData()
        {
            if (tcpClient.Connected)
            {
                using (var stream = tcpClient.GetStream())
                {
                    while (!cancellationTokenSource.IsCancellationRequested)
                    {
                        var dataRead = await stream.ReadAsync(readBuffer, 0, readBuffer.Length, cancellationTokenSource.Token);

                        if (dataRead > 0)
                        {
                            OnData?.Invoke(this, new DataEventArgs {
                                Data = readBuffer.Take(dataRead).ToArray()
                            });
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            Closed?.Invoke(this, null);
        }
        public async void Reader()
        {
            var cancelToken = CancellationToken.None;
            var headBuffer  = new byte[8];
            var headSegment = new ArraySegment <byte>(headBuffer);

            do
            {
                var received = await socket.ReceiveAsync(headSegment, cancelToken);

                if (received.CloseStatus.HasValue)
                {
                    OnClose?.Invoke();
                    return;
                }
                var type   = BitConverter.ToInt32(headBuffer, ProtocolTypePosition);
                var length = BitConverter.ToInt32(headBuffer, ProtocolLengthPosition);

                var bodyBuffer  = new byte[length];
                var bodySegment = new ArraySegment <byte>(bodyBuffer);

                received = await socket.ReceiveAsync(bodySegment, cancelToken);

                if (received.CloseStatus.HasValue)
                {
                    OnClose?.Invoke();
                    return;
                }
                OnData?.Invoke(type, bodyBuffer);
            } while (!socket.CloseStatus.HasValue);

            OnClose?.Invoke();
            await socket.CloseAsync(socket.CloseStatus.Value, socket.CloseStatusDescription, cancelToken);
        }
Exemple #15
0
        private void mk_play_data(IntPtr userdata, int track_type, int codec_id, IntPtr data, int len, uint dts, uint pts)
        {
            unsafe
            {
                var a = new Span <byte>(data.ToPointer(), len).ToArray();
            }
            var mediaInfo = new MediaPlayInfo
            {
                Codec   = (EM_Codec)codec_id,
                Data    = data,
                Dts     = dts,
                IsVideo = track_type == 0,
                Length  = len,
                Pts     = pts
            };

            if (this.OnDataAsync != null)
            {
                mediaInfo.FillData(true);
                _ = Task.Run(() => OnDataAsync.Invoke(mediaInfo));
            }
            else if (this.OnData != null)
            {
                OnData.Invoke(mediaInfo);
            }
        }
Exemple #16
0
        protected virtual void receiver()
        {
            recvCache = new List <byte>();
            while (!receiving)
            {
                Thread.Sleep(Consts.CheckIntervalMilli);
            }

            while (receiving)
            {
                if (client.Available == 0)
                {
                    Thread.Sleep(Consts.CheckIntervalMilli); continue;
                }

                bool invoking = recvCache.Count == 0;

                int count = client.Available;
                var cache = new byte[count];
                client.Client.Receive(cache, count, SocketFlags.None);
                recvCache.AddRange(cache); // note that List.AddRange will treat byte[] as ICollection<byte>

                if (invoking)
                {
                    OnData?.Invoke(this, new TalknetTcpClientDataEventArgs());
                }
            }

            recvCache = null;
        }
        public async void SetNarrowMode()
        {
            await this.DirectSet("/gp/gpWebcam/SETTINGS?fov=6");

            Lens = 6;
            OnData?.Invoke(this, null);
        }
Exemple #18
0
    public CustomSocket(OnData onData, OnStatus onStatus)
    {
        this._onData   = onData;
        this._onStatus = onStatus;

        this._status = SocketStatus.UNDEFINE;
    }
Exemple #19
0
        private void _ReceiveThread()
        {
            try
            {
                var isOpen     = _isOpen;
                var buffer     = new byte[BufferSize];
                var remoteIPEP = (EndPoint) new IPEndPoint(IPAddress.Any, 0);

                while (isOpen.Value)
                {
                    var recSize = _socket.ReceiveFrom(buffer, 0, BufferSize, SocketFlags.None, ref remoteIPEP);
                    var packet  = new byte[recSize];
                    Array.Copy(buffer, packet, recSize);
                    OnData?.Invoke((IPEndPoint)remoteIPEP, packet);
                }
            }
            catch (ThreadAbortException)
            {
            }
            catch (Exception ex)
            {
                _Cleanup();
                OnStop?.Invoke(ex);
            }
        }
        public async void SetWideMode()
        {
            await this.DirectSet("/gp/gpWebcam/SETTINGS?fov=0");

            Lens = 0;
            OnData?.Invoke(this, null);
        }
Exemple #21
0
        private void ReadAllFromQueue()
        {
            LinError readResult;

            do
            {
                ReceivedMessage msg;

                readResult = PLinApi.Read(_clientHandle, out msg);
                var(processorResult, processorMessage) = MessageProcessor.Process(readResult, msg);

                switch (processorResult)
                {
                case MessageProcessorResult.EmptyQueue:
                    break;

                case MessageProcessorResult.Error:
                case MessageProcessorResult.Info:
                    OnError?.Invoke(this, processorMessage);
                    break;

                case MessageProcessorResult.Regular:
                    OnData?.Invoke(this, msg.Data);
                    break;

                default:
                    throw new NotImplementedException();
                }
            } while (readResult == LinError.Ok);
        }
Exemple #22
0
        public async void Reader()
        {
            var headBuffer = new byte[8];

            while (socket.Connected)
            {
                if (!await stream.ReadAll(headBuffer, headBuffer.Length))
                {
                    OnClose?.Invoke();
                    return;
                }

                var type   = BitConverter.ToInt32(headBuffer, ProtocolTypePosition);
                var length = BitConverter.ToInt32(headBuffer, ProtocolLengthPosition);

                var bodyBuffer = new byte[length];

                if (!await stream.ReadAll(bodyBuffer, length))
                {
                    OnClose?.Invoke();
                    return;
                }

                OnData?.Invoke(type, bodyBuffer);
            }
        }
Exemple #23
0
 private void Received(SocketAsyncEventArgs e)
 {
     try
     {
         if ((e.SocketError == SocketError.Success) && e.AcceptSocket.Connected)
         {
             var userToken = (IUserToken)e.UserToken;
             var buffer    = new byte[e.BytesTransferred];
             Buffer.BlockCopy(userToken.ReceiveArgs.Buffer, e.Offset, buffer, 0, buffer.Length);
             OnData?.BeginInvoke(this, buffer, null, null);
             if (clientSocket.Connected)
             {
                 if (!clientSocket.ReceiveAsync(ReceiveSocket))
                 {
                     Received(ReceiveSocket);
                 }
             }
         }
         else
         {
             RaiseOnError(new SocketException((int)SocketError.Shutdown), "已断开服务连接");
         }
     }
     catch (Exception ex)
     {
         RaiseOnError(ex, "ClientSocketOperation.Received");
     }
 }
Exemple #24
0
        public async void SetRes1080()
        {
            await Stop();

            Resolution = "1080";
            OnData?.Invoke(this, null);
            Start();
        }
Exemple #25
0
        public void OnNext(StreamData <GazePointData> value)
        {
            double x  = value.Data.X;
            double y  = value.Data.Y;
            double ts = value.Data.Timestamp;

            OnData?.Invoke(this, new ReceivedDataEventArgs(new Point(x, y), ts));
        }
Exemple #26
0
 public Anonymous_C1(Consumer paramouter_Consumer, Interest interest_0,
                     OnData onData_1, net.named_data.jndn.encrypt.EncryptError.OnError onError_2)
 {
     this.interest       = interest_0;
     this.onData         = onData_1;
     this.onError        = onError_2;
     this.outer_Consumer = paramouter_Consumer;
 }
Exemple #27
0
        public async Task <GoProStatus> GetStatus()
        {
            var status = await Get <GoProStatus>("/gp/gpControl/status");

            this.HandleStatusResponse(status);
            OnData?.Invoke(this, null);
            return(status);
        }
Exemple #28
0
 public PackClientSide(Socket clientSocket, IPEndPoint remoteEndPoint)
     : base(clientSocket, remoteEndPoint)
 {
     m_onData = new OnData(OnDataReceived);
     m_onMsgRead4Tx = new OnMessageReadyToTx(OnMsgRead4Tx);
     m_onEnd = new OnEnd(OnTransationEnd);
     m_receiverPackLib = new ReceiverPackLib.ReceiverPackLib(m_Id,m_onData, m_onEnd, null, m_onMsgRead4Tx);
 }
Exemple #29
0
 public PackClientSide(Socket clientSocket, IPEndPoint remoteEndPoint)
     : base(clientSocket, remoteEndPoint)
 {
     m_onData          = new OnData(OnDataReceived);
     m_onMsgRead4Tx    = new OnMessageReadyToTx(OnMsgRead4Tx);
     m_onEnd           = new OnEnd(OnTransationEnd);
     m_receiverPackLib = new ReceiverPackLib.ReceiverPackLib(m_Id, m_onData, m_onEnd, null, m_onMsgRead4Tx);
 }
Exemple #30
0
 public void ReceiveData(string data)
 {
     if (OnData.HasDelegate)
     {
         byte[] byteArray = ANSIEncoder.GetBytes(data);
         OnData.InvokeAsync(byteArray);
     }
 }
Exemple #31
0
 /// <summary>
 /// Create a new ExponentialReExpress where onTimeout expresses the interest
 /// again with double the interestLifetime. If the interesLifetime goes over
 /// maxInterestLifetime, then call the given onTimeout. If this internally
 /// gets onData, just call the given onData.
 /// </summary>
 ///
 private ExponentialReExpress(Face face, OnData onData, OnTimeout onTimeout,
                              double maxInterestLifetime)
 {
     face_                = face;
     callerOnData_        = onData;
     callerOnTimeout_     = onTimeout;
     maxInterestLifetime_ = maxInterestLifetime;
 }
Exemple #32
0
            public void processInterest(Interest interest, OnData onData,
                                        OnTimeout onTimeout, OnNetworkNack onNetworkNack)
            {
                NetworkNack networkNack = new NetworkNack();

                networkNack.setReason(net.named_data.jndn.NetworkNack.Reason.NO_ROUTE);

                onNetworkNack.onNetworkNack(interest, networkNack);
            }
        public PendingInterestTable.Entry add(long pendingInterestId,
				Interest interestCopy, OnData onData, OnTimeout onTimeout,
				OnNetworkNack onNetworkNack)
        {
            int removeRequestIndex = removeRequests_.indexOf(pendingInterestId);
            if (removeRequestIndex >= 0) {
                // removePendingInterest was called with the pendingInterestId returned by
                //   expressInterest before we got here, so don't add a PIT entry.
                ILOG.J2CsMapping.Collections.Collections.RemoveAt(removeRequests_,removeRequestIndex);
                return null;
            }

            PendingInterestTable.Entry  entry = new PendingInterestTable.Entry (pendingInterestId, interestCopy, onData,
                    onTimeout, onNetworkNack);
            ILOG.J2CsMapping.Collections.Collections.Add(table_,entry);
            return entry;
        }
Exemple #34
0
        /// <summary>
        /// Encode name as an Interest. If interestTemplate is not null, use its
        /// interest selectors.
        /// Send the Interest through the transport, read the entire response and call
        /// onData or onTimeout as described below.
        /// This uses the default WireFormat.getDefaultWireFormat().
        /// </summary>
        ///
        /// <param name="name">A Name for the interest. This copies the Name.</param>
        /// <param name="interestTemplate"></param>
        /// <param name="onData">expressInterest and data is the received Data object. NOTE: You must not change the interest object - if you need to change it then make a copy. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="onTimeout">interest given to expressInterest. If onTimeout is null, this does not use it. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <returns>The pending interest ID which can be used with
        /// removePendingInterest.</returns>
        /// <exception cref="IOException">For I/O error in sending the interest.</exception>
        /// <exception cref="System.Exception">If the encoded interest size exceeds getMaxNdnPacketSize().</exception>
        public long expressInterest(Name name, Interest interestTemplate,
				OnData onData, OnTimeout onTimeout)
        {
            return expressInterest(name, interestTemplate, onData, onTimeout,
                    net.named_data.jndn.encoding.WireFormat.getDefaultWireFormat());
        }
Exemple #35
0
        /// <summary>
        /// Encode name as an Interest. If interestTemplate is not null, use its
        /// interest selectors.
        /// Send the Interest through the transport, read the entire response and call
        /// onData or onTimeout as described below.
        /// </summary>
        ///
        /// <param name="name">A Name for the interest. This copies the Name.</param>
        /// <param name="interestTemplate"></param>
        /// <param name="onData">expressInterest and data is the received Data object. NOTE: You must not change the interest object - if you need to change it then make a copy. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="onTimeout">interest given to expressInterest. If onTimeout is null, this does not use it. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="wireFormat">A WireFormat object used to encode the message.</param>
        /// <returns>The pending interest ID which can be used with
        /// removePendingInterest.</returns>
        /// <exception cref="IOException">For I/O error in sending the interest.</exception>
        /// <exception cref="System.Exception">If the encoded interest size exceeds getMaxNdnPacketSize().</exception>
        public long expressInterest(Name name, Interest interestTemplate,
				OnData onData, OnTimeout onTimeout, WireFormat wireFormat)
        {
            return expressInterest(name, interestTemplate, onData, onTimeout, null,
                    wireFormat);
        }
Exemple #36
0
        /// <summary>
        /// Encode name as an Interest, using a default interest lifetime.
        /// Send the Interest through the transport, read the entire response and call
        /// onData, onTimeout or onNetworkNack as described below.
        /// This uses the default WireFormat.getDefaultWireFormat().
        /// </summary>
        ///
        /// <param name="name">A Name for the interest. This copies the Name.</param>
        /// <param name="onData">expressInterest and data is the received Data object. NOTE: You must not change the interest object - if you need to change it then make a copy. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="onTimeout">interest given to expressInterest. If onTimeout is null, this does not use it. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="onNetworkNack">onNetworkNack.onNetworkNack(interest, networkNack) and does not call onTimeout. However, if a network Nack is received and onNetworkNack is null, do nothing and wait for the interest to time out. (Therefore, an application which does not yet process a network Nack reason treats a Nack the same as a timeout.) NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <returns>The pending interest ID which can be used with
        /// removePendingInterest.</returns>
        /// <exception cref="IOException">For I/O error in sending the interest.</exception>
        /// <exception cref="System.Exception">If the encoded interest size exceeds getMaxNdnPacketSize().</exception>
        public long expressInterest(Name name, OnData onData, OnTimeout onTimeout,
				OnNetworkNack onNetworkNack)
        {
            return expressInterest(name, null, onData, onTimeout, onNetworkNack,
                    net.named_data.jndn.encoding.WireFormat.getDefaultWireFormat());
        }
Exemple #37
0
        /// <summary>
        /// Encode name as an Interest, using a default interest lifetime.
        /// Send the Interest through the transport, read the entire response and call
        /// onData, onTimeout or onNetworkNack as described below.
        /// </summary>
        ///
        /// <param name="name">A Name for the interest. This copies the Name.</param>
        /// <param name="onData">expressInterest and data is the received Data object. NOTE: You must not change the interest object - if you need to change it then make a copy. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="onTimeout">interest given to expressInterest. If onTimeout is null, this does not use it. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="onNetworkNack">onNetworkNack.onNetworkNack(interest, networkNack) and does not call onTimeout. However, if a network Nack is received and onNetworkNack is null, do nothing and wait for the interest to time out. (Therefore, an application which does not yet process a network Nack reason treats a Nack the same as a timeout.) NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="wireFormat">A WireFormat object used to encode the message.</param>
        /// <returns>The pending interest ID which can be used with
        /// removePendingInterest.</returns>
        /// <exception cref="IOException">For I/O error in sending the interest.</exception>
        /// <exception cref="System.Exception">If the encoded interest size exceeds getMaxNdnPacketSize().</exception>
        public long expressInterest(Name name, OnData onData, OnTimeout onTimeout,
				OnNetworkNack onNetworkNack, WireFormat wireFormat)
        {
            return expressInterest(name, null, onData, onTimeout, onNetworkNack,
                    wireFormat);
        }
			public long expressInterest(Interest interest, OnData onData,
					OnTimeout onTimeout, OnNetworkNack onNetworkNack,
					WireFormat wireFormat) throws IOException {
            public Anonymous_C14(ThreadPoolFace paramouter_ThreadPoolFace,
						OnData finalOnData_0)
            {
                this.finalOnData = finalOnData_0;
                    this.outer_ThreadPoolFace = paramouter_ThreadPoolFace;
            }
            /// <summary>
            /// Create a new Entry with the given fields. Note: You should not call this
            /// directly but call PendingInterestTable.add.
            /// </summary>
            ///
            public Entry(long pendingInterestId, Interest interest, OnData onData,
					OnTimeout onTimeout, OnNetworkNack onNetworkNack)
            {
                this.isRemoved_ = false;
                pendingInterestId_ = pendingInterestId;
                interest_ = interest;
                onData_ = onData;
                onTimeout_ = onTimeout;
                onNetworkNack_ = onNetworkNack;
            }
Exemple #41
0
 /// <summary>
 /// Encode name as an Interest, using a default interest lifetime.
 /// Send the Interest through the transport, read the entire response and call
 /// onData as described below.
 /// Ignore if the interest times out.
 /// </summary>
 ///
 /// <param name="name">A Name for the interest. This copies the Name.</param>
 /// <param name="onData">expressInterest and data is the received Data object. NOTE: You must not change the interest object - if you need to change it then make a copy. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
 /// <param name="wireFormat">A WireFormat object used to encode the message.</param>
 /// <returns>The pending interest ID which can be used with
 /// removePendingInterest.</returns>
 /// <exception cref="IOException">For I/O error in sending the interest.</exception>
 /// <exception cref="System.Exception">If the encoded interest size exceeds getMaxNdnPacketSize().</exception>
 public long expressInterest(Name name, OnData onData, WireFormat wireFormat)
 {
     return expressInterest(name, null, onData, null, wireFormat);
 }
Exemple #42
0
            public Anonymous_C3(Node paramouter_Node, Interest interestCopy_0,
						OnNetworkNack onNetworkNack_1, Face face_2, OnTimeout onTimeout_3,
						long pendingInterestId_4, WireFormat wireFormat_5, OnData onData_6)
            {
                this.interestCopy = interestCopy_0;
                    this.onNetworkNack = onNetworkNack_1;
                    this.face = face_2;
                    this.onTimeout = onTimeout_3;
                    this.pendingInterestId = pendingInterestId_4;
                    this.wireFormat = wireFormat_5;
                    this.onData = onData_6;
                    this.outer_Node = paramouter_Node;
            }
Exemple #43
0
        void DoTest(object arg)
        {
            string fileName = (string)arg;
            UpdateControls updateControls = new UpdateControls(Update_Controls);
            if (File.Exists("received_file"))
            {
                File.Delete("received_file");
            }
            FileStream fs = File.OpenRead(fileName);
            if (fs == null)
            {
                return;
            }
            byte[] raw_file = new byte[fs.Length];
            if (fs.Read(raw_file, 0, raw_file.Length) != raw_file.Length)
            {
                return;
            }
            fs.Close();
            fs = null;
            DateTime initialStamp,finishStamp;
            bool firstIteration = true;
            ulong ticks_sum = 0;
            ulong iterations = 0;
            byte[] buf;

            OnData onData = new OnData(OnDataReceived);
            OnEnd onEnd = new OnEnd(OnTransactionEnd);

            do
            {
                initialStamp = DateTime.Now;
                buf = raw_file;

                if (File.Exists("received_file"))
                {
                    File.Delete("received_file");
                }

                ReceiverPackLib.ReceiverPackLib receiverPackLib = new ReceiverPackLib.ReceiverPackLib(onData,onEnd,null);
                SenderPackLib.SenderPackLib senderPackLib = new SenderPackLib.SenderPackLib(buf);
                senderPackLib.AddData(buf,false);
            #if false
                senderPackLib.AddLast();
                bool SameChunk;
                while ((buf = senderPackLib.GetChunk(out SameChunk)) != null)
                {
                    byte[] predMsg = receiverPackLib.ReceiverOnData(buf,0);
                    if (predMsg != null)
                    {
                        byte[] predAckMsg = senderPackLib.SenderOnData(predMsg, 0);
                        receiverPackLib.ReceiverOnData(predAckMsg, 0);
                    }
                }
            #endif
                finishStamp = DateTime.Now;
                object[] args = new object[4];
                args[0] = firstIteration;
                if (firstIteration)
                {
                    args[1] = (ulong)(finishStamp.Ticks - initialStamp.Ticks);
                    firstIteration = false;
                }
                else
                {
                    ticks_sum += (ulong)(finishStamp.Ticks - initialStamp.Ticks);
                    iterations++;
                    args[1] = ticks_sum / iterations;
                }
                args[2] = (ulong)iterations;
                args[3] = true;
                Invoke(updateControls, args);
                while (checkBoxPause.Checked)
                {
                    Thread.Sleep(1000);
                }
            } while (checkBoxDoUntilStopped.Checked);
        }
Exemple #44
0
        /// <summary>
        /// Send the Interest through the transport, read the entire response and call
        /// onData, onTimeout or onNetworkNack as described below.
        /// </summary>
        ///
        /// <param name="pendingInterestId"></param>
        /// <param name="interestCopy">to use.</param>
        /// <param name="onData">expressInterest and data is the received Data object.</param>
        /// <param name="onTimeout">interest given to expressInterest. If onTimeout is null, this does not use it.</param>
        /// <param name="onNetworkNack">onNetworkNack.onNetworkNack(interest, networkNack) and does not call onTimeout. However, if a network Nack is received and onNetworkNack is null, do nothing and wait for the interest to time out.</param>
        /// <param name="wireFormat">A WireFormat object used to encode the message.</param>
        /// <param name="face"></param>
        /// <exception cref="IOException">For I/O error in sending the interest.</exception>
        /// <exception cref="System.Exception">If the encoded interest size exceeds getMaxNdnPacketSize().</exception>
        public void expressInterest(long pendingInterestId,
				Interest interestCopy, OnData onData,
				OnTimeout onTimeout, OnNetworkNack onNetworkNack,
				WireFormat wireFormat, Face face)
        {
            // Set the nonce in our copy of the Interest so it is saved in the PIT.
            interestCopy.setNonce(nonceTemplate_);
            interestCopy.refreshNonce();

            if (connectStatus_ == net.named_data.jndn.Node.ConnectStatus.CONNECT_COMPLETE) {
                // We are connected. Simply send the interest without synchronizing.
                expressInterestHelper(pendingInterestId, interestCopy, onData,
                        onTimeout, onNetworkNack, wireFormat, face);
                return;
            }

             lock (onConnectedCallbacks_) {
                        // TODO: Properly check if we are already connected to the expected host.
                        if (!transport_.isAsync()) {
                            // The simple case: Just do a blocking connect and express.
                            transport_.connect(connectionInfo_, this, null);
                            expressInterestHelper(pendingInterestId, interestCopy, onData,
                                    onTimeout, onNetworkNack, wireFormat, face);
                            // Make future calls to expressInterest send directly to the Transport.
                            connectStatus_ = net.named_data.jndn.Node.ConnectStatus.CONNECT_COMPLETE;

                            return;
                        }

                        // Handle the async case.
                        if (connectStatus_ == net.named_data.jndn.Node.ConnectStatus.UNCONNECTED) {
                            connectStatus_ = net.named_data.jndn.Node.ConnectStatus.CONNECT_REQUESTED;

                            // expressInterestHelper will be called by onConnected.
                            ILOG.J2CsMapping.Collections.Collections.Add(onConnectedCallbacks_,new Node.Anonymous_C3 (this, interestCopy, onNetworkNack, face,
                                                    onTimeout, pendingInterestId, wireFormat, onData));

                            IRunnable onConnected = new Node.Anonymous_C2 (this);
                            transport_.connect(connectionInfo_, this, onConnected);
                        } else if (connectStatus_ == net.named_data.jndn.Node.ConnectStatus.CONNECT_REQUESTED) {
                            // Still connecting. add to the interests to express by onConnected.
                            ILOG.J2CsMapping.Collections.Collections.Add(onConnectedCallbacks_,new Node.Anonymous_C1 (this, interestCopy, onData, onTimeout,
                                                    onNetworkNack, wireFormat, face, pendingInterestId));
                        } else if (connectStatus_ == net.named_data.jndn.Node.ConnectStatus.CONNECT_COMPLETE)
                            // We have to repeat this check for CONNECT_COMPLETE in case the
                            // onConnected callback was called while we were waiting to enter this
                            // synchronized block.
                            expressInterestHelper(pendingInterestId, interestCopy, onData,
                                    onTimeout, onNetworkNack, wireFormat, face);
                        else
                            // Don't expect this to happen.
                            throw new Exception("Node: Unrecognized _connectStatus "
                                    + connectStatus_);
                    }
        }
Exemple #45
0
        /// <summary>
        /// Do the work of expressInterest once we know we are connected. Add the entry
        /// to the PIT, encode and send the interest.
        /// </summary>
        ///
        /// <param name="pendingInterestId"></param>
        /// <param name="interestCopy"></param>
        /// <param name="onData"></param>
        /// <param name="onTimeout"></param>
        /// <param name="onNetworkNack"></param>
        /// <param name="wireFormat">A WireFormat object used to encode the message.</param>
        /// <param name="face"></param>
        /// <exception cref="IOException">For I/O error in sending the interest.</exception>
        /// <exception cref="System.Exception">If the encoded interest size exceeds getMaxNdnPacketSize().</exception>
        internal void expressInterestHelper(long pendingInterestId,
				Interest interestCopy, OnData onData, OnTimeout onTimeout,
				OnNetworkNack onNetworkNack, WireFormat wireFormat, Face face)
        {
            PendingInterestTable.Entry pendingInterest = pendingInterestTable_
                    .add(pendingInterestId, interestCopy, onData, onTimeout,
                            onNetworkNack);
            if (pendingInterest == null)
                // removePendingInterest was already called with the pendingInterestId.
                return;

            if (onTimeout != null
                    || interestCopy.getInterestLifetimeMilliseconds() >= 0.0d) {
                // Set up the timeout.
                double delayMilliseconds = interestCopy
                        .getInterestLifetimeMilliseconds();
                if (delayMilliseconds < 0.0d)
                    // Use a default timeout delay.
                    delayMilliseconds = 4000.0d;

                face.callLater(delayMilliseconds, new Node.Anonymous_C0 (this, pendingInterest));
            }

            // Special case: For timeoutPrefix_ we don't actually send the interest.
            if (!timeoutPrefix_.match(interestCopy.getName())) {
                Blob encoding = interestCopy.wireEncode(wireFormat);
                if (encoding.size() > getMaxNdnPacketSize())
                    throw new Exception(
                            "The encoded interest size exceeds the maximum limit getMaxNdnPacketSize()");
                transport_.send(encoding.buf());
            }
        }
Exemple #46
0
 /// <summary>
 /// Encode name as an Interest, using a default interest lifetime.
 /// Send the Interest through the transport, read the entire response and call
 /// onData as described below.
 /// Ignore if the interest times out.
 /// This uses the default WireFormat.getDefaultWireFormat().
 /// </summary>
 ///
 /// <param name="name">A Name for the interest. This copies the Name.</param>
 /// <param name="onData">expressInterest and data is the received Data object. NOTE: You must not change the interest object - if you need to change it then make a copy. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
 /// <returns>The pending interest ID which can be used with
 /// removePendingInterest.</returns>
 /// <exception cref="IOException">For I/O error in sending the interest.</exception>
 /// <exception cref="System.Exception">If the encoded interest size exceeds getMaxNdnPacketSize().</exception>
 public long expressInterest(Name name, OnData onData)
 {
     return expressInterest(name, null, onData, null,
             net.named_data.jndn.encoding.WireFormat.getDefaultWireFormat());
 }
Exemple #47
0
        /// <summary>
        /// Send the Interest through the transport, read the entire response and call
        /// onData, onTimeout or onNetworkNack as described below.
        /// </summary>
        ///
        /// <param name="interest">The Interest to send.  This copies the Interest.</param>
        /// <param name="onData">expressInterest and data is the received Data object. NOTE: You must not change the interest object - if you need to change it then make a copy. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="onTimeout">interest given to expressInterest. If onTimeout is null, this does not use it. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="onNetworkNack">onNetworkNack.onNetworkNack(interest, networkNack) and does not call onTimeout. However, if a network Nack is received and onNetworkNack is null, do nothing and wait for the interest to time out. (Therefore, an application which does not yet process a network Nack reason treats a Nack the same as a timeout.) NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="wireFormat">A WireFormat object used to encode the message.</param>
        /// <returns>The pending interest ID which can be used with
        /// removePendingInterest.</returns>
        /// <exception cref="IOException">For I/O error in sending the interest.</exception>
        /// <exception cref="System.Exception">If the encoded interest size exceeds getMaxNdnPacketSize().</exception>
        public virtual long expressInterest(Interest interest, OnData onData,
				OnTimeout onTimeout, OnNetworkNack onNetworkNack,
				WireFormat wireFormat)
        {
            long pendingInterestId = node_.getNextEntryId();

            // This copies the interest as required by Node.expressInterest.
            node_.expressInterest(pendingInterestId, interest, onData, onTimeout,
                    onNetworkNack, wireFormat, this);

            return pendingInterestId;
        }
Exemple #48
0
        /// <summary>
        /// Send the Interest through the transport, read the entire response and call
        /// onData or onTimeout as described below.
        /// This uses the default WireFormat.getDefaultWireFormat().
        /// </summary>
        ///
        /// <param name="interest">The Interest to send.  This copies the Interest.</param>
        /// <param name="onData">expressInterest and data is the received Data object. NOTE: You must not change the interest object - if you need to change it then make a copy. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="onTimeout">interest given to expressInterest. If onTimeout is null, this does not use it. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <returns>The pending interest ID which can be used with
        /// removePendingInterest.</returns>
        /// <exception cref="IOException">For I/O error in sending the interest.</exception>
        /// <exception cref="System.Exception">If the encoded interest size exceeds getMaxNdnPacketSize().</exception>
        public long expressInterest(Interest interest, OnData onData,
				OnTimeout onTimeout)
        {
            return expressInterest(interest, onData, onTimeout,
                    net.named_data.jndn.encoding.WireFormat.getDefaultWireFormat());
        }
Exemple #49
0
        /// <summary>
        /// Send the Interest through the transport, read the entire response and call
        /// onData as described below.
        /// Ignore if the interest times out.
        /// </summary>
        ///
        /// <param name="interest">The Interest to send.  This copies the Interest.</param>
        /// <param name="onData">expressInterest and data is the received Data object. NOTE: You must not change the interest object - if you need to change it then make a copy. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="wireFormat">A WireFormat object used to encode the message.</param>
        /// <returns>The pending interest ID which can be used with
        /// removePendingInterest.</returns>
        /// <exception cref="IOException">For I/O error in sending the interest.</exception>
        /// <exception cref="System.Exception">If the encoded interest size exceeds getMaxNdnPacketSize().</exception>
        public long expressInterest(Interest interest, OnData onData,
				WireFormat wireFormat)
        {
            return expressInterest(interest, onData, null, wireFormat);
        }
Exemple #50
0
            public Anonymous_C5(Consumer paramouter_Consumer, Interest interest_0,
						OnData onData_1, net.named_data.jndn.encrypt.EncryptError.OnError  onError_2)
            {
                this.interest = interest_0;
                    this.onData = onData_1;
                    this.onError = onError_2;
                    this.outer_Consumer = paramouter_Consumer;
            }
Exemple #51
0
        /// <summary>
        /// Encode name as an Interest. If interestTemplate is not null, use its
        /// interest selectors.
        /// Send the Interest through the transport, read the entire response and call
        /// onData, onTimeout or onNetworkNack as described below.
        /// </summary>
        ///
        /// <param name="name">A Name for the interest. This copies the Name.</param>
        /// <param name="interestTemplate"></param>
        /// <param name="onData">expressInterest and data is the received Data object. NOTE: You must not change the interest object - if you need to change it then make a copy. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="onTimeout">interest given to expressInterest. If onTimeout is null, this does not use it. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="onNetworkNack">onNetworkNack.onNetworkNack(interest, networkNack) and does not call onTimeout. However, if a network Nack is received and onNetworkNack is null, do nothing and wait for the interest to time out. (Therefore, an application which does not yet process a network Nack reason treats a Nack the same as a timeout.) NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="wireFormat">A WireFormat object used to encode the message.</param>
        /// <returns>The pending interest ID which can be used with
        /// removePendingInterest.</returns>
        /// <exception cref="IOException">For I/O error in sending the interest.</exception>
        /// <exception cref="System.Exception">If the encoded interest size exceeds getMaxNdnPacketSize().</exception>
        public virtual long expressInterest(Name name, Interest interestTemplate,
				OnData onData, OnTimeout onTimeout, OnNetworkNack onNetworkNack,
				WireFormat wireFormat)
        {
            long pendingInterestId = node_.getNextEntryId();

            // This copies the name object as required by Node.expressInterest.
            node_.expressInterest(pendingInterestId,
                    getInterestCopy(name, interestTemplate), onData, onTimeout,
                    onNetworkNack, wireFormat, this);

            return pendingInterestId;
        }
        /// <summary>
        /// Override to submit a task to use the thread pool given to the constructor.
        /// Also wrap the supplied onData, onTimeout and onNetworkNack callbacks in an
        /// outer callback which submits a task to the thread pool to call the supplied
        /// callback. See Face.expressInterest for calling details. We make a separate
        /// expressInterest overload for supplying a Name vs. Interest to avoid making
        /// multiple copies of the Interest.
        /// </summary>
        ///
        public override long expressInterest(Name name, Interest interestTemplate,
				OnData onData, OnTimeout onTimeout,
				OnNetworkNack onNetworkNack, WireFormat wireFormat_0)
        {
            long pendingInterestId_1 = node_.getNextEntryId();

            // Wrap callbacks to submit to the thread pool.
            OnData finalOnData_2 = onData;
            OnData onDataSubmit_3 = new ThreadPoolFace.Anonymous_C10 (this, finalOnData_2);

            OnTimeout finalOnTimeout_4 = onTimeout;
            OnTimeout onTimeoutSubmit_5 = (onTimeout == null) ? null
                    : new ThreadPoolFace.Anonymous_C9 (this, finalOnTimeout_4);

            OnNetworkNack finalOnNetworkNack_6 = onNetworkNack;
            OnNetworkNack onNetworkNackSubmit_7 = (onNetworkNack == null) ? null
                    : new ThreadPoolFace.Anonymous_C8 (this, finalOnNetworkNack_6);

            // Make an interest copy as required by Node.expressInterest.
            Interest interestCopy_8 = net.named_data.jndn.Face.getInterestCopy(name, interestTemplate);
            threadPool_.submit(new ThreadPoolFace.Anonymous_C7 (this, onDataSubmit_3, onTimeoutSubmit_5, interestCopy_8,
                    onNetworkNackSubmit_7, wireFormat_0, pendingInterestId_1));

            return pendingInterestId_1;
        }
            public Anonymous_C11(ThreadPoolFace paramouter_ThreadPoolFace,
						OnNetworkNack onNetworkNackSubmit_0, OnData onDataSubmit_1,
						Interest interestCopy_2, OnTimeout onTimeoutSubmit_3,
						long pendingInterestId_4, WireFormat wireFormat_5)
            {
                this.onNetworkNackSubmit = onNetworkNackSubmit_0;
                    this.onDataSubmit = onDataSubmit_1;
                    this.interestCopy = interestCopy_2;
                    this.onTimeoutSubmit = onTimeoutSubmit_3;
                    this.pendingInterestId = pendingInterestId_4;
                    this.wireFormat = wireFormat_5;
                    this.outer_ThreadPoolFace = paramouter_ThreadPoolFace;
            }