Remove all
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 65c5ca8..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/README.md b/README.md
deleted file mode 100644
index 72a81fc..0000000
--- a/README.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# jndn-management
-
-This project consists of tools for managing an NDN forwarding daemon (NFD). It relies on the [NDN Protocol](https://named-data.net) and its associated [client library](https://github.com/named-data/jndn). It implements the NFD management specification outlined at http://redmine.named-data.net/projects/nfd/wiki/Management. Please note that this library does not yet implement all of the commands in the management specification.
-
-## Install
-With Maven, add the following to your POM:
-```
-<dependency>
- <groupId>com.intel.jndn.management</groupId>
- <artifactId>jndn-management</artifactId>
- <version>RELEASE</version> <!-- or a specific version -->
-</dependency>
-```
-
-## Use
-With a Face that has command signing information set, call any of the following static methods:
- - __NFD.pingLocal(Face forwarder)__: ping a local NFD with /localhost/nfd to verify if it exists.
- - __NFD.getFaceList(Face forwarder)__: retrieve all connected faces.
- - __NFD.getFibList(Face forwarder)__: retrieve all forwarding entries in the Forwarding Information Base (FIB).
- - __NFD.getRibList(Face forwarder)__: retrieve all routing entries in the Routing Information Base (RIB).
- - __NFD.createFace(Face forwarder, String uri)__: create a new face on the NFD opened to the given URI.
- - __NFD.register(Face forwarder, ...)__: includes several similar methods for registering a new route on the NFD.
- - __NFD.unregister(Face forwarder, Name route)__: unregister a route by name.
- - __NFD.setStrategy(Face forwarder, Name prefix, Name strategy)__: set the forwarding strategy for the given prefix.
-
-## License
-Copyright © 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU Lesser General Public License, version 3, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the [GNU Lesser General Public License](https://github.com/01org/jndn-management/blob/master/LICENSE) for more details.
diff --git a/nb-configuration.xml b/nb-configuration.xml
deleted file mode 100644
index 2beea40..0000000
--- a/nb-configuration.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-shared-configuration>
- <!--
-This file contains additional configuration written by modules in the NetBeans IDE.
-The configuration is intended to be shared among all the users of project and
-therefore it is assumed to be part of version control checkout.
-Without this configuration present, some functionality in the IDE may be limited or fail altogether.
--->
- <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
- <!--
-Properties that influence various parts of the IDE, especially code formatting and the like.
-You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
-That way multiple projects can share the same settings (useful for formatting rules for example).
-Any value defined here will override the pom.xml file value but is only applicable to the current project.
--->
- <netbeans.hint.license>intel-license-lgpl</netbeans.hint.license>
- <org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
- <org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>2</org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>
- <org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>4</org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>
- <org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>2</org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>
- <org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>true</org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>
- <org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>80</org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>
- <org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>none</org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>
- <org-netbeans-modules-editor-indent.text.x-fortran.CodeStyle.project.text-limit-width>132</org-netbeans-modules-editor-indent.text.x-fortran.CodeStyle.project.text-limit-width>
- </properties>
-</project-shared-configuration>
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index bc69d87..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.intel.jndn.management</groupId>
- <artifactId>jndn-management</artifactId>
- <version>0.9.6</version>
- <name>jndn-management</name>
- <description>Tools for managing an NDN forwarding daemon</description>
- <url>https://github.com/01org/jndn-management</url>
- <packaging>jar</packaging>
- <licenses>
- <license>
- <name>LGPL v3</name>
- <url>https://www.gnu.org/licenses/lgpl.html</url>
- </license>
- </licenses>
- <developers>
- <developer>
- <name>Andrew Brown</name>
- <url>http://github.com/andrewsbrown</url>
- </developer>
- </developers>
- <scm>
- <url>https://github.com/01org/jndn-management</url>
- <connection>scm:git:git@github.com:01org/jndn-management.git</connection>
- <developerConnection>scm:git:git@github.com:01org/jndn-management.git</developerConnection>
- </scm>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compiler.source>1.7</maven.compiler.source>
- <maven.compiler.target>1.7</maven.compiler.target>
- </properties>
- <dependencies>
- <dependency>
- <groupId>net.named-data</groupId>
- <artifactId>jndn</artifactId>
- <version>RELEASE</version>
- </dependency>
- <dependency>
- <groupId>com.intel.jndn.utils</groupId>
- <artifactId>jndn-utils</artifactId>
- <version>RELEASE</version>
- </dependency>
- <!-- test dependencies -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.10</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.intel.jndn.mock</groupId>
- <artifactId>jndn-mock</artifactId>
- <version>RELEASE</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <profiles>
- <profile>
- <id>ossrh</id>
- <build>
- <plugins>
- <!-- OSSRH-directed plugins (see http://central.sonatype.org/pages/apache-maven.html) -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>2.4</version>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar-no-fork</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.10.1</version>
- <executions>
- <execution>
- <id>attach-javadocs</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>nexus-staging-maven-plugin</artifactId>
- <version>1.6.3</version>
- <extensions>true</extensions>
- <configuration>
- <serverId>ossrh</serverId>
- <stagingProfileId>a80137db01223a</stagingProfileId>
- <nexusUrl>https://oss.sonatype.org/</nexusUrl>
- <autoReleaseAfterClose>true</autoReleaseAfterClose>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-gpg-plugin</artifactId>
- <version>1.5</version>
- <executions>
- <execution>
- <id>sign-artifacts</id>
- <phase>verify</phase>
- <goals>
- <goal>sign</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
\ No newline at end of file
diff --git a/src/main/java/com/intel/jndn/management/EncodingHelper.java b/src/main/java/com/intel/jndn/management/EncodingHelper.java
deleted file mode 100644
index 5d658ee..0000000
--- a/src/main/java/com/intel/jndn/management/EncodingHelper.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management;
-
-import java.nio.ByteBuffer;
-import net.named_data.jndn.ControlParameters;
-import net.named_data.jndn.ForwardingFlags;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.Tlv;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Provide helper methods to cover areas too protected in Tlv0_1_1WireFormat;
- * this class can be deprecated if WireFormats allow passing in an existing
- * TlvEncoder/TlvDecoder (currently these methods are protected).
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class EncodingHelper {
-
- /**
- * Helper to decode names since Tlv0_1_1WireFormat.java uses its own internal,
- * protected implementation.
- *
- * @param input
- * @return
- * @throws EncodingException
- */
- public static Name decodeName(ByteBuffer input) throws EncodingException {
- TlvDecoder decoder = new TlvDecoder(input);
- return decodeName(decoder);
- }
-
- /**
- * Helper to decode names using an existing decoding context; could be merged
- * to Tlv0_1_1WireFormat.java.
- *
- * @param decoder
- * @return
- * @throws EncodingException
- */
- public static Name decodeName(TlvDecoder decoder) throws EncodingException {
- Name name = new Name();
- int endOffset = decoder.readNestedTlvsStart(Tlv.Name);
- while (decoder.getOffset() < endOffset) {
- name.append(new Blob(decoder.readBlobTlv(Tlv.NameComponent), true));
- }
-
- decoder.finishNestedTlvs(endOffset);
- return name;
- }
-
- /**
- * Helper to encode names since Tlv0_1_1WireFormat.java uses its own internal,
- * protected implementation.
- *
- * @param name
- * @return
- */
- public static Blob encodeName(Name name) {
- TlvEncoder encoder = new TlvEncoder();
- encodeName(name, encoder);
- return new Blob(encoder.getOutput(), false);
- }
-
- /**
- * Helper to encode names using an existing encoding context; could be merged
- * to Tlv0_1_1WireFormat.java.
- *
- * @param name
- * @param encoder
- */
- public static final void encodeName(Name name, TlvEncoder encoder) {
- int saveLength = encoder.getLength();
- for (int i = name.size() - 1; i >= 0; --i) {
- encoder.writeBlobTlv(Tlv.NameComponent, name.get(i).getValue().buf());
- }
- encoder.writeTypeAndLength(Tlv.Name, encoder.getLength() - saveLength);
- }
-
- /**
- * Helper to encode control parameters using an existing encoding context;
- * could be merged to Tlv0_1_1WireFormat.java.
- *
- * @param controlParameters
- * @param encoder
- */
- public static final void encodeControlParameters(ControlParameters controlParameters, TlvEncoder encoder) {
- int saveLength = encoder.getLength();
-
- // Encode backwards.
- encoder.writeOptionalNonNegativeIntegerTlvFromDouble(Tlv.ControlParameters_ExpirationPeriod,
- controlParameters.getExpirationPeriod());
-
- // Encode strategy
- if (controlParameters.getStrategy().size() != 0) {
- int strategySaveLength = encoder.getLength();
- encodeName(controlParameters.getStrategy(), encoder);
- encoder.writeTypeAndLength(Tlv.ControlParameters_Strategy,
- encoder.getLength() - strategySaveLength);
- }
-
- // Encode ForwardingFlags
- int flags = controlParameters.getForwardingFlags().getNfdForwardingFlags();
- if (flags != new ForwardingFlags().getNfdForwardingFlags()) // The flags are not the default value.
- {
- encoder.writeNonNegativeIntegerTlv(Tlv.ControlParameters_Flags, flags);
- }
-
- encoder.writeOptionalNonNegativeIntegerTlv(Tlv.ControlParameters_Cost, controlParameters.getCost());
- encoder.writeOptionalNonNegativeIntegerTlv(Tlv.ControlParameters_Origin, controlParameters.getOrigin());
- encoder.writeOptionalNonNegativeIntegerTlv(Tlv.ControlParameters_LocalControlFeature,
- controlParameters.getLocalControlFeature());
-
- // Encode URI
- if (!controlParameters.getUri().isEmpty()) {
- encoder.writeBlobTlv(Tlv.ControlParameters_Uri,
- new Blob(controlParameters.getUri()).buf());
- }
-
- encoder.writeOptionalNonNegativeIntegerTlv(Tlv.ControlParameters_FaceId, controlParameters.getFaceId());
-
- // Encode name
- if (controlParameters.getName().size() != 0) {
- encodeName(controlParameters.getName(), encoder);
- }
-
- encoder.writeTypeAndLength(Tlv.ControlParameters_ControlParameters, encoder.getLength() - saveLength);
- }
-}
diff --git a/src/main/java/com/intel/jndn/management/ManagementException.java b/src/main/java/com/intel/jndn/management/ManagementException.java
deleted file mode 100644
index 70a15d1..0000000
--- a/src/main/java/com/intel/jndn/management/ManagementException.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management;
-
-import com.intel.jndn.management.types.ControlResponse;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a failure to correctly manage the NDN Forwarding Daemon (NFD).
- * Inspect this object with getCause() to see why the management operation
- * failed.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class ManagementException extends Exception {
-
- /**
- *
- * @param message
- */
- public ManagementException(String message) {
- super(message);
- }
-
- /**
- *
- * @param message
- * @param cause
- */
- public ManagementException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Parse an NFD response to create a ManagementException.
- *
- * @param forwarderResponse
- * @return
- */
- public static ManagementException fromResponse(Blob forwarderResponse) {
- ControlResponse response = new ControlResponse();
- try {
- response.wireDecode(forwarderResponse.buf());
- String message = "Action failed, forwarder returned: " + response.getStatusCode() + " " + response.getStatusText();
- return new ManagementException(message);
- } catch (EncodingException e) {
- return new ManagementException("Action failed and forwarder response was unparseable.", e);
- }
- }
-
- /**
- * Parse an NFD response to create a ManagementException.
- *
- * @param forwarderResponse
- * @return
- */
- public static ManagementException fromResponse(ControlResponse response) {
- String message = "Action failed, forwarder returned: " + response.getStatusCode() + " " + response.getStatusText();
- return new ManagementException(message);
- }
-}
diff --git a/src/main/java/com/intel/jndn/management/NFD.java b/src/main/java/com/intel/jndn/management/NFD.java
deleted file mode 100644
index c0910b5..0000000
--- a/src/main/java/com/intel/jndn/management/NFD.java
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management;
-
-import com.intel.jndn.management.types.StatusDataset;
-import com.intel.jndn.management.types.ControlResponse;
-import com.intel.jndn.management.types.FaceStatus;
-import com.intel.jndn.management.types.FibEntry;
-import com.intel.jndn.management.types.LocalControlHeader;
-import com.intel.jndn.management.types.RibEntry;
-import com.intel.jndn.utils.SimpleClient;
-import com.intel.jndn.utils.SegmentedClient;
-import java.io.IOException;
-import java.util.List;
-import net.named_data.jndn.ControlParameters;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.ForwardingFlags;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.security.SecurityException;
-import java.util.logging.Logger;
-
-/**
- * Helper class for interacting with an NDN forwarder daemon; see
- * http://redmine.named-data.net/projects/nfd/wiki/Management for explanations
- * of the various protocols used.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class NFD {
-
- public final static long DEFAULT_TIMEOUT = 2000;
- public final static int OK_STATUS = 200;
- static private final Logger logger = Logger.getLogger(NFD.class.getName());
-
- /**
- * 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.
- *
- * @param face
- * @return true if successful, false otherwise
- */
- public static boolean pingLocal(Face face) {
- return ping(face, new Name("/localhost/nfd"));
- }
-
- /**
- * Request a name on an existing face to verify the forwarder is working and
- * responding to requests. Note that the name must be served or cached on the
- * forwarder for this to return true.
- *
- * @param face
- * @param name
- * @return true if successful, false otherwise
- */
- public static boolean ping(Face face, Name name) {
- // build interest
- Interest interest = new Interest(name);
- interest.setInterestLifetimeMilliseconds(DEFAULT_TIMEOUT);
- interest.setMustBeFresh(true);
-
- // send packet
- try {
- Data data = SimpleClient.getDefault().getSync(face, interest);
- return data != null;
- } catch (IOException e) {
- return false;
- }
- }
-
- /**
- * 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)
- *
- * @param forwarder Only a localhost Face
- * @return
- * @throws java.lang.Exception
- */
- public static List<FaceStatus> getFaceList(Face forwarder) throws Exception {
- Data data = retrieveDataSet(forwarder, new Name("/localhost/nfd/faces/list"));
- return StatusDataset.wireDecode(data.getContent(), FaceStatus.class);
- }
-
- /**
- * 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).
- *
- * @param forwarder Only a localhost Face
- * @return
- * @throws java.lang.Exception
- */
- public static List<FibEntry> getFibList(Face forwarder) throws Exception {
- Data data = retrieveDataSet(forwarder, new Name("/localhost/nfd/fib/list"));
- return StatusDataset.wireDecode(data.getContent(), FibEntry.class);
- }
-
- /**
- * 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).
- *
- * @param forwarder Only a localhost Face
- * @return
- * @throws java.lang.Exception
- */
- public static List<RibEntry> getRouteList(Face forwarder) throws Exception {
- Data data = retrieveDataSet(forwarder, new Name("/localhost/nfd/rib/list"));
- return StatusDataset.wireDecode(data.getContent(), RibEntry.class);
- }
-
- /**
- * 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
- *
- * @param forwarder Only a localhost Face
- * @param faceId
- * @param prefix
- * @throws java.lang.Exception
- */
- public static void addNextHop(Face forwarder, int faceId, Name prefix) throws Exception {
- // build command name
- Name command = new Name("/localhost/nfd/fib/add-nexthop");
- ControlParameters parameters = new ControlParameters();
- parameters.setName(prefix);
- parameters.setFaceId(faceId);
- command.append(parameters.wireEncode());
-
- // send the interest
- sendCommand(forwarder, new Interest(command));
- }
-
- /**
- * Create a new face on the given forwarder. 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()).
- *
- * @param forwarder Only a localhost Face
- * @param uri
- * @return
- * @throws java.lang.Exception
- */
- public static int createFace(Face forwarder, String uri) throws Exception {
- Name command = new Name("/localhost/nfd/faces/create");
- ControlParameters parameters = new ControlParameters();
- parameters.setUri(uri);
- command.append(parameters.wireEncode());
-
- // send the interest
- ControlResponse response = sendCommand(forwarder, new Interest(command));
-
- // return
- return response.getBody().get(0).getFaceId();
- }
-
- /**
- * Destroy a face on given forwarder. 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()).
- *
- * @param forwarder Only a localhost Face
- * @param faceId
- * @throws java.lang.Exception
- */
- public static void destroyFace(Face forwarder, int faceId) throws Exception {
- Name command = new Name("/localhost/nfd/faces/destroy");
- ControlParameters parameters = new ControlParameters();
- parameters.setFaceId(faceId);
- command.append(parameters.wireEncode());
-
- // send the interest
- sendCommand(forwarder, new Interest(command));
- }
-
- /**
- * Enable a local control feature on the given forwarder. See
- * http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Enable-a-LocalControlHeader-feature
- *
- * @param forwarder
- * @param header
- * @throws Exception
- */
- public static void enableLocalControlHeader(Face forwarder, LocalControlHeader header) throws Exception {
- // build command name
- Name command = new Name("/localhost/nfd/faces/enable-local-control");
- ControlParameters parameters = new ControlParameters();
- parameters.setLocalControlFeature(header.getNumericValue());
- command.append(parameters.wireEncode());
-
- // send command and return
- sendCommand(forwarder, new Interest(command));
- }
-
- /**
- * Disable a local control feature on the given forwarder. See
- * http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Disable-a-LocalControlHeader-feature
- *
- * @param forwarder
- * @param header
- * @throws Exception
- */
- public static void disableLocalControlHeader(Face forwarder, LocalControlHeader header) throws Exception {
- // build command name
- Name command = new Name("/localhost/nfd/faces/disable-local-control");
- ControlParameters parameters = new ControlParameters();
- parameters.setLocalControlFeature(header.getNumericValue());
- command.append(parameters.wireEncode());
-
- // send command and return
- sendCommand(forwarder, new Interest(command));
- }
-
- /**
- * 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. 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()).
- *
- * @param forwarder Only a localhost Face
- * @param controlParameters
- * @throws Exception
- */
- public static void register(Face forwarder, ControlParameters controlParameters) throws Exception {
- // build command name
- Name command = new Name("/localhost/nfd/rib/register");
- command.append(controlParameters.wireEncode());
-
- // send the interest
- sendCommand(forwarder, new Interest(command));
- }
-
- /**
- * Register a route on a forwarder; this will create a new face on the
- * forwarder to the given URI/route pair. See register(Face,
- * ControlParameters) for more details documentation.
- *
- * @param forwarder Only a localhost Face
- * @param uri
- * @param cost
- * @param route
- * @throws java.lang.Exception
- */
- public static void register(Face forwarder, String uri, Name route, int cost) throws Exception {
- // create the new face
- int faceId = createFace(forwarder, uri);
-
- // run base method
- register(forwarder, faceId, route, cost);
- }
-
- /**
- * Register a route on a forwarder; this will not create a new face since it
- * is provided a faceId. See register(Face, ControlParameters) for full
- * documentation
- *
- * @param forwarder Only a localhost Face
- * @param faceId
- * @param route
- * @param cost
- * @throws java.lang.Exception
- */
- public static void register(Face forwarder, int faceId, Name route, int cost) throws Exception {
- // build command name
- ControlParameters parameters = new ControlParameters();
- parameters.setName(route);
- parameters.setFaceId(faceId);
- parameters.setCost(cost);
- ForwardingFlags flags = new ForwardingFlags();
- flags.setCapture(true);
- flags.setChildInherit(true);
- parameters.setForwardingFlags(flags);
-
- // run base method
- register(forwarder, parameters);
- }
-
- /**
- * 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. 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()
- *
- * @param forwarder
- * @param controlParameters
- * @throws java.lang.Exception
- */
- public static void unregister(Face forwarder, ControlParameters controlParameters) throws Exception {
- // build command name
- Name command = new Name("/localhost/nfd/rib/unregister");
- command.append(controlParameters.wireEncode());
-
- // send the interest
- sendCommand(forwarder, new Interest(command));
- }
-
- /**
- * 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. 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()
- *
- * @param forwarder
- * @param route
- * @throws java.lang.Exception
- */
- public static void unregister(Face forwarder, Name route) throws Exception {
- // build command name
- ControlParameters controlParameters = new ControlParameters();
- controlParameters.setName(route);
-
- // send the interest
- unregister(forwarder, 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. 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()
- *
- * @param forwarder
- * @param route
- * @param faceId
- * @throws java.lang.Exception
- */
- public static void unregister(Face forwarder, Name route, int faceId) throws Exception {
- // build command name
- ControlParameters controlParameters = new ControlParameters();
- controlParameters.setName(route);
- controlParameters.setFaceId(faceId);
-
- // send the interest
- unregister(forwarder, 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. 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()
- *
- * @param forwarder
- * @param route
- * @param uri
- * @throws java.lang.Exception
- */
- public static void unregister(Face forwarder, Name route, String uri) throws Exception {
- int faceId = -1;
- for (FaceStatus face : getFaceList(forwarder)) {
- if (face.getUri().matches(uri)) {
- faceId = face.getFaceId();
- break;
- }
- }
-
- if (faceId == -1) {
- throw new ManagementException("Face not found: " + uri);
- }
-
- // send the interest
- unregister(forwarder, route, faceId);
- }
-
- /**
- * 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. 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()).
- *
- * @param forwarder Only a localhost Face
- * @param prefix
- * @param strategy
- * @throws Exception
- */
- public static void setStrategy(Face forwarder, Name prefix, Name strategy) throws Exception {
- // build command name
- Name command = new Name("/localhost/nfd/strategy-choice/set");
- ControlParameters parameters = new ControlParameters();
- parameters.setName(prefix);
- parameters.setStrategy(strategy);
- command.append(parameters.wireEncode());
-
- // send the interest
- sendCommand(forwarder, new Interest(command));
- }
-
- /**
- * 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
- *
- * @param forwarder
- * @param datasetName
- * @return
- * @throws IOException
- * @throws ManagementException
- */
- public static Data retrieveDataSet(Face forwarder, Name datasetName) throws IOException, ManagementException {
- // build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
- Interest interest = new Interest(datasetName);
- interest.setMustBeFresh(true);
- interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
- interest.setInterestLifetimeMilliseconds(DEFAULT_TIMEOUT);
-
- // send packet
- Data data = SegmentedClient.getDefault().getSync(forwarder, interest);
-
- // check for failed request
- if (data.getContent().buf().get(0) == ControlResponse.TLV_CONTROL_RESPONSE) {
- throw ManagementException.fromResponse(data.getContent());
- }
-
- return data;
- }
-
- /**
- * 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. 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()).
- *
- * @param forwarder Only a localhost Face, command signing info must be set
- * @param interest As described at
- * http://redmine.named-data.net/projects/nfd/wiki/ControlCommand, the
- * requested interest must have encoded ControlParameters appended to the
- * interest name
- * @return
- * @throws java.io.IOException
- * @throws net.named_data.jndn.encoding.EncodingException
- * @throws com.intel.jndn.management.ManagementException
- */
- public static ControlResponse sendCommand(Face forwarder, Interest interest) throws IOException, EncodingException, ManagementException {
- // forwarder must have command signing info set
- try {
- forwarder.makeCommandInterest(interest);
- } catch (SecurityException e) {
- throw new IllegalArgumentException("Failed to make command interest; ensure command signing info is set on the face.", e);
- }
-
- // send command packet
- Data data = SimpleClient.getDefault().getSync(forwarder, interest);
-
- // decode response
- ControlResponse response = new ControlResponse();
- response.wireDecode(data.getContent().buf());
-
- // check response for success
- if (response.getStatusCode() != OK_STATUS) {
- throw ManagementException.fromResponse(response);
- }
-
- return response;
- }
-}
diff --git a/src/main/java/com/intel/jndn/management/types/ControlResponse.java b/src/main/java/com/intel/jndn/management/types/ControlResponse.java
deleted file mode 100644
index 5c87fe7..0000000
--- a/src/main/java/com/intel/jndn/management/types/ControlResponse.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management.types;
-
-import com.intel.jndn.management.EncodingHelper;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-import net.named_data.jndn.ControlParameters;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.Tlv;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a ControlResponse, a Data packet sent in response to a
- * ControlCommand to the NFD, see
- * http://redmine.named-data.net/projects/nfd/wiki/ControlCommand
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class ControlResponse {
-
- /**
- * Use TLV codes from jndn.encoding.tlv.Tlv.java See
- * http://redmine.named-data.net/projects/nfd/wiki/ControlCommand
- */
- public final static int TLV_CONTROL_RESPONSE = 101;
- public final static int TLV_CONTROL_RESPONSE_STATUS_CODE = 102;
- public final static int TLV_CONTROL_RESPONSE_STATUS_TEXT = 103;
-
- /**
- * Encode using a new TLV encoder.
- *
- * @return The encoded buffer.
- */
- public final Blob wireEncode() {
- TlvEncoder encoder = new TlvEncoder();
- wireEncode(encoder);
- return new Blob(encoder.getOutput(), false);
- }
-
- /**
- * Encode as part of an existing encode context.
- *
- * @param encoder
- */
- public final void wireEncode(TlvEncoder encoder) {
- int saveLength = encoder.getLength();
- for (ControlParameters parameters : body) {
- EncodingHelper.encodeControlParameters(parameters, encoder);
- }
- encoder.writeBlobTlv(TLV_CONTROL_RESPONSE_STATUS_TEXT, new Blob(statusText).buf());
- encoder.writeNonNegativeIntegerTlv(TLV_CONTROL_RESPONSE_STATUS_CODE, statusCode);
- encoder.writeTypeAndLength(TLV_CONTROL_RESPONSE, encoder.getLength() - saveLength);
- }
-
- /**
- * Decode the input from its TLV format.
- *
- * @param input The input buffer to decode. This reads from position() to
- * limit(), but does not change the position.
- * @throws net.named_data.jndn.encoding.EncodingException
- */
- public final void wireDecode(ByteBuffer input) throws EncodingException {
- TlvDecoder decoder = new TlvDecoder(input);
- wireDecode(decoder, input);
- }
-
- /**
- * Decode as part of an existing decode context.
- *
- * @param decoder
- * @param input the WireFormat version that decodes ControlParameters does not
- * allow passing a TlvDecoder, so we must pass the buffer itself
- * @throws EncodingException
- */
- public void wireDecode(TlvDecoder decoder, ByteBuffer input) throws EncodingException {
- int endOffset = decoder.readNestedTlvsStart(TLV_CONTROL_RESPONSE);
-
- // parse known TLVs
- this.statusCode = (int) decoder.readNonNegativeIntegerTlv(TLV_CONTROL_RESPONSE_STATUS_CODE);
- Blob statusText_ = new Blob(decoder.readBlobTlv(TLV_CONTROL_RESPONSE_STATUS_TEXT), true); // copy because buffer is immutable
- this.statusText = statusText_.toString();
-
- // use the already-written decoder for ControlParameters (but we have to copy the buffer)
- while (decoder.peekType(Tlv.ControlParameters_ControlParameters, endOffset)) {
- ByteBuffer copyInput = input.duplicate();
- copyInput.position(decoder.getOffset());
- int internalEndOffset = decoder.readNestedTlvsStart(Tlv.ControlParameters_ControlParameters);
- ControlParameters copyParameters = new ControlParameters();
- copyParameters.wireDecode(copyInput);
- this.body.add(copyParameters);
- decoder.seek(internalEndOffset);
- decoder.finishNestedTlvs(internalEndOffset);
- }
-
- decoder.finishNestedTlvs(endOffset);
- }
-
- /**
- * Get status code
- *
- * @return
- */
- public int getStatusCode() {
- return statusCode;
- }
-
- /**
- * Set status code
- *
- * @param statusCode
- */
- public void setStatusCode(int statusCode) {
- this.statusCode = statusCode;
- }
-
- /**
- * Get status text
- *
- * @return
- */
- public String getStatusText() {
- return statusText;
- }
-
- /**
- * Set status text
- *
- * @param statusText
- */
- public void setStatusText(String statusText) {
- this.statusText = statusText;
- }
-
- /**
- * Get body
- *
- * @return
- */
- public List<ControlParameters> getBody() {
- return body;
- }
-
- /**
- * Set body
- *
- * @param body
- */
- public void setBody(List<ControlParameters> body) {
- this.body = body;
- }
-
- private int statusCode = -1;
- private String statusText = "";
- private List<ControlParameters> body = new ArrayList<>();
-}
diff --git a/src/main/java/com/intel/jndn/management/types/Decodable.java b/src/main/java/com/intel/jndn/management/types/Decodable.java
deleted file mode 100644
index aec50dd..0000000
--- a/src/main/java/com/intel/jndn/management/types/Decodable.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management.types;
-
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-
-/**
- * Interface used by StatusDataset to decode generic message types; if they are
- * Decodable, then StatusDataset will instantiate and decode them.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public interface Decodable {
-
- public void wireDecode(TlvDecoder decoder) throws EncodingException;
-}
diff --git a/src/main/java/com/intel/jndn/management/types/FacePersistency.java b/src/main/java/com/intel/jndn/management/types/FacePersistency.java
deleted file mode 100644
index 084c8c5..0000000
--- a/src/main/java/com/intel/jndn/management/types/FacePersistency.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management.types;
-
-/**
- * Indicate whether the face is persistent; used by FaceStatus See
- * http://redmine.named-data.net/projects/nfd/widi/FaceMgmt
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public enum FacePersistency {
-
- PERSISTENT(0),
- ON_DEMAND(1),
- PERMANENT(2);
-
- FacePersistency(int value) {
- value_ = value;
- }
-
- public final int getNumericValue() {
- return value_;
- }
- private final int value_;
-}
diff --git a/src/main/java/com/intel/jndn/management/types/FaceScope.java b/src/main/java/com/intel/jndn/management/types/FaceScope.java
deleted file mode 100644
index c933b24..0000000
--- a/src/main/java/com/intel/jndn/management/types/FaceScope.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management.types;
-
-/**
- * Indicate whether the face is local for scope control purposes; used by
- * FaceStatus See http://redmine.named-data.net/projects/nfd/widi/FaceMgmt
- *
- * @author andrew
- */
-public enum FaceScope {
-
- LOCAL(0),
- NON_LOCAL(1);
-
- FaceScope(int value) {
- value_ = value;
- }
-
- public final int getNumericValue() {
- return value_;
- }
- private final int value_;
-}
diff --git a/src/main/java/com/intel/jndn/management/types/FaceStatus.java b/src/main/java/com/intel/jndn/management/types/FaceStatus.java
deleted file mode 100644
index b4fec48..0000000
--- a/src/main/java/com/intel/jndn/management/types/FaceStatus.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management.types;
-
-import java.nio.ByteBuffer;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a FaceStatus object from /localhost/nfd/faces/list; see
- * http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt for details
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class FaceStatus implements Decodable {
-
- /**
- * Spec from http://redmine.named-data.net/projects/nfd/wiki/ControlCommand
- */
- public static final int TLV_FACE_ID = 105;
- public static final int TLV_URI = 114;
- public static final int TLV_EXPIRATION_PERIOD = 109;
-
- /**
- * Spec from http://redmine.named-data.net/projects/nfd/widi/FaceMgmt
- */
- public static final int TLV_FACE_STATUS = 128;
- public static final int TLV_LOCAL_URI = 129;
- public static final int TLV_CHANNEL_STATUS = 130;
- public static final int TLV_FACE_SCOPE = 132;
- public static final int TLV_FACE_PERSISTENCY = 133;
- public static final int TLV_LINK_TYPE = 134;
- public static final int TLV_N_IN_INTERESTS = 144;
- public static final int TLV_N_IN_DATAS = 145;
- public static final int TLV_N_OUT_INTERESTS = 146;
- public static final int TLV_N_OUT_DATAS = 147;
- public static final int TLV_N_IN_BYTES = 148;
- public static final int TLV_N_OUT_BYTES = 149;
-
- /**
- * Encode using a new TLV encoder.
- *
- * @return The encoded buffer.
- */
- public final Blob wireEncode() {
- TlvEncoder encoder = new TlvEncoder();
- wireEncode(encoder);
- return new Blob(encoder.getOutput(), false);
- }
-
- /**
- * Encode as part of an existing encode context.
- *
- * @param encoder
- */
- public final void wireEncode(TlvEncoder encoder) {
- int saveLength = encoder.getLength();
- encoder.writeNonNegativeIntegerTlv(TLV_N_OUT_BYTES, outBytes);
- encoder.writeNonNegativeIntegerTlv(TLV_N_IN_BYTES, inBytes);
- encoder.writeNonNegativeIntegerTlv(TLV_N_OUT_DATAS, outDatas);
- encoder.writeNonNegativeIntegerTlv(TLV_N_OUT_INTERESTS, outInterests);
- encoder.writeNonNegativeIntegerTlv(TLV_N_IN_DATAS, inDatas);
- encoder.writeNonNegativeIntegerTlv(TLV_N_IN_INTERESTS, inInterests);
- encoder.writeNonNegativeIntegerTlv(TLV_LINK_TYPE, linkType.getNumericValue());
- encoder.writeNonNegativeIntegerTlv(TLV_FACE_PERSISTENCY, facePersistency.getNumericValue());
- encoder.writeNonNegativeIntegerTlv(TLV_FACE_SCOPE, faceScope.getNumericValue());
- encoder.writeOptionalNonNegativeIntegerTlv(TLV_EXPIRATION_PERIOD, expirationPeriod);
- encoder.writeBlobTlv(TLV_LOCAL_URI, new Blob(localUri).buf());
- encoder.writeBlobTlv(TLV_URI, new Blob(uri).buf());
- encoder.writeNonNegativeIntegerTlv(TLV_FACE_ID, faceId);
- encoder.writeTypeAndLength(TLV_FACE_STATUS, encoder.getLength() - saveLength);
- }
-
- /**
- * Decode the input from its TLV format.
- *
- * @param input The input buffer to decode. This reads from position() to
- * limit(), but does not change the position.
- * @throws net.named_data.jndn.encoding.EncodingException
- */
- public final void wireDecode(ByteBuffer input) throws EncodingException {
- TlvDecoder decoder = new TlvDecoder(input);
- wireDecode(decoder);
- }
-
- /**
- * Decode as part of an existing decode context.
- *
- * @param decoder
- * @throws EncodingException
- */
- @Override
- public void wireDecode(TlvDecoder decoder) throws EncodingException {
- int endOffset = decoder.readNestedTlvsStart(TLV_FACE_STATUS);
- // parse
- this.faceId = (int) decoder.readNonNegativeIntegerTlv(TLV_FACE_ID);
- Blob uri_ = new Blob(decoder.readBlobTlv(TLV_URI), true); // copy because buffer is immutable
- this.uri = uri_.toString();
- Blob localUri_ = new Blob(decoder.readBlobTlv(TLV_LOCAL_URI), true); // copy because buffer is immutable
- this.localUri = localUri_.toString();
- this.expirationPeriod = (int) decoder.readOptionalNonNegativeIntegerTlv(TLV_EXPIRATION_PERIOD, endOffset);
- this.faceScope = FaceScope.values()[(int) decoder.readNonNegativeIntegerTlv(TLV_FACE_SCOPE)];
- this.facePersistency = FacePersistency.values()[(int) decoder.readNonNegativeIntegerTlv(TLV_FACE_PERSISTENCY)];
- this.linkType = LinkType.values()[(int) decoder.readNonNegativeIntegerTlv(TLV_LINK_TYPE)];
- this.inInterests = (int) decoder.readNonNegativeIntegerTlv(TLV_N_IN_INTERESTS);
- this.inDatas = (int) decoder.readNonNegativeIntegerTlv(TLV_N_IN_DATAS);
- this.outInterests = (int) decoder.readNonNegativeIntegerTlv(TLV_N_OUT_INTERESTS);
- this.outDatas = (int) decoder.readNonNegativeIntegerTlv(TLV_N_OUT_DATAS);
- this.inBytes = (int) decoder.readNonNegativeIntegerTlv(TLV_N_IN_BYTES);
- this.outBytes = (int) decoder.readNonNegativeIntegerTlv(TLV_N_OUT_BYTES);
- decoder.finishNestedTlvs(endOffset);
- }
-
- /**
- * Get face ID
- *
- * @return
- */
- public int getFaceId() {
- return faceId;
- }
-
- /**
- * Set face ID
- *
- * @param faceId
- */
- public void setFaceId(int faceId) {
- this.faceId = faceId;
- }
-
- /**
- * Get face ID
- *
- * @return
- */
- public String getUri() {
- return uri;
- }
-
- /**
- * Set URI
- *
- * @param uri
- */
- public void setUri(String uri) {
- this.uri = uri;
- }
-
- /**
- * Get face ID
- *
- * @return
- */
- public String getLocalUri() {
- return localUri;
- }
-
- /**
- * Set local URI
- *
- * @param localUri
- */
- public void setLocalUri(String localUri) {
- this.localUri = localUri;
- }
-
- /**
- * Get expiration period
- *
- * @return
- */
- public int getExpirationPeriod() {
- return expirationPeriod;
- }
-
- /**
- * Set expiration period
- *
- * @param expirationPeriod
- */
- public void setExpirationPeriod(int expirationPeriod) {
- this.expirationPeriod = expirationPeriod;
- }
-
- /**
- * Get face scope value
- *
- * @return
- */
- public FaceScope getFaceScope() {
- return faceScope;
- }
-
- /**
- * Set face scope value
- *
- * @param faceScope
- */
- public void setFaceScope(FaceScope faceScope) {
- this.faceScope = faceScope;
- }
-
- /**
- * Get face persistency value
- *
- * @return
- */
- public FacePersistency getFacePersistency() {
- return facePersistency;
- }
-
- /**
- * Set face persistency value
- *
- * @param facePersistency
- */
- public void setFacePersistency(FacePersistency facePersistency) {
- this.facePersistency = facePersistency;
- }
-
- /**
- * Get link type
- *
- * @return
- */
- public LinkType getLinkType() {
- return linkType;
- }
-
- /**
- * Set link type
- *
- * @param linkType
- */
- public void setLinkType(LinkType linkType) {
- this.linkType = linkType;
- }
-
- /**
- * Get number of received Interest packets
- *
- * @return
- */
- public int getInInterests() {
- return inInterests;
- }
-
- /**
- * Set number of received Interest packets
- *
- * @param inInterests
- */
- public void setInInterests(int inInterests) {
- this.inInterests = inInterests;
- }
-
- /**
- * Get number of sent Interest packets
- *
- * @return
- */
- public int getOutInterests() {
- return outInterests;
- }
-
- /**
- * Set number of sent Interest packets
- *
- * @param outInterests
- */
- public void setOutInterests(int outInterests) {
- this.outInterests = outInterests;
- }
-
- /**
- * Get number of received Data packets
- *
- * @return
- */
- public int getInDatas() {
- return inDatas;
- }
-
- /**
- * Set number of received Data packets
- *
- * @param inDatas
- */
- public void setInDatas(int inDatas) {
- this.inDatas = inDatas;
- }
-
- /**
- * Get number of sent Data packets
- *
- * @return
- */
- public int getOutDatas() {
- return outDatas;
- }
-
- /**
- * Set number of sent Data packets
- *
- * @param outDatas
- */
- public void setOutDatas(int outDatas) {
- this.outDatas = outDatas;
- }
-
- /**
- * Get number of input bytes
- *
- * @return
- */
- public int getInBytes() {
- return inBytes;
- }
-
- /**
- * Set number of input bytes
- *
- * @param inBytes
- */
- public void setInBytes(int inBytes) {
- this.inBytes = inBytes;
- }
-
- /**
- * Get number of output bytes
- *
- * @return
- */
- public int getOutBytes() {
- return outBytes;
- }
-
- /**
- * Set number of output bytes
- *
- * @param outBytes
- */
- public void setOutBytes(int outBytes) {
- this.outBytes = outBytes;
- }
-
- private int faceId = -1;
- private String uri = ""; // can't use URI because some are invalid syntax
- private String localUri = ""; // can't use URI because some are invalid syntax
- private int expirationPeriod = 0;
- private FaceScope faceScope = FaceScope.LOCAL;
- private FacePersistency facePersistency = FacePersistency.ON_DEMAND;
- private LinkType linkType = LinkType.POINT_TO_POINT;
- private int inInterests = 0;
- private int outInterests = 0;
- private int inDatas = 0;
- private int outDatas = 0;
- private int inBytes = 0;
- private int outBytes = 0;
-}
diff --git a/src/main/java/com/intel/jndn/management/types/FibEntry.java b/src/main/java/com/intel/jndn/management/types/FibEntry.java
deleted file mode 100644
index a4a5ff4..0000000
--- a/src/main/java/com/intel/jndn/management/types/FibEntry.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management.types;
-
-import com.intel.jndn.management.EncodingHelper;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a FibEntry returned from /localhost/nfd/fib/list; see
- * http://redmine.named-data.net/projects/nfd/wiki/FibMgmt#FIB-Dataset
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class FibEntry implements Decodable {
-
- public final static int TLV_FIB_ENTRY = 128;
-
- /**
- * Encode using a new TLV encoder.
- *
- * @return The encoded buffer.
- */
- public final Blob wireEncode() {
- TlvEncoder encoder = new TlvEncoder();
- wireEncode(encoder);
- return new Blob(encoder.getOutput(), false);
- }
-
- /**
- * Encode as part of an existing encode context.
- *
- * @param encoder
- */
- public final void wireEncode(TlvEncoder encoder) {
- int saveLength = encoder.getLength();
- for (NextHopRecord record : records) {
- record.wireEncode(encoder);
- }
- EncodingHelper.encodeName(name, encoder);
- encoder.writeTypeAndLength(TLV_FIB_ENTRY, encoder.getLength() - saveLength);
- }
-
- /**
- * Decode the input from its TLV format.
- *
- * @param input The input buffer to decode. This reads from position() to
- * limit(), but does not change the position.
- * @throws EncodingException For invalid encoding.
- */
- public final void wireDecode(ByteBuffer input) throws EncodingException {
- TlvDecoder decoder = new TlvDecoder(input);
- wireDecode(decoder);
- }
-
- /**
- * Decode as part of an existing decode context.
- *
- * @param decoder
- * @throws EncodingException
- */
- @Override
- public final void wireDecode(TlvDecoder decoder) throws EncodingException {
- int endOffset = decoder.readNestedTlvsStart(TLV_FIB_ENTRY);
- name = EncodingHelper.decodeName(decoder);
- while (decoder.getOffset() < endOffset) {
- NextHopRecord record = new NextHopRecord();
- record.wireDecode(decoder);
- records.add(record);
- }
- decoder.finishNestedTlvs(endOffset);
- }
-
- /**
- * Get name
- *
- * @return
- */
- public Name getName() {
- return name;
- }
-
- /**
- * Set name
- *
- * @param name
- */
- public void setName(Name name) {
- this.name = name;
- }
-
- /**
- * Get records
- *
- * @return
- */
- public List<NextHopRecord> getRecords() {
- return records;
- }
-
- /**
- * Set records
- *
- * @param records
- */
- public void setRecords(List<NextHopRecord> records) {
- this.records = records;
- }
-
- private Name name = new Name();
- private List<NextHopRecord> records = new ArrayList<>();
-}
diff --git a/src/main/java/com/intel/jndn/management/types/LinkType.java b/src/main/java/com/intel/jndn/management/types/LinkType.java
deleted file mode 100644
index 4db9877..0000000
--- a/src/main/java/com/intel/jndn/management/types/LinkType.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management.types;
-
-/**
- * Indicate the type of communication link; used by FaceStatus See
- * http://redmine.named-data.net/projects/nfd/widi/FaceMgmt
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public enum LinkType {
-
- POINT_TO_POINT(0),
- MULTI_ACCESS(1);
-
- LinkType(int value) {
- value_ = value;
- }
-
- public final int getNumericValue() {
- return value_;
- }
- private final int value_;
-}
diff --git a/src/main/java/com/intel/jndn/management/types/LocalControlHeader.java b/src/main/java/com/intel/jndn/management/types/LocalControlHeader.java
deleted file mode 100644
index 4a2aee2..0000000
--- a/src/main/java/com/intel/jndn/management/types/LocalControlHeader.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management.types;
-
-/**
- * Define constants for local control header options. See
- * http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Enable-a-LocalControlHeader-feature
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public enum LocalControlHeader {
-
- INCOMING_FACE_ID(1),
- NEXT_HOP_FACE_ID(2),
- CACHING_POLICY(3);
-
- LocalControlHeader(int value) {
- value_ = value;
- }
-
- public final int getNumericValue() {
- return value_;
- }
- private final int value_;
-}
diff --git a/src/main/java/com/intel/jndn/management/types/NextHopRecord.java b/src/main/java/com/intel/jndn/management/types/NextHopRecord.java
deleted file mode 100644
index f3e4dcc..0000000
--- a/src/main/java/com/intel/jndn/management/types/NextHopRecord.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management.types;
-
-import java.nio.ByteBuffer;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.Tlv;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a NextHopRecord in a FibEntry; see
- * http://redmine.named-data.net/projects/nfd/wiki/FibMgmt#FIB-Dataset
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class NextHopRecord {
-
- public final static int TLV_NEXT_HOP_RECORD = 129;
-
- /**
- * Encode using a new TLV encoder.
- *
- * @return The encoded buffer.
- */
- public final Blob wireEncode() {
- TlvEncoder encoder = new TlvEncoder();
- wireEncode(encoder);
- return new Blob(encoder.getOutput(), false);
- }
-
- /**
- * Encode as part of an existing encode context.
- *
- * @param encoder
- */
- public final void wireEncode(TlvEncoder encoder) {
- int saveLength = encoder.getLength();
- encoder.writeNonNegativeIntegerTlv(Tlv.ControlParameters_Cost, cost);
- encoder.writeNonNegativeIntegerTlv(Tlv.ControlParameters_FaceId, faceId);
- encoder.writeTypeAndLength(TLV_NEXT_HOP_RECORD, encoder.getLength() - saveLength);
- }
-
- /**
- * Decode the input from its TLV format.
- *
- * @param input The input buffer to decode. This reads from position() to
- * limit(), but does not change the position.
- * @throws EncodingException For invalid encoding.
- */
- public final void wireDecode(ByteBuffer input) throws EncodingException {
- TlvDecoder decoder = new TlvDecoder(input);
- wireDecode(decoder);
- }
-
- /**
- * Decode as part of an existing decode context.
- *
- * @param decoder
- * @throws EncodingException
- */
- public final void wireDecode(TlvDecoder decoder) throws EncodingException {
- int endOffset = decoder.readNestedTlvsStart(TLV_NEXT_HOP_RECORD);
- this.faceId = (int) decoder.readNonNegativeIntegerTlv(Tlv.ControlParameters_FaceId);
- this.cost = (int) decoder.readNonNegativeIntegerTlv(Tlv.ControlParameters_Cost);
- decoder.finishNestedTlvs(endOffset);
- }
-
- /**
- * Get face ID
- *
- * @return
- */
- public int getFaceId() {
- return faceId;
- }
-
- /**
- * Set face ID
- *
- * @param faceId
- */
- public void setFaceId(int faceId) {
- this.faceId = faceId;
- }
-
- /**
- * Get cost
- *
- * @return
- */
- public int getCost() {
- return cost;
- }
-
- /**
- * Set cost
- *
- * @param cost
- */
- public void setCost(int cost) {
- this.cost = cost;
- }
-
- private int faceId;
- private int cost;
-}
diff --git a/src/main/java/com/intel/jndn/management/types/RibEntry.java b/src/main/java/com/intel/jndn/management/types/RibEntry.java
deleted file mode 100644
index 5f89a85..0000000
--- a/src/main/java/com/intel/jndn/management/types/RibEntry.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management.types;
-
-import com.intel.jndn.management.EncodingHelper;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a entry in the RIB; see
- * http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#RIB-Dataset for
- * details
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class RibEntry implements Decodable {
-
- /**
- * TLV type, see
- * http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#TLV-TYPE-assignments
- */
- public final static int TLV_RIB_ENTRY = 128;
-
- /**
- * Encode using a new TLV encoder.
- *
- * @return The encoded buffer.
- */
- public final Blob wireEncode() {
- TlvEncoder encoder = new TlvEncoder();
- wireEncode(encoder);
- return new Blob(encoder.getOutput(), false);
- }
-
- /**
- * Encode as part of an existing encode context.
- *
- * @param encoder
- */
- public final void wireEncode(TlvEncoder encoder) {
- int saveLength = encoder.getLength();
- for (Route route : routes) {
- route.wireEncode(encoder);
- }
- EncodingHelper.encodeName(name, encoder);
- encoder.writeTypeAndLength(TLV_RIB_ENTRY, encoder.getLength() - saveLength);
- }
-
- /**
- * Decode the input from its TLV format.
- *
- * @param input The input buffer to decode. This reads from position() to
- * limit(), but does not change the position.
- * @throws EncodingException For invalid encoding.
- */
- public final void wireDecode(ByteBuffer input) throws EncodingException {
- TlvDecoder decoder = new TlvDecoder(input);
- wireDecode(decoder);
- }
-
- /**
- * Decode as part of an existing decode context.
- *
- * @param decoder
- * @throws EncodingException
- */
- @Override
- public final void wireDecode(TlvDecoder decoder) throws EncodingException {
- int endOffset = decoder.readNestedTlvsStart(TLV_RIB_ENTRY);
- name = EncodingHelper.decodeName(decoder);
- while (decoder.getOffset() < endOffset) {
- Route route = new Route();
- route.wireDecode(decoder);
- routes.add(route);
- }
- decoder.finishNestedTlvs(endOffset);
- }
-
- /**
- * Get name
- *
- * @return
- */
- public Name getName() {
- return name;
- }
-
- /**
- * Set name
- *
- * @param name
- */
- public void setName(Name name) {
- this.name = name;
- }
-
- /**
- * Get routes
- *
- * @return
- */
- public List<Route> getRoutes() {
- return routes;
- }
-
- /**
- * Set routes
- *
- * @param routes
- */
- public void setRoutes(List<Route> routes) {
- this.routes = routes;
- }
-
- private Name name = new Name();
- private List<Route> routes = new ArrayList<>();
-}
diff --git a/src/main/java/com/intel/jndn/management/types/Route.java b/src/main/java/com/intel/jndn/management/types/Route.java
deleted file mode 100644
index 6fac7e6..0000000
--- a/src/main/java/com/intel/jndn/management/types/Route.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management.types;
-
-import net.named_data.jndn.encoding.tlv.Tlv;
-import java.nio.ByteBuffer;
-import net.named_data.jndn.ForwardingFlags;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a Route object from /localhost/nfd/rib/list; see
- * http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#RIB-Dataset for
- * details.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class Route {
-
- /**
- * TLV type, see
- * http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#TLV-TYPE-assignments
- */
- public final static int TLV_ROUTE = 129;
-
- /**
- * Encode using a new TLV encoder.
- *
- * @return The encoded buffer.
- */
- public final Blob wireEncode() {
- TlvEncoder encoder = new TlvEncoder();
- wireEncode(encoder);
- return new Blob(encoder.getOutput(), false);
- }
-
- /**
- * Encode as part of an existing encode context.
- *
- * @param encoder
- */
- public final void wireEncode(TlvEncoder encoder) {
- int saveLength = encoder.getLength();
- encoder.writeOptionalNonNegativeIntegerTlv(Tlv.ControlParameters_ExpirationPeriod, faceId);
- encoder.writeNonNegativeIntegerTlv(Tlv.ControlParameters_Flags, flags.getForwardingEntryFlags());
- encoder.writeNonNegativeIntegerTlv(Tlv.ControlParameters_Cost, cost);
- encoder.writeNonNegativeIntegerTlv(Tlv.ControlParameters_Origin, origin);
- encoder.writeNonNegativeIntegerTlv(Tlv.ControlParameters_FaceId, faceId);
- encoder.writeTypeAndLength(TLV_ROUTE, encoder.getLength() - saveLength);
- }
-
- /**
- * Decode the input from its TLV format.
- *
- * @param input The input buffer to decode. This reads from position() to
- * limit(), but does not change the position.
- * @throws net.named_data.jndn.encoding.EncodingException
- */
- public final void wireDecode(ByteBuffer input) throws EncodingException {
- TlvDecoder decoder = new TlvDecoder(input);
- wireDecode(decoder);
- }
-
- /**
- * Decode as part of an existing decode context.
- *
- * @param decoder
- * @throws EncodingException
- */
- public final void wireDecode(TlvDecoder decoder) throws EncodingException {
- int endOffset = decoder.readNestedTlvsStart(TLV_ROUTE);
- this.faceId = (int) decoder.readNonNegativeIntegerTlv(Tlv.ControlParameters_FaceId);
- this.origin = (int) decoder.readNonNegativeIntegerTlv(Tlv.ControlParameters_Origin);
- this.cost = (int) decoder.readNonNegativeIntegerTlv(Tlv.ControlParameters_Cost);
- this.flags.setForwardingEntryFlags((int) decoder.readNonNegativeIntegerTlv(Tlv.ControlParameters_Flags));
- this.expirationPeriod = (int) decoder.readOptionalNonNegativeIntegerTlv(Tlv.ControlParameters_ExpirationPeriod, endOffset);
- decoder.finishNestedTlvs(endOffset);
- }
-
- /**
- * Get Face ID
- *
- * @return
- */
- public int getFaceId() {
- return faceId;
- }
-
- /**
- * Set Face ID
- *
- * @param faceId
- */
- public void setFaceId(int faceId) {
- this.faceId = faceId;
- }
-
- /**
- * Get origin
- *
- * @return
- */
- public int getOrigin() {
- return origin;
- }
-
- /**
- * Set origin
- *
- * @param origin
- */
- public void setOrigin(int origin) {
- this.origin = origin;
- }
-
- /**
- * Get cost
- *
- * @return
- */
- public int getCost() {
- return cost;
- }
-
- /**
- * Set cost
- *
- * @param cost
- */
- public void setCost(int cost) {
- this.cost = cost;
- }
-
- /**
- * Get flags
- *
- * @return
- */
- public ForwardingFlags getFlags() {
- return flags;
- }
-
- /**
- * Set flags
- *
- * @param flags
- */
- public void setFlags(ForwardingFlags flags) {
- this.flags = flags;
- }
-
- /**
- * Get expiration period
- *
- * @return
- */
- public double getExpirationPeriod() {
- return expirationPeriod;
- }
-
- /**
- * Set expiration period
- *
- * @param expirationPeriod
- */
- public void setExpirationPeriod(double expirationPeriod) {
- this.expirationPeriod = expirationPeriod;
- }
-
- private int faceId = -1;
- private int origin = -1;
- private int cost = -1;
- private ForwardingFlags flags = new ForwardingFlags();
- private double expirationPeriod = -1.0;
-}
diff --git a/src/main/java/com/intel/jndn/management/types/StatusDataset.java b/src/main/java/com/intel/jndn/management/types/StatusDataset.java
deleted file mode 100644
index d5ef90c..0000000
--- a/src/main/java/com/intel/jndn/management/types/StatusDataset.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management.types;
-
-import com.intel.jndn.management.ManagementException;
-import java.util.ArrayList;
-import java.util.List;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Helper class to handle StatusDatasets, see
- * http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class StatusDataset {
-
- /**
- * Decode multiple status entries as part of a StatusDataset, see
- * http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
- *
- * @param <T>
- * @param statusDataset
- * @param type
- * @return
- * @throws com.intel.jndn.management.ManagementException
- */
- public static final <T extends Decodable> List<T> wireDecode(Blob statusDataset, Class<T> type) throws ManagementException {
- List<T> entries = new ArrayList<>();
- int endOffset = statusDataset.size();
- TlvDecoder decoder = new TlvDecoder(statusDataset.buf());
- while (decoder.getOffset() < endOffset) {
- try {
- T entry = type.newInstance();
- entry.wireDecode(decoder);
- entries.add(entry);
- } catch (EncodingException | IllegalAccessException | InstantiationException e) {
- throw new ManagementException("Failed to read status dataset.", e);
- }
- }
- return entries;
- }
-}
diff --git a/src/test/java/com/intel/jndn/management/ControlResponseTest.java b/src/test/java/com/intel/jndn/management/ControlResponseTest.java
deleted file mode 100644
index 5f64625..0000000
--- a/src/test/java/com/intel/jndn/management/ControlResponseTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management;
-
-import com.intel.jndn.management.types.ControlResponse;
-import junit.framework.Assert;
-import net.named_data.jndn.ControlParameters;
-import net.named_data.jndn.util.Blob;
-import org.junit.Test;
-
-/**
- * Test encoding/decoding of ControlResponses.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class ControlResponseTest {
-
- /**
- * Test encoding/decoding
- *
- * @throws java.lang.Exception
- */
- @Test
- public void testEncodeDecode() throws Exception {
- ControlParameters parameters = new ControlParameters();
- parameters.setFaceId(3);
- ControlResponse response = new ControlResponse();
- response.setStatusCode(404);
- response.setStatusText("Not Found");
- response.getBody().add(parameters);
-
- // encode
- Blob encoded = response.wireEncode();
-
- // decode
- ControlResponse decoded = new ControlResponse();
- decoded.wireDecode(encoded.buf());
-
- // test
- Assert.assertEquals(response.getStatusCode(), decoded.getStatusCode());
- Assert.assertEquals(response.getStatusText(), decoded.getStatusText());
- Assert.assertEquals(response.getBody().size(), decoded.getBody().size());
- Assert.assertEquals(response.getBody().get(0).getFaceId(), decoded.getBody().get(0).getFaceId());
- }
-}
diff --git a/src/test/java/com/intel/jndn/management/FaceStatusTest.java b/src/test/java/com/intel/jndn/management/FaceStatusTest.java
deleted file mode 100644
index 5a587a6..0000000
--- a/src/test/java/com/intel/jndn/management/FaceStatusTest.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management;
-
-import com.intel.jndn.management.types.StatusDataset;
-import com.intel.jndn.management.types.FaceStatus;
-import com.intel.jndn.utils.SimpleClient;
-import java.io.IOException;
-import java.util.List;
-import java.util.logging.Logger;
-import junit.framework.Assert;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.util.Blob;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-/**
- * Test whether the decoding for the face management service is working
- * correctly
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class FaceStatusTest {
-
- private static final Logger logger = Logger.getLogger(FaceStatusTest.class.getName());
-
- /**
- * Test encoding/decoding
- *
- * @throws java.lang.Exception
- */
- @Test
- public void testEncodeDecode() throws Exception {
- FaceStatus status = new FaceStatus();
- status.setFaceId(42);
- status.setUri("...");
- status.setLocalUri("...");
-
- // encode
- Blob encoded = status.wireEncode();
-
- // decode
- FaceStatus decoded = new FaceStatus();
- decoded.wireDecode(encoded.buf());
-
- // test
- Assert.assertEquals(status.getFaceId(), decoded.getFaceId());
- Assert.assertEquals(status.getUri(), decoded.getUri());
- Assert.assertEquals(status.getLocalUri(), decoded.getLocalUri());
- Assert.assertEquals(status.getExpirationPeriod(), decoded.getExpirationPeriod());
- Assert.assertEquals(status.getFaceScope(), decoded.getFaceScope());
- Assert.assertEquals(status.getFacePersistency(), decoded.getFacePersistency());
- Assert.assertEquals(status.getLinkType(), decoded.getLinkType());
- Assert.assertEquals(status.getInBytes(), decoded.getInBytes());
- Assert.assertEquals(status.getOutBytes(), decoded.getOutBytes());
- }
-
- /**
- * Test of decode method, of class FaceStatus.
- *
- * @throws java.lang.Exception
- */
- @Test
- public void testDecodeFakeData() throws Exception {
- Data data = getFaceData(true);
- List<FaceStatus> results = StatusDataset.wireDecode(data.getContent(), FaceStatus.class);
- assertTrue(results.size() > 4);
- for (FaceStatus f : results) {
- // the first face (face 1) should always be the internal face
- if (f.getFaceId() == 1) {
- assertEquals("internal://", f.getUri());
- assertEquals("internal://", f.getLocalUri());
- }
- }
- }
-
- /**
- * Integration test to run on actual system
- *
- * @param args
- * @throws EncodingException
- */
- public static void main(String[] args) throws Exception {
- Data data = getFaceData(false);
- List<FaceStatus> results = StatusDataset.wireDecode(data.getContent(), FaceStatus.class);
- assertTrue(results.size() > 4);
- for (FaceStatus f : results) {
- // the first face (face 1) should always be the internal face
- if (f.getFaceId() == 1) {
- assertEquals("internal://", f.getUri());
- assertEquals("internal://", f.getLocalUri());
- }
- }
- }
-
- /**
- * Retrieve a TLV encoded representation of the face list data
- *
- * @param usePreComputedData to avoid errors when local NFD is not present
- * @return
- */
- private static Data getFaceData(boolean usePreComputedData) throws IOException {
- // use pre-computed data to avoid errors when local NFD is not present
- if (usePreComputedData) {
- Data data = new Data();
- data.setContent(new Blob(hexStringToByteArray(DATA)));
- return data;
- } // alternately, query the actual localhost for current data
- else {
- Face forwarder = new Face("localhost");
-
- // build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
- Interest interest = new Interest(new Name("/localhost/nfd/faces/list"));
- interest.setMustBeFresh(true);
- interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
- interest.setInterestLifetimeMilliseconds(2000.0);
-
- // send packet
- Data data = SimpleClient.getDefault().getSync(forwarder, interest);
- String hex = data.getContent().toHex();
- logger.info("Hex dump of face list: " + hex);
- return data;
- }
- }
-
- /**
- * Pre-computed face list from a vanilla NFD running on Ubuntu 14.04
- */
- private static final String DATA = "803a690101720b696e7465726e616c3a2f2f810b696e7465726e616c3a2f2f840101850100860100900100910201429202063993010094010095010080406901fe720f636f6e74656e7473746f72653a2f2f810f636f6e74656e7473746f72653a2f2f84010185010086010090010091010092010093010094010095010080306901ff72076e756c6c3a2f2f81076e756c6c3a2f2f8401018501008601009001009101009201009301009401009501008053690201007219756470343a2f2f3232342e302e32332e3137303a35363336338117756470343a2f2f31302e35342e31322e373a35363336338401008501008601009001009101009201009301009401009501008056690201017219756470343a2f2f3232342e302e32332e3137303a3536333633811a756470343a2f2f3139322e3136382e35302e35373a3536333633840100850100860100900100910100920100930100940100950100804869020102721b65746865723a2f2f5b30313a30303a35653a30303a31373a61615d810a6465763a2f2f65746830840100850100860100900100910100920100930100940100950100804969020103721b65746865723a2f2f5b30313a30303a35653a30303a31373a61615d810b6465763a2f2f776c616e30840100850100860100900100910100920100930100940100950100804669020104720766643a2f2f32328114756e69783a2f2f2f72756e2f6e66642e736f636b840101850101860100900206349101019201019302012e940400014079950400041903804e690201197216746370343a2f2f3132372e302e302e313a35363336358115746370343a2f2f3132372e302e302e313a36333633840101850101860100900101910100920100930100940132950100";
-
- /**
- * Convert hex string to bytes; special thanks to
- * http://stackoverflow.com/questions/140131
- *
- * @param s
- * @return
- */
- private static byte[] hexStringToByteArray(String s) {
- int len = s.length();
- byte[] data = new byte[len / 2];
- for (int i = 0; i < len; i += 2) {
- data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
- + Character.digit(s.charAt(i + 1), 16));
- }
- return data;
- }
-
-}
diff --git a/src/test/java/com/intel/jndn/management/FibEntryTest.java b/src/test/java/com/intel/jndn/management/FibEntryTest.java
deleted file mode 100644
index 1cd5897..0000000
--- a/src/test/java/com/intel/jndn/management/FibEntryTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management;
-
-import com.intel.jndn.management.types.StatusDataset;
-import com.intel.jndn.management.types.NextHopRecord;
-import com.intel.jndn.management.types.FibEntry;
-import com.intel.jndn.utils.SimpleClient;
-import java.util.List;
-import junit.framework.Assert;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.util.Blob;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
-/**
- * Test encode/decode of FibEntry and NextHopRecord
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class FibEntryTest {
-
- /**
- * Test encoding/decoding
- *
- * @throws java.lang.Exception
- */
- @Test
- public void testEncodeDecode() throws Exception {
- NextHopRecord nextHopRecord = new NextHopRecord();
- nextHopRecord.setFaceId(42);
- nextHopRecord.setCost(100);
- FibEntry entry = new FibEntry();
- entry.setName(new Name("/fib/entry/test"));
- entry.getRecords().add(nextHopRecord);
-
- // encode
- Blob encoded = entry.wireEncode();
-
- // decode
- FibEntry decoded = new FibEntry();
- decoded.wireDecode(encoded.buf());
-
- // test
- Assert.assertEquals(entry.getName().toUri(), decoded.getName().toUri());
- Assert.assertEquals(entry.getRecords().get(0).getFaceId(), decoded.getRecords().get(0).getFaceId());
- Assert.assertEquals(entry.getRecords().get(0).getCost(), decoded.getRecords().get(0).getCost());
- }
-
- /**
- * Integration test to run on actual system
- *
- * @param args
- * @throws EncodingException
- */
- public static void main(String[] args) throws Exception {
- Face forwarder = new Face("localhost");
-
- // build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
- Interest interest = new Interest(new Name("/localhost/nfd/fib/list"));
- interest.setMustBeFresh(true);
- interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
- interest.setInterestLifetimeMilliseconds(2000.0);
-
- // send packet
- Data data = SimpleClient.getDefault().getSync(forwarder, interest);
-
- // decode results
- List<FibEntry> results = StatusDataset.wireDecode(data.getContent(), FibEntry.class);
- assertTrue(results.size() > 0);
- assertEquals("/localhost/nfd", results.get(0).getName().toUri());
- }
-}
diff --git a/src/test/java/com/intel/jndn/management/IntegrationSuite.java b/src/test/java/com/intel/jndn/management/IntegrationSuite.java
deleted file mode 100644
index 5f32711..0000000
--- a/src/test/java/com/intel/jndn/management/IntegrationSuite.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management;
-
-import com.intel.jndn.management.types.RibEntry;
-import java.util.logging.Logger;
-import junit.framework.Assert;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.security.KeyChain;
-
-/**
- * Tests to run with a local NFD as part of integration testing; will not run in
- * the maven test phase, must be run manually.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class IntegrationSuite {
-
- private static final Logger logger = Logger.getLogger(IntegrationSuite.class.getName());
-
- /**
- * Test NFD methods
- *
- * @param args
- * @throws Exception
- */
- public static void main(String[] args) throws Exception {
- Face face = new Face("localhost");
- KeyChain keyChain = buildTestKeyChain();
- face.setCommandSigningInfo(keyChain, keyChain.getDefaultCertificateName());
-
- Assert.assertTrue(NFD.pingLocal(face));
-
- // grab datasets
- Assert.assertFalse(NFD.getFaceList(face).isEmpty());
- Assert.assertFalse(NFD.getFibList(face).isEmpty());
- Assert.assertFalse(NFD.getRouteList(face).isEmpty());
-
- // create a new route
- NFD.register(face, "udp4://127.0.0.1:56363", new Name("/my/test/route"), 999);
-
- // check that route is created
- boolean found = false;
- for(RibEntry route : NFD.getRouteList(face)){
- logger.info("Found route: " + route.getName().toUri());
- if(route.getName().equals(new Name("/my/test/route"))){
- found = true;
- }
- }
- Assert.assertTrue(found);
-
- // remove the route
- NFD.unregister(face, new Name("/my/test/route"), "udp4://127.0.0.1:56363");
- }
-
- /**
- * Setup the KeyChain with a default identity; TODO move this to
- * MemoryIdentityStorage once it can handle getting/setting defaults
- *
- * @return
- * @throws net.named_data.jndn.security.SecurityException
- */
- public static KeyChain buildTestKeyChain() throws net.named_data.jndn.security.SecurityException {
- KeyChain keyChain = new KeyChain();
- try {
- keyChain.getDefaultCertificateName();
- } catch (net.named_data.jndn.security.SecurityException e) {
- keyChain.createIdentity(new Name("/test/identity"));
- keyChain.getIdentityManager().setDefaultIdentity(new Name("/test/identity"));
- }
- return keyChain;
- }
-}
diff --git a/src/test/java/com/intel/jndn/management/LocalControlHeaderTest.java b/src/test/java/com/intel/jndn/management/LocalControlHeaderTest.java
deleted file mode 100644
index 7686616..0000000
--- a/src/test/java/com/intel/jndn/management/LocalControlHeaderTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management;
-
-import com.intel.jndn.management.types.LocalControlHeader;
-import com.intel.jndn.utils.SimpleClient;
-import java.util.logging.Logger;
-import junit.framework.Assert;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.security.KeyChain;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test functionality for LocalControlHeader
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class LocalControlHeaderTest {
-
- private static final Logger logger = Logger.getLogger(IntegrationSuite.class.getName());
-
- /**
- * Integration test to run on actual system
- *
- * @param args
- * @throws EncodingException
- */
- public static void main(String[] args) throws Exception {
- // setup forwarder face
- Face forwarder = new Face("localhost");
- KeyChain keyChain = IntegrationSuite.buildTestKeyChain();
- forwarder.setCommandSigningInfo(keyChain, keyChain.getDefaultCertificateName());
-
- // enable incoming face ID header
- NFD.enableLocalControlHeader(forwarder, LocalControlHeader.INCOMING_FACE_ID);
-
- // use and verify
- Data data = SimpleClient.getDefault().getSync(forwarder, new Name("/localhost/nfd"));
- long faceId = data.getIncomingFaceId();
- Assert.assertTrue(faceId != -1); // this verifies that the headers are working correctly
- logger.info("Face ID for this client on the forwarder: " + faceId);
- }
-}
diff --git a/src/test/java/com/intel/jndn/management/RibEntryTest.java b/src/test/java/com/intel/jndn/management/RibEntryTest.java
deleted file mode 100644
index 8a63abb..0000000
--- a/src/test/java/com/intel/jndn/management/RibEntryTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management;
-
-import com.intel.jndn.management.types.StatusDataset;
-import com.intel.jndn.management.types.RibEntry;
-import com.intel.jndn.management.types.Route;
-import com.intel.jndn.utils.SimpleClient;
-import java.util.List;
-import junit.framework.Assert;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.util.Blob;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
-/**
- * Test encoding/decoding for RibEntry.
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class RibEntryTest {
-
- /**
- * Test encoding/decoding
- *
- * @throws java.lang.Exception
- */
- @Test
- public void testEncodeDecode() throws Exception {
- Route route = new Route();
- route.setFaceId(42);
- route.setCost(100);
- route.setOrigin(0);
- RibEntry entry = new RibEntry();
- entry.setName(new Name("/rib/entry/test"));
- entry.getRoutes().add(route);
-
- // encode
- Blob encoded = entry.wireEncode();
-
- // decode
- RibEntry decoded = new RibEntry();
- decoded.wireDecode(encoded.buf());
-
- // test
- Assert.assertEquals(entry.getName().toUri(), decoded.getName().toUri());
- Assert.assertEquals(entry.getRoutes().get(0).getFaceId(), decoded.getRoutes().get(0).getFaceId());
- Assert.assertEquals(entry.getRoutes().get(0).getCost(), decoded.getRoutes().get(0).getCost());
- Assert.assertEquals(entry.getRoutes().get(0).getOrigin(), decoded.getRoutes().get(0).getOrigin());
- }
-
- /**
- * Integration test to run on actual system
- *
- * @param args
- * @throws EncodingException
- */
- public static void main(String[] args) throws Exception {
- Face forwarder = new Face("localhost");
-
- // build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
- Interest interest = new Interest(new Name("/localhost/nfd/rib/list"));
- interest.setMustBeFresh(true);
- interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
- interest.setInterestLifetimeMilliseconds(2000.0);
-
- // send packet
- Data data = SimpleClient.getDefault().getSync(forwarder, interest);
-
- // decode results
- List<RibEntry> results = StatusDataset.wireDecode(data.getContent(), RibEntry.class);
- assertTrue(results.size() > 0);
- assertEquals("/localhost/nfd/rib", results.get(0).getName().toUri());
- }
-}