Andrew Brown | 2f1fdbf | 2015-01-21 10:52:29 -0800 | [diff] [blame] | 1 | /* |
| 2 | * File name: ControlResponse.java |
| 3 | * |
| 4 | * Purpose: Represent a ControlResponse, a Data packet sent in response to a |
| 5 | * ControlCommand to the NFD, see http://redmine.named-data.net/projects/nfd/wiki/ControlCommand |
| 6 | * |
| 7 | * © Copyright Intel Corporation. All rights reserved. |
| 8 | * Intel Corporation, 2200 Mission College Boulevard, |
| 9 | * Santa Clara, CA 95052-8119, USA |
| 10 | */ |
| 11 | package com.intel.jndn.management; |
| 12 | |
| 13 | import java.util.List; |
| 14 | import net.named_data.jndn.ControlParameters; |
| 15 | import net.named_data.jndn.Data; |
| 16 | import net.named_data.jndn.encoding.EncodingException; |
| 17 | |
| 18 | /** |
| 19 | * |
| 20 | * @author Andrew Brown <andrew.brown@intel.com> |
| 21 | */ |
| 22 | public class ControlResponse { |
| 23 | public int StatusCode; |
| 24 | public String StatusText; |
| 25 | public List<ControlParameters> Body; |
| 26 | |
| 27 | /** |
| 28 | * Decode input as a ControlResponse in NDN-TLV and set the fields of the |
| 29 | * new object |
| 30 | * |
| 31 | * @param data |
| 32 | * @return |
| 33 | */ |
| 34 | public static ControlResponse decode(Data data) throws EncodingException{ |
| 35 | ControlResponseDecoder decoder = new ControlResponseDecoder(); |
| 36 | ControlResponse response = new ControlResponse(); |
| 37 | decoder.decodeControlResponse(response, data.getContent().buf()); |
| 38 | return response; |
| 39 | } |
| 40 | } |