Andrew Brown | e96c16d | 2015-02-21 15:44:42 -0800 | [diff] [blame] | 1 | # jndn-utils |
| 2 | |
| 3 | This project is a collection of tools to simplify synchronous and asynchronous data transfer over the NDN network. It relies on the [NDN Protocol](https://named-data.net) and its associated [client library](https://github.com/named-data/jndn). |
| 4 | |
| 5 | ## Install |
| 6 | With Maven, add the following to your POM: |
| 7 | ``` |
| 8 | <dependency> |
| 9 | <groupId>com.intel.jndn.utils</groupId> |
| 10 | <artifactId>jndn-utils</artifactId> |
| 11 | <version>RELEASE</version> <!-- or a specific version --> |
| 12 | </dependency> |
| 13 | ``` |
| 14 | |
| 15 | ## Use |
andrewsbrown | 20ccfdd | 2015-04-07 09:34:31 -0700 | [diff] [blame] | 16 | Use `SimpleClient` or `SegmentedClient` to retrieve data from the network. For example: |
Andrew Brown | e96c16d | 2015-02-21 15:44:42 -0800 | [diff] [blame] | 17 | ``` |
andrewsbrown | 7fff867 | 2015-04-07 09:24:17 -0700 | [diff] [blame] | 18 | // retrieve a single Data packet synchronously, will block until complete |
| 19 | Data singleData = Client.getDefault().getSync(face, name); |
| 20 | |
| 21 | // retrieve a segmented Data packet (i.e. with a last Component containing a segment number and a valid FinalBlockId) by name |
| 22 | Data segmentedData = SegmentedClient.getDefault().getSync(face, name); |
andrewsbrown | 20ccfdd | 2015-04-07 09:34:31 -0700 | [diff] [blame] | 23 | ``` |
andrewsbrown | 7fff867 | 2015-04-07 09:24:17 -0700 | [diff] [blame] | 24 | |
andrewsbrown | 20ccfdd | 2015-04-07 09:34:31 -0700 | [diff] [blame] | 25 | Use `SimpleServer` or `SegmentedServer` to serve data on the network. For example: |
| 26 | ``` |
andrewsbrown | 7fff867 | 2015-04-07 09:24:17 -0700 | [diff] [blame] | 27 | // segment and serve Data packet under a specific prefix |
| 28 | RepositoryServer server = new SegmentedServer(face, prefix); |
| 29 | server.serve(largeDataPacket); // call face.processEvents() in an event loop |
| 30 | |
andrewsbrown | 20ccfdd | 2015-04-07 09:34:31 -0700 | [diff] [blame] | 31 | // add signatures; this pipeline stage will sign each Data packet prior to being encoded for transport |
andrewsbrown | 7fff867 | 2015-04-07 09:24:17 -0700 | [diff] [blame] | 32 | server.addPipelineStage(new SigningStage(keyChain, signingCertificateName)); |
Andrew Brown | e96c16d | 2015-02-21 15:44:42 -0800 | [diff] [blame] | 33 | ``` |
| 34 | |
andrewsbrown | 7fff867 | 2015-04-07 09:24:17 -0700 | [diff] [blame] | 35 | For full API, see the [Javadoc](http://01org.github.io/jndn-utils/). |
| 36 | |
Andrew Brown | e96c16d | 2015-02-21 15:44:42 -0800 | [diff] [blame] | 37 | ## License |
andrewsbrown | 4feb2da | 2015-03-03 16:05:29 -0800 | [diff] [blame] | 38 | Copyright © 2015, Intel Corporation. |
| 39 | |
| 40 | 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. |
| 41 | |
| 42 | 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-utils/blob/master/LICENSE) for more details. |