net.named_data.jndn
public class Face extends Object
Modifier and Type | Field and Description |
---|---|
protected Name |
commandCertificateName_ |
protected KeyChain |
commandKeyChain_ |
protected Node |
node_ |
Constructor and Description |
---|
Face()
Create a new Face for communication with an NDN hub at "localhost" using the
default port 6363 and the default TcpTransport.
|
Face(String host)
Create a new Face for communication with an NDN hub at host using the
default port 6363 and the default TcpTransport.
|
Face(String host,
int port)
Create a new Face for communication with an NDN hub at host:port using the
default TcpTransport.
|
Face(Transport transport,
Transport.ConnectionInfo connectionInfo)
Create a new Face for communication with an NDN hub with the given
Transport object and connectionInfo.
|
Modifier and Type | Method and Description |
---|---|
void |
callLater(double delayMilliseconds,
Runnable callback)
Call callback.run() after the given delay.
|
long |
expressInterest(Interest interest,
OnData onData)
Send the Interest through the transport, read the entire response and call
onData as described below.
|
long |
expressInterest(Interest interest,
OnData onData,
OnTimeout onTimeout)
Send the Interest through the transport, read the entire response and call
onData or onTimeout as described below.
|
long |
expressInterest(Interest interest,
OnData onData,
OnTimeout onTimeout,
OnNetworkNack onNetworkNack)
Send the Interest through the transport, read the entire response and call
onData, onTimeout or onNetworkNack as described below.
|
long |
expressInterest(Interest interest,
OnData onData,
OnTimeout onTimeout,
OnNetworkNack onNetworkNack,
WireFormat wireFormat)
Send the Interest through the transport, read the entire response and call
onData, onTimeout or onNetworkNack as described below.
|
long |
expressInterest(Interest interest,
OnData onData,
OnTimeout onTimeout,
WireFormat wireFormat)
Send the Interest through the transport, read the entire response and call
onData or onTimeout as described below.
|
long |
expressInterest(Interest interest,
OnData onData,
WireFormat wireFormat)
Send the Interest through the transport, read the entire response and call
onData as described below.
|
long |
expressInterest(Name name,
Interest interestTemplate,
OnData onData)
Encode name as an Interest.
|
long |
expressInterest(Name name,
Interest interestTemplate,
OnData onData,
OnTimeout onTimeout)
Encode name as an Interest.
|
long |
expressInterest(Name name,
Interest interestTemplate,
OnData onData,
OnTimeout onTimeout,
OnNetworkNack onNetworkNack)
Encode name as an Interest.
|
long |
expressInterest(Name name,
Interest interestTemplate,
OnData onData,
OnTimeout onTimeout,
OnNetworkNack onNetworkNack,
WireFormat wireFormat)
Encode name as an Interest.
|
long |
expressInterest(Name name,
Interest interestTemplate,
OnData onData,
OnTimeout onTimeout,
WireFormat wireFormat)
Encode name as an Interest.
|
long |
expressInterest(Name name,
Interest interestTemplate,
OnData onData,
WireFormat wireFormat)
Encode name as an Interest.
|
long |
expressInterest(Name name,
OnData onData)
Encode name as an Interest, using a default interest lifetime.
|
long |
expressInterest(Name name,
OnData onData,
OnTimeout onTimeout)
Encode name as an Interest, using a default interest lifetime.
|
long |
expressInterest(Name name,
OnData onData,
OnTimeout onTimeout,
OnNetworkNack onNetworkNack)
Encode name as an Interest, using a default interest lifetime.
|
long |
expressInterest(Name name,
OnData onData,
OnTimeout onTimeout,
OnNetworkNack onNetworkNack,
WireFormat wireFormat)
Encode name as an Interest, using a default interest lifetime.
|
long |
expressInterest(Name name,
OnData onData,
OnTimeout onTimeout,
WireFormat wireFormat)
Encode name as an Interest, using a default interest lifetime.
|
long |
expressInterest(Name name,
OnData onData,
WireFormat wireFormat)
Encode name as an Interest, using a default interest lifetime.
|
protected static Interest |
getInterestCopy(Name name,
Interest interestTemplate)
Do the work of expressInterest to make an Interest based on name and
interestTemplate.
|
static int |
getMaxNdnPacketSize()
Get the practical limit of the size of a network-layer packet.
|
boolean |
isLocal()
Check if the face is local based on the current connection through the
Transport; some Transport may cause network IO (e.g.
|
void |
makeCommandInterest(Interest interest)
Append a timestamp component and a random value component to interest's
name.
|
void |
makeCommandInterest(Interest interest,
WireFormat wireFormat)
Append a timestamp component and a random value component to interest's
name.
|
void |
processEvents()
Process any packets to receive and call callbacks such as onData,
onInterest or onTimeout.
|
void |
putData(Data data)
The OnInterestCallback calls this to put a Data packet which satisfies an
Interest.
|
void |
putData(Data data,
WireFormat wireFormat)
The OnInterestCallback calls this to put a Data packet which satisfies an
Interest.
|
long |
registerPrefix(Name prefix,
OnInterestCallback onInterest,
OnRegisterFailed onRegisterFailed)
Register prefix with the connected NDN hub and call onInterest when a
matching interest is received.
|
long |
registerPrefix(Name prefix,
OnInterestCallback onInterest,
OnRegisterFailed onRegisterFailed,
ForwardingFlags flags)
Register prefix with the connected NDN hub and call onInterest when a
matching interest is received.
|
long |
registerPrefix(Name prefix,
OnInterestCallback onInterest,
OnRegisterFailed onRegisterFailed,
ForwardingFlags flags,
WireFormat wireFormat)
Register prefix with the connected NDN hub and call onInterest when a
matching interest is received.
|
long |
registerPrefix(Name prefix,
OnInterestCallback onInterest,
OnRegisterFailed onRegisterFailed,
OnRegisterSuccess onRegisterSuccess)
Register prefix with the connected NDN hub and call onInterest when a
matching interest is received.
|
long |
registerPrefix(Name prefix,
OnInterestCallback onInterest,
OnRegisterFailed onRegisterFailed,
OnRegisterSuccess onRegisterSuccess,
ForwardingFlags flags)
Register prefix with the connected NDN hub and call onInterest when a
matching interest is received.
|
long |
registerPrefix(Name prefix,
OnInterestCallback onInterest,
OnRegisterFailed onRegisterFailed,
OnRegisterSuccess onRegisterSuccess,
ForwardingFlags flags,
WireFormat wireFormat)
Register prefix with the connected NDN hub and call onInterest when a
matching interest is received.
|
long |
registerPrefix(Name prefix,
OnInterestCallback onInterest,
OnRegisterFailed onRegisterFailed,
OnRegisterSuccess onRegisterSuccess,
WireFormat wireFormat)
Register prefix with the connected NDN hub and call onInterest when a
matching interest is received.
|
long |
registerPrefix(Name prefix,
OnInterestCallback onInterest,
OnRegisterFailed onRegisterFailed,
WireFormat wireFormat)
Register prefix with the connected NDN hub and call onInterest when a
matching interest is received.
|
long |
registerPrefix(Name prefix,
OnInterestCallback onInterest,
OnRegisterSuccess onRegisterSuccess,
OnRegisterFailed onRegisterFailed)
Deprecated.
Use
registerPrefix(prefix, onInterest, onRegisterFailed, onRegisterSuccess)
where the onRegisterSuccess parameter comes after onRegisterFailed.
|
long |
registerPrefix(Name prefix,
OnInterestCallback onInterest,
OnRegisterSuccess onRegisterSuccess,
OnRegisterFailed onRegisterFailed,
ForwardingFlags flags)
Deprecated.
Use
registerPrefix(prefix, onInterest, onRegisterFailed, onRegisterSuccess, flags)
where the onRegisterSuccess parameter comes after onRegisterFailed.
|
long |
registerPrefix(Name prefix,
OnInterestCallback onInterest,
OnRegisterSuccess onRegisterSuccess,
OnRegisterFailed onRegisterFailed,
ForwardingFlags flags,
WireFormat wireFormat)
Deprecated.
Use
registerPrefix(prefix, onInterest, onRegisterFailed, onRegisterSuccess, flags, wireFormat)
where the onRegisterSuccess parameter comes after onRegisterFailed.
|
long |
registerPrefix(Name prefix,
OnInterestCallback onInterest,
OnRegisterSuccess onRegisterSuccess,
OnRegisterFailed onRegisterFailed,
WireFormat wireFormat)
Deprecated.
Use
registerPrefix(prefix, onInterest, onRegisterFailed, onRegisterSuccess, wireFormat)
where the onRegisterSuccess parameter comes after onRegisterFailed.
|
long |
registerPrefix(Name prefix,
OnInterest onInterest,
OnRegisterFailed onRegisterFailed)
Deprecated.
Use registerPrefix where onInterest is an OnInterestCallback
(which is passed this Face for calling putData) instead of the deprecated
OnInterest (which is passed a Transport object).
|
long |
registerPrefix(Name prefix,
OnInterest onInterest,
OnRegisterFailed onRegisterFailed,
ForwardingFlags flags)
Deprecated.
Use registerPrefix where onInterest is an OnInterestCallback
(which is passed this Face for calling putData) instead of the deprecated
OnInterest (which is passed a Transport object).
|
long |
registerPrefix(Name prefix,
OnInterest onInterest,
OnRegisterFailed onRegisterFailed,
ForwardingFlags flags,
WireFormat wireFormat)
Deprecated.
Use registerPrefix where onInterest is an OnInterestCallback
(which is passed this Face for calling putData) instead of the deprecated
OnInterest (which is passed a Transport object).
|
long |
registerPrefix(Name prefix,
OnInterest onInterest,
OnRegisterFailed onRegisterFailed,
WireFormat wireFormat)
Deprecated.
Use registerPrefix where onInterest is an OnInterestCallback
(which is passed this Face for calling putData) instead of the deprecated
OnInterest (which is passed a Transport object).
|
void |
removePendingInterest(long pendingInterestId)
Remove the pending interest entry with the pendingInterestId from the
pending interest table.
|
void |
removeRegisteredPrefix(long registeredPrefixId)
Remove the registered prefix entry with the registeredPrefixId from the
registered prefix table.
|
void |
send(Blob encoding)
Send the encoded packet out through the face.
|
void |
send(ByteBuffer encoding)
Send the encoded packet out through the face.
|
void |
setCommandCertificateName(Name certificateName)
Set the certificate name used to sign command interest (e.g.
|
void |
setCommandSigningInfo(KeyChain keyChain,
Name certificateName)
Set the KeyChain and certificate name used to sign command interests
(e.g.
|
long |
setInterestFilter(InterestFilter filter,
OnInterestCallback onInterest)
Add an entry to the local interest filter table to call the onInterest
callback for a matching incoming Interest.
|
long |
setInterestFilter(Name prefix,
OnInterestCallback onInterest)
Add an entry to the local interest filter table to call the onInterest
callback for a matching incoming Interest.
|
void |
shutdown()
Shut down and disconnect this Face.
|
void |
unsetInterestFilter(long interestFilterId)
Remove the interest filter entry which has the interestFilterId from the
interest filter table.
|
protected final Node node_
protected KeyChain commandKeyChain_
protected Name commandCertificateName_
public Face(Transport transport, Transport.ConnectionInfo connectionInfo)
transport
- A Transport object used for communication.connectionInfo
- A Transport.ConnectionInfo to be used to connect to
the transport.public Face(String host, int port)
host
- The host of the NDN hub.port
- The port of the NDN hub.public Face(String host)
host
- The host of the NDN hub.public Face()
public long expressInterest(Interest interest, OnData onData, OnTimeout onTimeout, OnNetworkNack onNetworkNack, WireFormat wireFormat) throws IOException
interest
- The Interest to send. This copies the Interest.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.onTimeout
- If the interest times out according to the interest
lifetime, this calls onTimeout.onTimeout(interest) where interest is the
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.onNetworkNack
- When a network Nack packet for the interest is
received and onNetworkNack is not null, this calls
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.wireFormat
- A WireFormat object used to encode the message.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Interest interest, OnData onData, OnTimeout onTimeout, OnNetworkNack onNetworkNack) throws IOException
interest
- The Interest to send. This copies the Interest.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.onTimeout
- If the interest times out according to the interest
lifetime, this calls onTimeout.onTimeout(interest) where interest is the
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.onNetworkNack
- When a network Nack packet for the interest is
received and onNetworkNack is not null, this calls
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.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Name name, Interest interestTemplate, OnData onData, OnTimeout onTimeout, OnNetworkNack onNetworkNack, WireFormat wireFormat) throws IOException
name
- A Name for the interest. This copies the Name.interestTemplate
- If not null, copy interest selectors from the
template. This does not keep a pointer to the Interest object.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.onTimeout
- If the interest times out according to the interest
lifetime, this calls onTimeout.onTimeout(interest) where interest is the
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.onNetworkNack
- When a network Nack packet for the interest is
received and onNetworkNack is not null, this calls
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.wireFormat
- A WireFormat object used to encode the message.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Name name, Interest interestTemplate, OnData onData, OnTimeout onTimeout, OnNetworkNack onNetworkNack) throws IOException
name
- A Name for the interest. This copies the Name.interestTemplate
- If not null, copy interest selectors from the
template. This does not keep a pointer to the Interest object.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.onTimeout
- If the interest times out according to the interest
lifetime, this calls onTimeout.onTimeout(interest) where interest is the
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.onNetworkNack
- When a network Nack packet for the interest is
received and onNetworkNack is not null, this calls
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.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Name name, OnData onData, OnTimeout onTimeout, OnNetworkNack onNetworkNack, WireFormat wireFormat) throws IOException
name
- A Name for the interest. This copies the Name.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.onTimeout
- If the interest times out according to the interest
lifetime, this calls onTimeout.onTimeout(interest) where interest is the
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.onNetworkNack
- When a network Nack packet for the interest is
received and onNetworkNack is not null, this calls
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.wireFormat
- A WireFormat object used to encode the message.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Name name, OnData onData, OnTimeout onTimeout, OnNetworkNack onNetworkNack) throws IOException
name
- A Name for the interest. This copies the Name.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.onTimeout
- If the interest times out according to the interest
lifetime, this calls onTimeout.onTimeout(interest) where interest is the
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.onNetworkNack
- When a network Nack packet for the interest is
received and onNetworkNack is not null, this calls
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.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Interest interest, OnData onData, OnTimeout onTimeout, WireFormat wireFormat) throws IOException
interest
- The Interest to send. This copies the Interest.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.onTimeout
- If the interest times out according to the interest
lifetime, this calls onTimeout.onTimeout(interest) where interest is the
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.wireFormat
- A WireFormat object used to encode the message.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Interest interest, OnData onData, OnTimeout onTimeout) throws IOException
interest
- The Interest to send. This copies the Interest.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.onTimeout
- If the interest times out according to the interest
lifetime, this calls onTimeout.onTimeout(interest) where interest is the
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.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Interest interest, OnData onData, WireFormat wireFormat) throws IOException
interest
- The Interest to send. This copies the Interest.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.wireFormat
- A WireFormat object used to encode the message.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Interest interest, OnData onData) throws IOException
interest
- The Interest to send. This copies the Interest.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Name name, Interest interestTemplate, OnData onData, OnTimeout onTimeout, WireFormat wireFormat) throws IOException
name
- A Name for the interest. This copies the Name.interestTemplate
- If not null, copy interest selectors from the
template. This does not keep a pointer to the Interest object.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.onTimeout
- If the interest times out according to the interest
lifetime, this calls onTimeout.onTimeout(interest) where interest is the
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.wireFormat
- A WireFormat object used to encode the message.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Name name, OnData onData, OnTimeout onTimeout, WireFormat wireFormat) throws IOException
name
- A Name for the interest. This copies the Name.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.onTimeout
- If the interest times out according to the interest
lifetime, this calls onTimeout.onTimeout(interest) where interest is the
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.wireFormat
- A WireFormat object used to encode the message.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Name name, Interest interestTemplate, OnData onData, WireFormat wireFormat) throws IOException
name
- A Name for the interest. This copies the Name.interestTemplate
- If not null, copy interest selectors from the
template. This does not keep a pointer to the Interest object.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.wireFormat
- A WireFormat object used to encode the message.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Name name, Interest interestTemplate, OnData onData, OnTimeout onTimeout) throws IOException
name
- A Name for the interest. This copies the Name.interestTemplate
- If not null, copy interest selectors from the
template. This does not keep a pointer to the Interest object.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.onTimeout
- If the interest times out according to the interest
lifetime, this calls onTimeout.onTimeout(interest) where interest is the
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.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Name name, Interest interestTemplate, OnData onData) throws IOException
name
- A Name for the interest. This copies the Name.interestTemplate
- If not null, copy interest selectors from the
template. This does not keep a pointer to the Interest object.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Name name, OnData onData, OnTimeout onTimeout) throws IOException
name
- A Name for the interest. This copies the Name.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.onTimeout
- If the interest times out according to the interest
lifetime, this calls onTimeout.onTimeout(interest) where interest is the
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.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Name name, OnData onData, WireFormat wireFormat) throws IOException
name
- A Name for the interest. This copies the Name.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.wireFormat
- A WireFormat object used to encode the message.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public long expressInterest(Name name, OnData onData) throws IOException
name
- A Name for the interest. This copies the Name.onData
- When a matching data packet is received, this calls
onData.onData(interest, data) where interest is the interest given to
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.IOException
- For I/O error in sending the interest.Error
- If the encoded interest size exceeds getMaxNdnPacketSize().public void removePendingInterest(long pendingInterestId)
pendingInterestId
- The ID returned from expressInterest.public void setCommandSigningInfo(KeyChain keyChain, Name certificateName)
keyChain
- The KeyChain object for signing interests, which
must remain valid for the life of this Face. You must create the KeyChain
object and pass it in. You can create a default KeyChain for your
system with the default KeyChain constructor.certificateName
- The certificate name for signing interests.
This makes a copy of the Name. You can get the default certificate name
with keyChain.getDefaultCertificateName() .public void setCommandCertificateName(Name certificateName)
certificateName
- The certificate name for signing interest.
This makes a copy of the Name.public void makeCommandInterest(Interest interest, WireFormat wireFormat) throws SecurityException
interest
- The interest whose name is appended with components.wireFormat
- A WireFormat object used to encode the SignatureInfo and
to encode the interest name for signing.SecurityException
- If cannot find the private key for the
certificateName.public void makeCommandInterest(Interest interest) throws SecurityException
interest
- The interest whose name is appended with components.SecurityException
- If cannot find the private key for the
certificateName.public long registerPrefix(Name prefix, OnInterestCallback onInterest, OnRegisterFailed onRegisterFailed, OnRegisterSuccess onRegisterSuccess, ForwardingFlags flags, WireFormat wireFormat) throws IOException, SecurityException
prefix
- A Name for the prefix to register. This copies the Name.onInterest
- If not null, this creates an interest filter from prefix
so that when an Interest is received which matches the filter, this calls
onInterest.onInterest(prefix, interest, face, interestFilterId, filter).
The onInterest callback should supply the Data with face.putData().
NOTE: You must not change the prefix or filter objects - if you need to
change them then make a copy.
If onInterest is null, it is ignored and you must call setInterestFilter.
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.onRegisterFailed
- If register prefix fails for any reason, this
calls onRegisterFailed.onRegisterFailed(prefix).
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.onRegisterSuccess
- This calls
onRegisterSuccess.onRegisterSuccess(prefix, registeredPrefixId) when this
receives a success message from the forwarder. If onRegisterSuccess is null,
this does not use it. (The onRegisterSuccess parameter comes after
onRegisterFailed because it can be null or omitted, unlike onRegisterFailed.)
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.flags
- The flags for finer control of which interests are forwarded
to the application.wireFormat
- A WireFormat object used to encode the message.IOException
- For I/O error in sending the registration request.SecurityException
- If signing a command interest for NFD and cannot
find the private key for the certificateName.public long registerPrefix(Name prefix, OnInterestCallback onInterest, OnRegisterSuccess onRegisterSuccess, OnRegisterFailed onRegisterFailed, ForwardingFlags flags, WireFormat wireFormat) throws IOException, SecurityException
IOException
SecurityException
public long registerPrefix(Name prefix, OnInterestCallback onInterest, OnRegisterFailed onRegisterFailed, OnRegisterSuccess onRegisterSuccess, ForwardingFlags flags) throws IOException, SecurityException
prefix
- A Name for the prefix to register. This copies the Name.onInterest
- If not null, this creates an interest filter from prefix
so that when an Interest is received which matches the filter, this calls
onInterest.onInterest(prefix, interest, face, interestFilterId, filter).
The onInterest callback should supply the Data with face.putData().
NOTE: You must not change the prefix or filter objects - if you need to
change them then make a copy.
If onInterest is null, it is ignored and you must call setInterestFilter.
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.onRegisterFailed
- If register prefix fails for any reason, this
calls onRegisterFailed.onRegisterFailed(prefix).
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.onRegisterSuccess
- This calls
onRegisterSuccess.onRegisterSuccess(prefix, registeredPrefixId) when this
receives a success message from the forwarder. If onRegisterSuccess is null,
this does not use it. (The onRegisterSuccess parameter comes after
onRegisterFailed because it can be null or omitted, unlike onRegisterFailed.)
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.flags
- The flags for finer control of which interests are forwarded
to the application.IOException
- For I/O error in sending the registration request.SecurityException
public long registerPrefix(Name prefix, OnInterestCallback onInterest, OnRegisterSuccess onRegisterSuccess, OnRegisterFailed onRegisterFailed, ForwardingFlags flags) throws IOException, SecurityException
IOException
SecurityException
public long registerPrefix(Name prefix, OnInterestCallback onInterest, OnRegisterFailed onRegisterFailed, OnRegisterSuccess onRegisterSuccess, WireFormat wireFormat) throws IOException, SecurityException
prefix
- A Name for the prefix to register. This copies the Name.onInterest
- If not null, this creates an interest filter from prefix
so that when an Interest is received which matches the filter, this calls
onInterest.onInterest(prefix, interest, face, interestFilterId, filter).
The onInterest callback should supply the Data with face.putData().
NOTE: You must not change the prefix or filter objects - if you need to
change them then make a copy.
If onInterest is null, it is ignored and you must call setInterestFilter.
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.onRegisterFailed
- If register prefix fails for any reason, this
calls onRegisterFailed.onRegisterFailed(prefix).
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.onRegisterSuccess
- This calls
onRegisterSuccess.onRegisterSuccess(prefix, registeredPrefixId) when this
receives a success message from the forwarder. If onRegisterSuccess is null,
this does not use it. (The onRegisterSuccess parameter comes after
onRegisterFailed because it can be null or omitted, unlike onRegisterFailed.)
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.wireFormat
- A WireFormat object used to encode the message.IOException
- For I/O error in sending the registration request.SecurityException
- If signing a command interest for NFD and cannot
find the private key for the certificateName.public long registerPrefix(Name prefix, OnInterestCallback onInterest, OnRegisterSuccess onRegisterSuccess, OnRegisterFailed onRegisterFailed, WireFormat wireFormat) throws IOException, SecurityException
IOException
SecurityException
public long registerPrefix(Name prefix, OnInterestCallback onInterest, OnRegisterFailed onRegisterFailed, OnRegisterSuccess onRegisterSuccess) throws IOException, SecurityException
prefix
- A Name for the prefix to register. This copies the Name.onInterest
- If not null, this creates an interest filter from prefix
so that when an Interest is received which matches the filter, this calls
onInterest.onInterest(prefix, interest, face, interestFilterId, filter).
The onInterest callback should supply the Data with face.putData().
NOTE: You must not change the prefix or filter objects - if you need to
change them then make a copy.
If onInterest is null, it is ignored and you must call setInterestFilter.
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.onRegisterFailed
- If register prefix fails for any reason, this
calls onRegisterFailed.onRegisterFailed(prefix).
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.onRegisterSuccess
- This calls
onRegisterSuccess.onRegisterSuccess(prefix, registeredPrefixId) when this
receives a success message from the forwarder. If onRegisterSuccess is null,
this does not use it. (The onRegisterSuccess parameter comes after
onRegisterFailed because it can be null or omitted, unlike onRegisterFailed.)
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.IOException
- For I/O error in sending the registration request.SecurityException
- If signing a command interest for NFD and cannot
find the private key for the certificateName.public long registerPrefix(Name prefix, OnInterestCallback onInterest, OnRegisterSuccess onRegisterSuccess, OnRegisterFailed onRegisterFailed) throws IOException, SecurityException
IOException
SecurityException
public long registerPrefix(Name prefix, OnInterestCallback onInterest, OnRegisterFailed onRegisterFailed, ForwardingFlags flags, WireFormat wireFormat) throws IOException, SecurityException
prefix
- A Name for the prefix to register. This copies the Name.onInterest
- If not null, this creates an interest filter from prefix
so that when an Interest is received which matches the filter, this calls
onInterest.onInterest(prefix, interest, face, interestFilterId, filter).
The onInterest callback should supply the Data with face.putData().
NOTE: You must not change the prefix or filter objects - if you need to
change them then make a copy.
If onInterest is null, it is ignored and you must call setInterestFilter.
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.onRegisterFailed
- If register prefix fails for any reason, this
calls onRegisterFailed.onRegisterFailed(prefix).
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.flags
- The flags for finer control of which interests are forwarded
to the application.wireFormat
- A WireFormat object used to encode the message.IOException
- For I/O error in sending the registration request.SecurityException
- If signing a command interest for NFD and cannot
find the private key for the certificateName.public long registerPrefix(Name prefix, OnInterestCallback onInterest, OnRegisterFailed onRegisterFailed, ForwardingFlags flags) throws IOException, SecurityException
prefix
- A Name for the prefix to register. This copies the Name.onInterest
- If not null, this creates an interest filter from prefix
so that when an Interest is received which matches the filter, this calls
onInterest.onInterest(prefix, interest, face, interestFilterId, filter).
The onInterest callback should supply the Data with face.putData().
NOTE: You must not change the prefix or filter objects - if you need to
change them then make a copy.
If onInterest is null, it is ignored and you must call setInterestFilter.
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.onRegisterFailed
- If register prefix fails for any reason, this
calls onRegisterFailed.onRegisterFailed(prefix).
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.flags
- The flags for finer control of which interests are forwarded
to the application.IOException
- For I/O error in sending the registration request.SecurityException
public long registerPrefix(Name prefix, OnInterestCallback onInterest, OnRegisterFailed onRegisterFailed, WireFormat wireFormat) throws IOException, SecurityException
prefix
- A Name for the prefix to register. This copies the Name.onInterest
- If not null, this creates an interest filter from prefix
so that when an Interest is received which matches the filter, this calls
onInterest.onInterest(prefix, interest, face, interestFilterId, filter).
The onInterest callback should supply the Data with face.putData().
NOTE: You must not change the prefix or filter objects - if you need to
change them then make a copy.
If onInterest is null, it is ignored and you must call setInterestFilter.
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.onRegisterFailed
- If register prefix fails for any reason, this
calls onRegisterFailed.onRegisterFailed(prefix).
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.wireFormat
- A WireFormat object used to encode the message.IOException
- For I/O error in sending the registration request.SecurityException
- If signing a command interest for NFD and cannot
find the private key for the certificateName.public long registerPrefix(Name prefix, OnInterestCallback onInterest, OnRegisterFailed onRegisterFailed) throws IOException, SecurityException
prefix
- A Name for the prefix to register. This copies the Name.onInterest
- If not null, this creates an interest filter from prefix
so that when an Interest is received which matches the filter, this calls
onInterest.onInterest(prefix, interest, face, interestFilterId, filter).
The onInterest callback should supply the Data with face.putData().
NOTE: You must not change the prefix or filter objects - if you need to
change them then make a copy.
If onInterest is null, it is ignored and you must call setInterestFilter.
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.onRegisterFailed
- If register prefix fails for any reason, this
calls onRegisterFailed.onRegisterFailed(prefix).
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.IOException
- For I/O error in sending the registration request.SecurityException
- If signing a command interest for NFD and cannot
find the private key for the certificateName.public long registerPrefix(Name prefix, OnInterest onInterest, OnRegisterFailed onRegisterFailed, ForwardingFlags flags, WireFormat wireFormat) throws IOException, SecurityException
IOException
SecurityException
public long registerPrefix(Name prefix, OnInterest onInterest, OnRegisterFailed onRegisterFailed, ForwardingFlags flags) throws IOException, SecurityException
IOException
SecurityException
public long registerPrefix(Name prefix, OnInterest onInterest, OnRegisterFailed onRegisterFailed, WireFormat wireFormat) throws IOException, SecurityException
IOException
SecurityException
public long registerPrefix(Name prefix, OnInterest onInterest, OnRegisterFailed onRegisterFailed) throws IOException, SecurityException
IOException
SecurityException
public void removeRegisteredPrefix(long registeredPrefixId)
registeredPrefixId
- The ID returned from registerPrefix.public long setInterestFilter(InterestFilter filter, OnInterestCallback onInterest)
filter
- The InterestFilter with a prefix and optional regex filter
used to match the name of an incoming Interest. This makes a copy of filter.onInterest
- When an Interest is received which matches the filter,
this calls
onInterest.onInterest(prefix, interest, face, interestFilterId, filter).
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.public long setInterestFilter(Name prefix, OnInterestCallback onInterest)
prefix
- The Name prefix used to match the name of an incoming
Interest.onInterest
- This creates an interest filter from prefix so that when
an Interest is received which matches the filter, this calls
onInterest.onInterest(prefix, interest, face, interestFilterId, filter).
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.public void unsetInterestFilter(long interestFilterId)
interestFilterId
- The ID returned from setInterestFilter.public void putData(Data data, WireFormat wireFormat) throws IOException
data
- The Data packet which satisfies the interest.wireFormat
- A WireFormat object used to encode the Data packet.Error
- If the encoded Data packet size exceeds getMaxNdnPacketSize().IOException
public void putData(Data data) throws IOException
data
- The Data packet which satisfies the interest.Error
- If the encoded Data packet size exceeds getMaxNdnPacketSize().IOException
public void send(Blob encoding) throws IOException
encoding
- The blob with the the encoded packet to send.Error
- If the encoded packet size exceeds getMaxNdnPacketSize().IOException
public void send(ByteBuffer encoding) throws IOException
encoding
- The array of bytes for the encoded packet to send. This
reads from position() to limit(), but does not change the position.Error
- If the encoded packet size exceeds getMaxNdnPacketSize().IOException
public void processEvents() throws IOException, EncodingException
IOException
EncodingException
public boolean isLocal() throws IOException
IOException
public void shutdown()
public static int getMaxNdnPacketSize()
public void callLater(double delayMilliseconds, Runnable callback)
delayMilliseconds
- The delay in milliseconds.callback
- This calls callback.run() after the delay.protected static Interest getInterestCopy(Name name, Interest interestTemplate)
name
- A Name for the interest. This copies the Name.interestTemplate
- if not null, copy interest selectors from the
template. This does not keep a pointer to the Interest object.Copyright © 2016. All rights reserved.