Andrew Brown | 2f1fdbf | 2015-01-21 10:52:29 -0800 | [diff] [blame] | 1 | /* |
| 2 | * File name: FaceStatus.java |
| 3 | * |
| 4 | * Purpose: Represent a FaceStatus object from /localhost/nfd/faces/list; |
| 5 | * see http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt for details |
| 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.Data; |
| 15 | import net.named_data.jndn.encoding.EncodingException; |
| 16 | |
| 17 | /** |
| 18 | * Represent a FaceStatus object from /localhost/nfd/faces/list; |
| 19 | * see http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt for details |
| 20 | * @author Andrew Brown <andrew.brown@intel.com> |
| 21 | */ |
| 22 | public class FaceStatus { |
| 23 | |
| 24 | public int faceId; |
| 25 | public String uri; // can't use URI because some are invalid syntax |
| 26 | public String localUri; // can't use URI because some are invalid syntax |
| 27 | public int expirationPeriod; |
| 28 | public FaceScope faceScope; |
| 29 | public FacePersistency facePersistency; |
| 30 | public LinkType linkType; |
| 31 | public int inInterests; |
| 32 | public int outInterests; |
| 33 | public int inDatas; |
| 34 | public int outDatas; |
| 35 | public int inBytes; |
| 36 | public int outBytes; |
| 37 | |
| 38 | /** |
| 39 | * Helper method for decoding a list of face statuses from |
| 40 | * /localhost/nfd/faces/list |
| 41 | * @param data |
| 42 | * @return |
| 43 | * @throws EncodingException |
| 44 | */ |
| 45 | public static List<FaceStatus> decode(Data data) throws EncodingException{ |
| 46 | FaceStatusDecoder decoder = new FaceStatusDecoder(); |
| 47 | return decoder.decodeFaces(data.getContent().buf()); |
| 48 | } |
| 49 | } |