Exemplo n.º 1
0
        isLocal(Transport.ConnectionInfo connectionInfo)
        {
            if (connectionInfo_ == null ||
                ((ConnectionInfo)connectionInfo).getHost() != connectionInfo_.getHost())
            {
                isLocal_        = getIsLocal(((ConnectionInfo)connectionInfo).getHost());
                connectionInfo_ = (ConnectionInfo)connectionInfo;
            }

            return(isLocal_);
        }
Exemplo n.º 2
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;
 }
Exemplo n.º 3
0
        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();
            }
        }
Exemplo n.º 4
0
        connect(Transport.ConnectionInfo connectionInfo,
                ElementListener elementListener, IRunnable onConnected)
        {
            close();

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

            if (socket_ != null)
            {
                elementReader_ = new ElementReader(elementListener);

                if (onConnected != null)
                {
                    onConnected.run();
                }

                // Begin a new receive.
                socket_.BeginReceive
                    (inputBuffer_.array(), 0, inputBuffer_.capacity(), 0,
                    new AsyncCallback(receiveCallback), null);
            }
        }
Exemplo n.º 5
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;
 }
Exemplo 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");
 }
Exemplo n.º 7
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);
Exemplo n.º 8
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;
 }
Exemplo n.º 9
0
 isLocal(Transport.ConnectionInfo connectionInfo)
 {
     return(false);
 }
Exemplo n.º 10
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. If you
 /// do not want to call processEvents, then the transport should be an async
 /// transport like AsyncTcpTransport.</param>
 /// <param name="connectionInfo">A Transport.ConnectionInfo to be used to
 /// connect to the transport.</param>
 public ThreadPoolFace
     (Transport transport, Transport.ConnectionInfo connectionInfo)
     : base(transport, connectionInfo)
 {
 }