public class NFD extends Object
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_TIMEOUT |
static int |
OK_STATUS |
Constructor and Description |
---|
NFD() |
Modifier and Type | Method and Description |
---|---|
static void |
addNextHop(net.named_data.jndn.Face forwarder,
int faceId,
net.named_data.jndn.Name prefix)
Helper method to register a new face on the forwarder; as mentioned at
http://named-data.net/doc/NFD/current/manpages/nfdc.html,
this is more for debugging; use 'register' instead
|
static int |
createFace(net.named_data.jndn.Face forwarder,
String uri)
Create a new face on the given forwarder.
|
static void |
destroyFace(net.named_data.jndn.Face forwarder,
int faceId)
Destroy a face on given forwarder.
|
static void |
disableLocalControlHeader(net.named_data.jndn.Face forwarder,
LocalControlHeader header)
Disable a local control feature on the given forwarder.
|
static void |
enableLocalControlHeader(net.named_data.jndn.Face forwarder,
LocalControlHeader header)
Enable a local control feature on the given forwarder.
|
static List<FaceStatus> |
getFaceList(net.named_data.jndn.Face forwarder)
Retrieve a list of faces and their status from the given forwarder; calls
/localhost/nfd/faces/list which requires a local Face (all non-local
packets are dropped)
|
static List<FibEntry> |
getFibList(net.named_data.jndn.Face forwarder)
Retrieve a list of FIB entries and their NextHopRecords from the given
forwarder; calls /localhost/nfd/fib/list which requires a local Face (all
non-local packets are dropped).
|
static ForwarderStatus |
getForwarderStatus(net.named_data.jndn.Face forwarder)
Retrieve the status of the given forwarder; calls /localhost/nfd/status
which requires a local Face (all non-local packets are dropped)
|
static net.named_data.jndn.KeyLocator |
getKeyLocator(net.named_data.jndn.Face forwarder)
Retrieve the
KeyLocator for an NFD. |
static List<RibEntry> |
getRouteList(net.named_data.jndn.Face forwarder)
Retrieve a list of routing entries from the RIB; calls
/localhost/nfd/rib/list which requires a local Face (all non-local packets
are dropped).
|
static List<StrategyChoice> |
getStrategyList(net.named_data.jndn.Face forwarder)
Retrieve the list of strategy choice entries from the NFD; calls
/localhost/nfd/rib/list which requires a local Face (all non-local packets
are dropped).
|
static boolean |
ping(net.named_data.jndn.Face face,
net.named_data.jndn.Name name)
Request a name on an existing face to verify the forwarder is working and
responding to requests.
|
static boolean |
pingLocal(net.named_data.jndn.Face face)
Ping a forwarder on an existing face to verify that the forwarder is
working and responding to requests; this version sends a discovery packet
to /localhost/nfd which should always respond if the requestor is on the
same machine as the NDN forwarding daemon.
|
static void |
register(net.named_data.jndn.Face forwarder,
net.named_data.jndn.ControlParameters controlParameters)
Register a route on the forwarder; see
http://named-data.net/doc/NFD/current/manpages/nfdc.html
for command-line usage and
http://redmine.named-data.net/projects/nfd/wiki/RibMgmt
for protocol documentation.
|
static void |
register(net.named_data.jndn.Face forwarder,
int faceId,
net.named_data.jndn.Name route,
int cost)
Register a route on a forwarder; this will not create a new face since it
is provided a faceId.
|
static void |
register(net.named_data.jndn.Face forwarder,
String uri,
net.named_data.jndn.Name route,
int cost)
Register a route on a forwarder; this will create a new face on the
forwarder to the given URI/route pair.
|
static net.named_data.jndn.Data |
retrieveDataSet(net.named_data.jndn.Face forwarder,
net.named_data.jndn.Name datasetName)
Build an interest to retrieve a segmented data set from the NFD; for
details on the DataSet, see
http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
|
static ControlResponse |
sendCommand(net.named_data.jndn.Face forwarder,
net.named_data.jndn.Interest interest)
Send an interest as a command to the forwarder; this method will convert
the interest to a command interest and block until a response is received
from the forwarder.
|
static void |
setStrategy(net.named_data.jndn.Face forwarder,
net.named_data.jndn.Name prefix,
net.named_data.jndn.Name strategy)
Set a strategy on the forwarder; see
http://named-data.net/doc/NFD/current/manpages/nfdc.html
for command-line usage and
http://redmine.named-data.net/projects/nfd/wiki/StrategyChoice
for protocol documentation.
|
static void |
unregister(net.named_data.jndn.Face forwarder,
net.named_data.jndn.ControlParameters controlParameters)
Unregister a route on a forwarder; see
http://named-data.net/doc/NFD/current/manpages/nfdc.html
for command-line usage and
http://redmine.named-data.net/projects/nfd/wiki/RibMgmt
for protocol documentation.
|
static void |
unregister(net.named_data.jndn.Face forwarder,
net.named_data.jndn.Name route)
Unregister a route on a forwarder; see
http://named-data.net/doc/NFD/current/manpages/nfdc.html
for command-line usage and
http://redmine.named-data.net/projects/nfd/wiki/RibMgmt
for protocol documentation.
|
static void |
unregister(net.named_data.jndn.Face forwarder,
net.named_data.jndn.Name route,
int faceId)
Unregister a route on a forwarder; see
http://named-data.net/doc/NFD/current/manpages/nfdc.html
for command-line usage and
http://redmine.named-data.net/projects/nfd/wiki/RibMgmt
for protocol documentation.
|
static void |
unregister(net.named_data.jndn.Face forwarder,
net.named_data.jndn.Name route,
String uri)
Unregister a route on a forwarder; see
http://named-data.net/doc/NFD/current/manpages/nfdc.html
for command-line usage and
http://redmine.named-data.net/projects/nfd/wiki/RibMgmt
for protocol documentation.
|
static void |
unsetStrategy(net.named_data.jndn.Face forwarder,
net.named_data.jndn.Name prefix)
Set a strategy on the forwarder; see
setStrategy(net.named_data.jndn.Face, net.named_data.jndn.Name, net.named_data.jndn.Name)
for more information. |
public static final long DEFAULT_TIMEOUT
public static final int OK_STATUS
public static boolean pingLocal(net.named_data.jndn.Face face)
face
- only a localhost Facepublic static boolean ping(net.named_data.jndn.Face face, net.named_data.jndn.Name name)
face
- a Face
to pingname
- a known Name
that the remote node will answer topublic static ForwarderStatus getForwarderStatus(net.named_data.jndn.Face forwarder) throws IOException, net.named_data.jndn.encoding.EncodingException
forwarder
- only a localhost FaceIOException
- if the network request failednet.named_data.jndn.encoding.EncodingException
- if the returned status could not be decodedpublic static List<FaceStatus> getFaceList(net.named_data.jndn.Face forwarder) throws IOException, ManagementException
forwarder
- only a localhost FaceIOException
- if the network request failedManagementException
- if the NFD rejected the requestpublic static List<FibEntry> getFibList(net.named_data.jndn.Face forwarder) throws IOException, ManagementException
forwarder
- only a localhost FaceIOException
- if the network request failedManagementException
- if the NFD rejected the requestpublic static List<RibEntry> getRouteList(net.named_data.jndn.Face forwarder) throws IOException, ManagementException
forwarder
- only a localhost FaceIOException
- if the network request failedManagementException
- if the NFD rejected the requestpublic static List<StrategyChoice> getStrategyList(net.named_data.jndn.Face forwarder) throws IOException, ManagementException
forwarder
- only a localhost FaceIOException
- if the network request failedManagementException
- if the NFD rejected the requestpublic static net.named_data.jndn.KeyLocator getKeyLocator(net.named_data.jndn.Face forwarder) throws ManagementException, IOException
KeyLocator
for an NFD.forwarder
- only a localhost Face
KeyLocator
of the NFD's keyIOException
- if the network request failedManagementException
- if the NFD rejected the request or no
KeyLocator was foundpublic static void addNextHop(net.named_data.jndn.Face forwarder, int faceId, net.named_data.jndn.Name prefix) throws IOException, net.named_data.jndn.encoding.EncodingException, ManagementException
forwarder
- only a localhost Face
faceId
- the ID of the face to add, see
createFace(net.named_data.jndn.Face, java.lang.String)
for
creating thisprefix
- the Name
of the next-hop prefixIOException
- if the network request failednet.named_data.jndn.encoding.EncodingException
- if the NFD response could not be decodedManagementException
- if the NFD rejected the requestpublic static int createFace(net.named_data.jndn.Face forwarder, String uri) throws IOException, net.named_data.jndn.encoding.EncodingException, ManagementException
forwarder
- only a localhost Face
uri
- a string like "tcp4://host.name.com" (see nfd-status channels
for more protocol options)IOException
- if the network request failednet.named_data.jndn.encoding.EncodingException
- if the NFD response could not be decodedManagementException
- if the NFD rejected the requestpublic static void destroyFace(net.named_data.jndn.Face forwarder, int faceId) throws IOException, net.named_data.jndn.encoding.EncodingException, ManagementException
forwarder
- only a localhost Face
faceId
- the ID of the face to destroyIOException
- if the network request failednet.named_data.jndn.encoding.EncodingException
- if the NFD response could not be decodedManagementException
- if the NFD rejected the requestpublic static void enableLocalControlHeader(net.named_data.jndn.Face forwarder, LocalControlHeader header) throws IOException, net.named_data.jndn.encoding.EncodingException, ManagementException
forwarder
- only a localhost Face
header
- the control feature to enableIOException
- if the network request failednet.named_data.jndn.encoding.EncodingException
- if the NFD response could not be decodedManagementException
- if the NFD rejected the requestpublic static void disableLocalControlHeader(net.named_data.jndn.Face forwarder, LocalControlHeader header) throws IOException, net.named_data.jndn.encoding.EncodingException, ManagementException
forwarder
- only a localhost Face
header
- the control feature to disableIOException
- if the network request failednet.named_data.jndn.encoding.EncodingException
- if the NFD response could not be decodedManagementException
- if the NFD rejected the requestpublic static void register(net.named_data.jndn.Face forwarder, net.named_data.jndn.ControlParameters controlParameters) throws IOException, net.named_data.jndn.encoding.EncodingException, ManagementException
forwarder
- only a localhost Face
controlParameters
- the ControlParameters
command optionsIOException
- if the network request failednet.named_data.jndn.encoding.EncodingException
- if the NFD response could not be decodedManagementException
- if the NFD rejected the requestpublic static void register(net.named_data.jndn.Face forwarder, String uri, net.named_data.jndn.Name route, int cost) throws IOException, net.named_data.jndn.encoding.EncodingException, ManagementException
forwarder
- only a localhost Face
uri
- the URI (e.g. "tcp4://10.10.2.2:6363") of the remote node; note
that this must be one of the canonical forms described in the wiki
(http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#TCP) for NFD to
accept the registration--otherwise you will see 400 errorsroute
- the Name
prefix of the routecost
- the numeric cost of forwarding along the routeIOException
- if the network request failednet.named_data.jndn.encoding.EncodingException
- if the NFD response could not be decodedManagementException
- if the NFD rejected the requestpublic static void register(net.named_data.jndn.Face forwarder, int faceId, net.named_data.jndn.Name route, int cost) throws IOException, net.named_data.jndn.encoding.EncodingException, ManagementException
forwarder
- only a localhost Face
faceId
- the ID of the Face
to assign to the routeroute
- the Name
prefix of the routecost
- the numeric cost of forwarding along the routeIOException
- if the network request failednet.named_data.jndn.encoding.EncodingException
- if the NFD response could not be decodedManagementException
- if the NFD rejected the requestpublic static void unregister(net.named_data.jndn.Face forwarder, net.named_data.jndn.ControlParameters controlParameters) throws IOException, net.named_data.jndn.encoding.EncodingException, ManagementException
forwarder
- only a localhost Face
controlParameters
- the ControlParameters
command optionsIOException
- if the network request failednet.named_data.jndn.encoding.EncodingException
- if the NFD response could not be decodedManagementException
- if the NFD rejected the requestpublic static void unregister(net.named_data.jndn.Face forwarder, net.named_data.jndn.Name route) throws IOException, net.named_data.jndn.encoding.EncodingException, ManagementException
forwarder
- only a localhost Face
route
- the Name
prefix of the routeIOException
- if the network request failednet.named_data.jndn.encoding.EncodingException
- if the NFD response could not be decodedManagementException
- if the NFD rejected the requestpublic static void unregister(net.named_data.jndn.Face forwarder, net.named_data.jndn.Name route, int faceId) throws IOException, net.named_data.jndn.encoding.EncodingException, ManagementException
forwarder
- only a localhost Face
route
- the Name
prefix of the routefaceId
- the specific ID of the face to remove (more than one face can
be registered to a route)IOException
- if the network request failednet.named_data.jndn.encoding.EncodingException
- if the NFD response could not be decodedManagementException
- if the NFD rejected the requestpublic static void unregister(net.named_data.jndn.Face forwarder, net.named_data.jndn.Name route, String uri) throws IOException, net.named_data.jndn.encoding.EncodingException, ManagementException
forwarder
- only a localhost Face
route
- the Name
prefix of the routeuri
- the URI (e.g. "tcp4://some.host.com") of the remote node (more
than one face can be registered to a route)IOException
- if the network request failednet.named_data.jndn.encoding.EncodingException
- if the NFD response could not be decodedManagementException
- if the NFD rejected the requestpublic static void setStrategy(net.named_data.jndn.Face forwarder, net.named_data.jndn.Name prefix, net.named_data.jndn.Name strategy) throws IOException, net.named_data.jndn.encoding.EncodingException, ManagementException
forwarder
- only a localhost Face
prefix
- the Name
prefixstrategy
- the Name
of the strategy to set, e.g.
/localhost/nfd/strategy/broadcastIOException
- if the network request failednet.named_data.jndn.encoding.EncodingException
- if the NFD response could not be decodedManagementException
- if the NFD rejected the requestpublic static void unsetStrategy(net.named_data.jndn.Face forwarder, net.named_data.jndn.Name prefix) throws IOException, net.named_data.jndn.encoding.EncodingException, ManagementException
setStrategy(net.named_data.jndn.Face, net.named_data.jndn.Name, net.named_data.jndn.Name)
for more information. Ensure the forwarding face is on the local machine
(management requests are to /localhost/...) and that command signing has
been set up (e.g. forwarder.setCommandSigningInfo()).forwarder
- only a localhost Face
prefix
- the Name
prefixIOException
- if the network request failednet.named_data.jndn.encoding.EncodingException
- if the NFD response could not be decodedManagementException
- if the NFD rejected the requestpublic static net.named_data.jndn.Data retrieveDataSet(net.named_data.jndn.Face forwarder, net.named_data.jndn.Name datasetName) throws IOException, ManagementException
forwarder
- the Face
to an NFDdatasetName
- the Name
of the dataset to retrieveData
packetIOException
- if the request failsManagementException
- if the returned TLV is not the expected typepublic static ControlResponse sendCommand(net.named_data.jndn.Face forwarder, net.named_data.jndn.Interest interest) throws IOException, net.named_data.jndn.encoding.EncodingException, ManagementException
forwarder
- only a localhost Face, command signing info must be setinterest
- As described at
http://redmine.named-data.net/projects/nfd/wiki/ControlCommand,
the requested interest must have encoded ControlParameters appended to the
interest nameControlResponse
IOException
net.named_data.jndn.encoding.EncodingException
ManagementException
Copyright © 2015. All rights reserved.