public Anonymous_C22(ThreadPoolFace.Anonymous_C12 paramouter_Anonymous_C12, NetworkNack networkNack_0, Interest localInterest_1) { this.networkNack = networkNack_0; this.localInterest = localInterest_1; this.outer_Anonymous_C12 = paramouter_Anonymous_C12; }
public Anonymous_C19(ThreadPoolFace.Anonymous_C8 paramouter_Anonymous_C8, Interest localInterest_0, NetworkNack networkNack_1) { this.localInterest = localInterest_0; this.networkNack = networkNack_1; this.outer_Anonymous_C8 = paramouter_Anonymous_C8; }
public virtual void onNetworkNack(Interest interest, NetworkNack networkNack) { networkNack_ = networkNack; ++onNetworkNackCallCount_; }
public void onNetworkNack(Interest localInterest_0, NetworkNack networkNack_1) { outer_ThreadPoolFace.threadPool_.submit(new net.named_data.jndn.ThreadPoolFace.Anonymous_C8.Anonymous_C19(this, localInterest_0, networkNack_1)); }
/// <summary> /// Decode input as an NDN-TLV LpPacket and set the fields of the lpPacket object. /// </summary> /// /// <param name="lpPacket">The LpPacket object whose fields are updated.</param> /// <param name="input"></param> /// <param name="copy">unchanged while the Blob values are used.</param> /// <exception cref="EncodingException">For invalid encoding.</exception> public override void decodeLpPacket(LpPacket lpPacket, ByteBuffer input, bool copy) { lpPacket.clear(); TlvDecoder decoder = new TlvDecoder(input); int endOffset = decoder.readNestedTlvsStart(net.named_data.jndn.encoding.tlv.Tlv.LpPacket_LpPacket); while (decoder.getOffset() < endOffset) { // Imitate TlvDecoder.readTypeAndLength. int fieldType = decoder.readVarNumber(); int fieldLength = decoder.readVarNumber(); int fieldEndOffset = decoder.getOffset() + fieldLength; if (fieldEndOffset > input.limit()) throw new EncodingException( "TLV length exceeds the buffer length"); if (fieldType == net.named_data.jndn.encoding.tlv.Tlv.LpPacket_Fragment) { // Set the fragment to the bytes of the TLV value. lpPacket.setFragmentWireEncoding(new Blob(decoder.getSlice( decoder.getOffset(), fieldEndOffset), copy)); decoder.seek(fieldEndOffset); // The fragment is supposed to be the last field. break; } else if (fieldType == net.named_data.jndn.encoding.tlv.Tlv.LpPacket_Nack) { NetworkNack networkNack = new NetworkNack(); int code = (int) decoder.readOptionalNonNegativeIntegerTlv( net.named_data.jndn.encoding.tlv.Tlv.LpPacket_NackReason, fieldEndOffset); // The enum numeric values are the same as this wire format, so use as is. if (code < 0 || code == net.named_data.jndn.NetworkNack.Reason.NONE.getNumericType()) // This includes an omitted NackReason. networkNack.setReason(net.named_data.jndn.NetworkNack.Reason.NONE); else if (code == net.named_data.jndn.NetworkNack.Reason.CONGESTION.getNumericType()) networkNack.setReason(net.named_data.jndn.NetworkNack.Reason.CONGESTION); else if (code == net.named_data.jndn.NetworkNack.Reason.DUPLICATE.getNumericType()) networkNack.setReason(net.named_data.jndn.NetworkNack.Reason.DUPLICATE); else if (code == net.named_data.jndn.NetworkNack.Reason.NO_ROUTE.getNumericType()) networkNack.setReason(net.named_data.jndn.NetworkNack.Reason.NO_ROUTE); else { // Unrecognized reason. networkNack.setReason(net.named_data.jndn.NetworkNack.Reason.OTHER_CODE); networkNack.setOtherReasonCode(code); } lpPacket.addHeaderField(networkNack); } else if (fieldType == net.named_data.jndn.encoding.tlv.Tlv.LpPacket_IncomingFaceId) { IncomingFaceId incomingFaceId = new IncomingFaceId(); incomingFaceId.setFaceId(decoder .readNonNegativeInteger(fieldLength)); lpPacket.addHeaderField(incomingFaceId); } else { // Unrecognized field type. The conditions for ignoring are here: // http://redmine.named-data.net/projects/nfd/wiki/NDNLPv2 bool canIgnore = (fieldType >= net.named_data.jndn.encoding.tlv.Tlv.LpPacket_IGNORE_MIN && fieldType <= net.named_data.jndn.encoding.tlv.Tlv.LpPacket_IGNORE_MAX && (fieldType & 0x01) == 1); if (!canIgnore) throw new EncodingException( "Did not get the expected TLV type"); // Ignore. decoder.seek(fieldEndOffset); } decoder.finishNestedTlvs(fieldEndOffset); } decoder.finishNestedTlvs(endOffset); }
public void onReceivedElement(ByteBuffer element) { LpPacket lpPacket = null; if (element.get(0) == net.named_data.jndn.encoding.tlv.Tlv.LpPacket_LpPacket) { // Decode the LpPacket and replace element with the fragment. lpPacket = new LpPacket(); // Set copy false so that the fragment is a slice which will be copied below. // The header fields are all integers and don't need to be copied. net.named_data.jndn.encoding.TlvWireFormat.get().decodeLpPacket(lpPacket, element, false); element = lpPacket.getFragmentWireEncoding().buf(); } // First, decode as Interest or Data. Interest interest = null; Data data = null; if (element.get(0) == net.named_data.jndn.encoding.tlv.Tlv.Interest || element.get(0) == net.named_data.jndn.encoding.tlv.Tlv.Data) { TlvDecoder decoder = new TlvDecoder(element); if (decoder.peekType(net.named_data.jndn.encoding.tlv.Tlv.Interest, element.remaining())) { interest = new Interest(); interest.wireDecode(element, net.named_data.jndn.encoding.TlvWireFormat.get()); if (lpPacket != null) { interest.setLpPacket(lpPacket); } } else if (decoder.peekType(net.named_data.jndn.encoding.tlv.Tlv.Data, element.remaining())) { data = new Data(); data.wireDecode(element, net.named_data.jndn.encoding.TlvWireFormat.get()); if (lpPacket != null) { data.setLpPacket(lpPacket); } } } if (lpPacket != null) { // We have decoded the fragment, so remove the wire encoding to save memory. lpPacket.setFragmentWireEncoding(new Blob()); NetworkNack networkNack = net.named_data.jndn.NetworkNack.getFirstHeader(lpPacket); if (networkNack != null) { if (interest == null) { // We got a Nack but not for an Interest, so drop the packet. return; } ArrayList <PendingInterestTable.Entry> pitEntries = new ArrayList <PendingInterestTable.Entry>(); pendingInterestTable_.extractEntriesForNackInterest(interest, pitEntries); for (int i = 0; i < pitEntries.Count; ++i) { PendingInterestTable.Entry pendingInterest = pitEntries[i]; try { pendingInterest.getOnNetworkNack().onNetworkNack( pendingInterest.getInterest(), networkNack); } catch (Exception ex) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onNack", ex); } } // We have processed the network Nack packet. return; } } // Now process as Interest or Data. if (interest != null) { dispatchInterest(interest); } else if (data != null) { satisfyPendingInterests(data); } }
public void onReceivedElement(ByteBuffer element) { LpPacket lpPacket = null; if (element.get(0) == net.named_data.jndn.encoding.tlv.Tlv.LpPacket_LpPacket) { // Decode the LpPacket and replace element with the fragment. lpPacket = new LpPacket(); net.named_data.jndn.encoding.TlvWireFormat.get().decodeLpPacket(lpPacket, element); element = lpPacket.getFragmentWireEncoding().buf(); } // First, decode as Interest or Data. Interest interest = null; Data data = null; if (element.get(0) == net.named_data.jndn.encoding.tlv.Tlv.Interest || element.get(0) == net.named_data.jndn.encoding.tlv.Tlv.Data) { TlvDecoder decoder = new TlvDecoder(element); if (decoder.peekType(net.named_data.jndn.encoding.tlv.Tlv.Interest, element.remaining())) { interest = new Interest(); interest.wireDecode(element, net.named_data.jndn.encoding.TlvWireFormat.get()); if (lpPacket != null) { interest.setLpPacket(lpPacket); } } else if (decoder.peekType(net.named_data.jndn.encoding.tlv.Tlv.Data, element.remaining())) { data = new Data(); data.wireDecode(element, net.named_data.jndn.encoding.TlvWireFormat.get()); if (lpPacket != null) { data.setLpPacket(lpPacket); } } } if (lpPacket != null) { // We have decoded the fragment, so remove the wire encoding to save memory. lpPacket.setFragmentWireEncoding(new Blob()); NetworkNack networkNack = net.named_data.jndn.NetworkNack.getFirstHeader(lpPacket); if (networkNack != null) { if (interest == null) { // We got a Nack but not for an Interest, so drop the packet. return; } ArrayList <PendingInterestTable.Entry> pitEntries = new ArrayList <PendingInterestTable.Entry>(); pendingInterestTable_.extractEntriesForNackInterest(interest, pitEntries); for (int i = 0; i < pitEntries.Count; ++i) { PendingInterestTable.Entry pendingInterest = pitEntries[i]; try { pendingInterest.getOnNetworkNack().onNetworkNack( pendingInterest.getInterest(), networkNack); } catch (Exception ex) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onNack", ex); } } // We have process the network Nack packet. return; } } // Now process as Interest or Data. if (interest != null) { // Quickly lock and get all interest filter callbacks which match. ArrayList matchedFilters = new ArrayList(); interestFilterTable_.getMatchedFilters(interest, matchedFilters); // The lock on interestFilterTable_ is released, so call the callbacks. for (int i_0 = 0; i_0 < matchedFilters.Count; ++i_0) { InterestFilterTable.Entry entry = (InterestFilterTable.Entry)matchedFilters[i_0]; try { entry.getOnInterest().onInterest( entry.getFilter().getPrefix(), interest, entry.getFace(), entry.getInterestFilterId(), entry.getFilter()); } catch (Exception ex_1) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onInterest", ex_1); } } } else if (data != null) { ArrayList <PendingInterestTable.Entry> pitEntries_2 = new ArrayList <PendingInterestTable.Entry>(); pendingInterestTable_.extractEntriesForExpressedInterest( data.getName(), pitEntries_2); for (int i_3 = 0; i_3 < pitEntries_2.Count; ++i_3) { PendingInterestTable.Entry pendingInterest_4 = pitEntries_2[i_3]; try { pendingInterest_4.getOnData().onData( pendingInterest_4.getInterest(), data); } catch (Exception ex_5) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onData", ex_5); } } } }
/// <summary> /// Set the network Nack reason. /// </summary> /// /// <param name="reason">setOtherReasonCode().</param> public void setReason(NetworkNack.Reason reason) { reason_ = reason; }
public void onNetworkNack(Interest interest, NetworkNack networkNack) { outer_Producer.handleNetworkNack(interest, networkNack, timeSlot, onEncryptedKeys); }
/// <summary> /// This is called from an expressInterest OnNetworkNack to handle a network /// Nack for the E-KEY requested through the Interest. Decrease the outstanding /// E-KEY interest count for the C-KEY corresponding to the timeSlot. /// </summary> /// /// <param name="interest">The interest given to expressInterest.</param> /// <param name="networkNack">The returned NetworkNack (unused).</param> /// <param name="timeSlot_0">The time slot as milliseconds since Jan 1, 1970 UTC.</param> /// <param name="onEncryptedKeys_1">encrypted content key Data packets. If onEncryptedKeys is null, this does not use it.</param> internal void handleNetworkNack(Interest interest, NetworkNack networkNack, double timeSlot_0, Producer.OnEncryptedKeys onEncryptedKeys_1) { double timeCount = Math.Round(timeSlot_0,MidpointRounding.AwayFromZero); updateKeyRequest((Producer.KeyRequest ) ILOG.J2CsMapping.Collections.Collections.Get(keyRequests_,timeCount), timeCount, onEncryptedKeys_1); }
public Anonymous_C22(ThreadPoolFace.Anonymous_C12 paramouter_Anonymous_C12, NetworkNack networkNack_0, Interest localInterest_1) { this.networkNack = networkNack_0; this.localInterest = localInterest_1; this.outer_Anonymous_C12 = paramouter_Anonymous_C12; }
public void onNetworkNack(Interest localInterest_0, NetworkNack networkNack_1) { outer_ThreadPoolFace.threadPool_.submit(new net.named_data.jndn.ThreadPoolFace.Anonymous_C12.Anonymous_C22 (this, networkNack_1, localInterest_0)); }
public Anonymous_C19(ThreadPoolFace.Anonymous_C8 paramouter_Anonymous_C8, Interest localInterest_0, NetworkNack networkNack_1) { this.localInterest = localInterest_0; this.networkNack = networkNack_1; this.outer_Anonymous_C8 = paramouter_Anonymous_C8; }