network-nack-lite.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_NETWORK_NACK_LITE_HPP
24 #define NDN_NETWORK_NACK_LITE_HPP
25 
26 #include "../c/network-nack-types.h"
27 
28 namespace ndn {
29 
30 class LpPacketLite;
31 
36 public:
41 
47  ndn_NetworkNackReason
48  getReason() const { return reason; }
49 
56  int
57  getOtherReasonCode() const { return otherReasonCode; }
58 
65  void
66  setReason(ndn_NetworkNackReason reason) { this->reason = reason; }
67 
75  void
76  setOtherReasonCode(int otherReasonCode)
77  {
78  this->otherReasonCode = otherReasonCode;
79  }
80 
87  static const NetworkNackLite*
88  getFirstHeader(const LpPacketLite& lpPacket);
89 
96  static NetworkNackLite&
97  downCast(ndn_NetworkNack& networkNack)
98  {
99  return *(NetworkNackLite*)&networkNack;
100  }
101 
102  static const NetworkNackLite&
103  downCast(const ndn_NetworkNack& networkNack)
104  {
105  return *(NetworkNackLite*)&networkNack;
106  }
107 };
108 
109 }
110 
111 #endif
NetworkNackLite()
Create a NetworkNackLite where all the values are unspecified.
Definition: network-nack-lite.cpp:28
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:36
ndn_NetworkNackReason getReason() const
Get the network Nack reason.
Definition: network-nack-lite.hpp:48
Definition: lp-packet-lite.hpp:83
NetworkNackLite represents a network Nack packet and includes a Nack reason.
Definition: network-nack-lite.hpp:35
An ndn_NetworkNack represents a network Nack packet and includes a Nack reason.
Definition: network-nack-types.h:48
void setReason(ndn_NetworkNackReason reason)
Set the network Nack reason.
Definition: network-nack-lite.hpp:66
static NetworkNackLite & downCast(ndn_NetworkNack &networkNack)
Downcast the reference to the ndn_NetworkNack struct to an NetworkNackLite.
Definition: network-nack-lite.hpp:97
static const NetworkNackLite * getFirstHeader(const LpPacketLite &lpPacket)
Get the first header field in lpPacket which is a NetworkNackLite.
Definition: network-nack-lite.cpp:34
void setOtherReasonCode(int otherReasonCode)
Set the packet's reason code to use when the reason enum is ndn_NetworkNackReason_OTHER_CODE.
Definition: network-nack-lite.hpp:76
int getOtherReasonCode() const
Get the reason code from the packet which is other than a recognized ndn_NetworkNackReason enum value...
Definition: network-nack-lite.hpp:57