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 
74  void
75  setOtherReasonCode(int otherReasonCode)
76  {
77  this->otherReasonCode = otherReasonCode;
78  }
79 
86  static const NetworkNackLite*
87  getFirstHeader(const LpPacketLite& lpPacket);
88 
95  static NetworkNackLite&
96  downCast(ndn_NetworkNack& networkNack)
97  {
98  return *(NetworkNackLite*)&networkNack;
99  }
100 
101  static const NetworkNackLite&
102  downCast(const ndn_NetworkNack& networkNack)
103  {
104  return *(NetworkNackLite*)&networkNack;
105  }
106 };
107 
108 }
109 
110 #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:35
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:96
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:75
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