blob: 27905690ad9b54c4ee7f11d7b1dbde0c4e2a6cbb [file] [log] [blame]
Junxiao Shid6dcd2c2014-02-16 14:49:54 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Named Data Networking Project
4 * See COPYING for copyright and distribution information.
5 */
6
7#ifndef NFD_FACE_NDNLP_PARSE_HPP
8#define NFD_FACE_NDNLP_PARSE_HPP
9
10#include "common.hpp"
11#include "ndnlp-tlv.hpp"
12
13namespace nfd {
14namespace ndnlp {
15
16struct ParseError : public std::runtime_error
17{
18 ParseError(const std::string& what)
19 : std::runtime_error(what)
20 {
21 }
22};
23
24/** \brief represents a NdnlpData packet
25 *
26 * NdnlpData ::= NDNLP-DATA-TYPE TLV-LENGTH
27 * NdnlpSequence
28 * NdnlpFragIndex?
29 * NdnlpFragCount?
30 * NdnlpPayload
31 */
32class NdnlpData
33{
34public:
35 /** \brief parse a NdnlpData packet
36 *
37 * \exception ParseError packet is malformated
38 */
39 void
40 wireDecode(const Block& wire);
41
42public:
43 uint64_t m_seq;
44 uint16_t m_fragIndex;
45 uint16_t m_fragCount;
46 Block m_payload;
47};
48
49} // namespace ndnlp
50} // namespace nfd
51
52#endif // NFD_FACE_NDNLP_PARSE_HPP