Ejemplo n.º 1
0
 /// <summary>
 /// Create a new Node for communication with an NDN hub with the given
 /// Transport object and connectionInfo.
 /// </summary>
 ///
 /// <param name="transport">A Transport object used for communication.</param>
 /// <param name="connectionInfo"></param>
 public Node(Transport transport, Transport.ConnectionInfo connectionInfo)
 {
     this.pendingInterestTable_ = new PendingInterestTable();
     this.interestFilterTable_ = new InterestFilterTable();
     this.registeredPrefixTable_ = new RegisteredPrefixTable(
             interestFilterTable_);
     this.delayedCallTable_ = new DelayedCallTable();
     this.onConnectedCallbacks_ = ILOG.J2CsMapping.Collections.Collections
             .synchronizedList(new ArrayList());
     this.commandInterestGenerator_ = new CommandInterestGenerator();
     this.timeoutPrefix_ = new Name("/local/timeout");
     this.lastEntryIdLock_ = new Object();
     this.connectStatus_ = net.named_data.jndn.Node.ConnectStatus.UNCONNECTED;
     transport_ = transport;
     connectionInfo_ = connectionInfo;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a new Face for communication with an NDN hub with the given
 /// Transport object and connectionInfo.
 /// </summary>
 ///
 /// <param name="transport">A Transport object used for communication.</param>
 /// <param name="connectionInfo"></param>
 public Face(Transport transport, Transport.ConnectionInfo connectionInfo)
 {
     this.commandKeyChain_ = null;
     this.commandCertificateName_ = new Name();
     node_ = new Node(transport, connectionInfo);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Connect according to the info in ConnectionInfo, and use elementListener.
        /// </summary>
        ///
        /// <param name="connectionInfo">A TcpTransport.ConnectionInfo.</param>
        /// <param name="elementListener"></param>
        /// <param name="onConnected"></param>
        /// <exception cref="IOException">For I/O error.</exception>
        public override void connect(Transport.ConnectionInfo connectionInfo,
      ElementListener elementListener, IRunnable onConnected)
        {
            close();

              socket_ = connectSocket
            (((ConnectionInfo)connectionInfo).getHost(),
             ((ConnectionInfo)connectionInfo).getPort());

              elementReader_ = new ElementReader(elementListener);

              if (onConnected != null)
            onConnected.run();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Determine whether this transport connecting according to connectionInfo is
        /// to a node on the current machine. This affects the processing of
        /// Face.registerPrefix(): if the NFD is local, registration occurs with the
        /// '/localhost/nfd...' prefix; if non-local, the library will attempt to use
        /// remote prefix registration using '/localhop/nfd...'
        /// </summary>
        ///
        /// <param name="connectionInfo">A ConnectionInfo with the host to check.</param>
        /// <returns>True if the host is local, false if not.</returns>
        public override bool isLocal(Transport.ConnectionInfo connectionInfo)
        {
            if (connectionInfo_ == null ||
              ((ConnectionInfo)connectionInfo).getHost() !=  connectionInfo_.getHost()) {
            isLocal_ = getIsLocal(((ConnectionInfo)connectionInfo).getHost());
            connectionInfo_ = (ConnectionInfo)connectionInfo;
              }

              return isLocal_;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Determine whether this transport connecting according to connectionInfo is
 /// to a node on the current machine. This affects the processing of
 /// Face.registerPrefix(): if the NFD is local, registration occurs with the
 /// '/localhost/nfd...' prefix; if non-local, the library will attempt to use
 /// remote prefix registration using '/localhop/nfd...'
 /// </summary>
 ///
 /// <param name="connectionInfo">A ConnectionInfo with the host to check.</param>
 /// <returns>True if the host is local, false if not.</returns>
 /// <exception cref="System.IO.IOException"></exception>
 public abstract bool isLocal(Transport.ConnectionInfo connectionInfo);
Ejemplo n.º 6
0
        /// <summary>
        /// Connect according to the info in ConnectionInfo, and use elementListener.
        /// </summary>
        ///
        /// <param name="connectionInfo">An object of a subclass of ConnectionInfo.</param>
        /// <param name="elementListener"></param>
        /// <param name="onConnected"></param>
        /// <exception cref="IOException">For I/O error.</exception>
        public virtual void connect(Transport.ConnectionInfo connectionInfo,
				ElementListener elementListener, IRunnable onConnected)
        {
            throw new NotSupportedException("connect is not implemented");
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Create a new ThreadPoolFace for communication with an NDN hub with the given
        /// Transport object and connectionInfo.
        /// </summary>
        ///
        /// <param name="threadPool">is also used to schedule the interest timeouts.</param>
        /// <param name="transport">like AsyncTcpTransport, in which case the transport should use the same ioService.</param>
        /// <param name="connectionInfo"></param>
        public ThreadPoolFace(ScheduledExecutorService threadPool,
				Transport transport, Transport.ConnectionInfo connectionInfo)
            : base(transport, connectionInfo)
        {
            threadPool_ = threadPool;
        }