face: move packet encoding to Impl class
Practical limit of packet size is now enforced on encoded
NDNLPv2 packets instead of network-layer packets.
If a packet exceeds size limit, the face throws a
Face::OversizedPacketError exception. Since packet encoding may
be asynchronous, this exception could be thrown by
Face::processEvents instead of Face::expressInterest and
Face::put.
refs #4228
Change-Id: Ib68cf80b3b8967fdd0ba040bd8ee595a0eff740e
diff --git a/src/lp/packet.hpp b/src/lp/packet.hpp
index b2e003e..eb30485 100644
--- a/src/lp/packet.hpp
+++ b/src/lp/packet.hpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
@@ -58,6 +58,16 @@
void
wireDecode(const Block& wire);
+ /**
+ * \retval true packet has no field
+ * \retval false packet has one or more fields
+ */
+ bool
+ empty() const
+ {
+ return m_wire.elements_size() == 0;
+ }
+
public: // field access
/**
* \return true if FIELD occurs one or more times