Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

hdr_sr Class Reference

#include <hdr_sr.h>

Collaboration diagram for hdr_sr:

Collaboration graph
[legend]
List of all members.

Public Member Functions

int & offset ()
int & valid ()
int & salvaged ()
int & num_addrs ()
int & cur_addr ()
int valid () const
int salvaged () const
int num_addrs () const
int cur_addr () const
sr_addraddrs ()
int & route_request ()
int & rtreq_seq ()
int & max_propagation ()
int & route_reply ()
int & route_reply_len ()
sr_addrreply_addrs ()
int & route_error ()
int & num_route_errors ()
link_downdown_links ()
int & flow_header ()
u_int16_tflow_id ()
int & hopCount ()
int & flow_timeout ()
unsigned long & flow_timeout_time ()
int & flow_unknown ()
int & num_flow_unknown ()
flow_errorunknown_flows ()
int & flow_default_unknown ()
int & num_default_unknown ()
flow_errorunknown_defaults ()
int size ()
nsaddr_tget_next_addr ()
int & get_next_type ()
void append_addr (nsaddr_t a, int type)
void init ()
void dump (char *)
char * dump ()

Static Public Member Functions

hdr_sraccess (const Packet *p)

Static Public Attributes

int offset_

Private Attributes

int valid_
int salvaged_
int num_addrs_
int cur_addr_
sr_addr addrs_ [MAX_SR_LEN]
route_request sr_request_
route_reply sr_reply_
route_error sr_error_
flow_header sr_flow_
flow_timeout sr_ftime_
flow_unknown sr_funk_
flow_default_err sr_fdef_unk

Member Function Documentation

hdr_sr* hdr_sr::access const Packet p  )  [inline, static]
 

Definition at line 143 of file hdr_sr.h.

References Packet::access(), and offset_.

Referenced by DSRAgent::acceptRouteReply(), CMUTrace::format_dsr(), DSRAgent::getRouteForPacket(), DSRAgent::handleFlowForwarding(), DSRAgent::handleForwarding(), DSRAgent::handlePacketReceipt(), SRForwarder::handlePktWithoutSR(), DSRAgent::handlePktWithoutSR(), DSRAgent::handleRouteRequest(), DSRAgent::ignoreRouteRequestp(), DSRAgent::processBrokenRouteError(), DSRAgent::processFlowARS(), DSRAgent::processUnknownFlowError(), DSRAgent::recv(), AddSR::recv(), DSRAgent::replyFromRouteCache(), DSRAgent::returnSrcRouteToRequestor(), DSRAgent::sendOutPacketWithRoute(), DSRAgent::sendOutRtReq(), DSRAgent::sendRouteShortening(), DSRAgent::sendUnknownFlow(), DSRAgent::tap(), DSRAgent::undeliverablePkt(), DSRAgent::xmitFailed(), and DSRAgent::xmitFlowFailed().

00143                                                       {
00144                 return (hdr_sr*)p->access(offset_);
00145         }

Here is the call graph for this function:

struct sr_addr* hdr_sr::addrs  )  [inline]
 

Definition at line 155 of file hdr_sr.h.

Referenced by dump(), Path::fillSR(), Path::Path(), DSRAgent::tap(), DSRAgent::testinit(), DSRProto::testinit(), DSRAgent::undeliverablePkt(), DSRAgent::xmitFailed(), and DSRAgent::xmitFlowFailed().

00155 { return addrs_; }

void hdr_sr::append_addr nsaddr_t  a,
int  type
[inline]
 

Definition at line 235 of file hdr_sr.h.

References MAX_SR_LEN, and num_addrs_.

Referenced by AddSR::recv(), DSRAgent::testinit(), and DSRProto::testinit().

00235                                                       {
00236                 assert(num_addrs_ < MAX_SR_LEN-1);
00237                 addrs_[num_addrs_].addr_type = type;
00238                 addrs_[num_addrs_++].addr = a;
00239         }

int hdr_sr::cur_addr  )  const [inline]
 

Definition at line 154 of file hdr_sr.h.

References cur_addr_.

00154 { return cur_addr_; }

int& hdr_sr::cur_addr  )  [inline]
 

Definition at line 149 of file hdr_sr.h.

References cur_addr_.

Referenced by Path::fillSR(), DSRAgent::handleFlowForwarding(), Path::Path(), SRForwarder::recv(), AddSR::recv(), DSRAgent::sendOutPacketWithRoute(), DSRAgent::tap(), DSRAgent::undeliverablePkt(), DSRAgent::xmitFailed(), and DSRAgent::xmitFlowFailed().

00149 { return cur_addr_; }

struct link_down* hdr_sr::down_links  )  [inline]
 

Definition at line 167 of file hdr_sr.h.

References route_error::err_links_.

Referenced by CMUTrace::format_dsr(), DSRAgent::processBrokenRouteError(), DSRAgent::replyFromRouteCache(), DSRAgent::sendOutRtReq(), and DSRAgent::xmitFailed().

00167 {return sr_error_.err_links_; }

char * hdr_sr::dump  ) 
 

Definition at line 60 of file hdr_sr.cc.

00061 {
00062   static char buf[100];
00063   dump(buf);
00064   return (buf);
00065 }

void hdr_sr::dump char *   ) 
 

Definition at line 68 of file hdr_sr.cc.

References addrs(), cur_addr_, and num_addrs_.

Referenced by SRForwarder::handlePktWithoutSR(), SRForwarder::recv(), AddSR::recv(), DSRAgent::sendOutPacketWithRoute(), and DSRAgent::xmitFailed().

00069 {
00070   char *ptr = buf;
00071   *ptr++ = '[';
00072   for (int i = 0; i < num_addrs_; i++)
00073     {
00074       ptr += sprintf(ptr, "%s%d ",
00075                      (i == cur_addr_) ? "|" : "",
00076                      addrs()[i].addr);
00077     }
00078   *ptr++ = ']';
00079   *ptr = '\0';
00080 }

Here is the call graph for this function:

int& hdr_sr::flow_default_unknown  )  [inline]
 

Definition at line 181 of file hdr_sr.h.

References flow_default_err::flow_default_valid_.

Referenced by DSRAgent::handlePacketReceipt(), init(), DSRAgent::processUnknownFlowError(), DSRAgent::sendUnknownFlow(), and size().

00181 { return sr_fdef_unk.flow_default_valid_; }

int& hdr_sr::flow_header  )  [inline]
 

Definition at line 170 of file hdr_sr.h.

References flow_header::flow_valid_.

Referenced by DSRAgent::handleFlowForwarding(), DSRAgent::handleForwarding(), init(), DSRAgent::processBrokenRouteError(), DSRAgent::processFlowARS(), DSRAgent::processUnknownFlowError(), DSRAgent::sendOutPacketWithRoute(), DSRAgent::sendUnknownFlow(), size(), DSRAgent::undeliverablePkt(), DSRAgent::xmitFailed(), and DSRAgent::xmitFlowFailed().

00170 { return sr_flow_.flow_valid_; }

u_int16_t& hdr_sr::flow_id  )  [inline]
 

Definition at line 171 of file hdr_sr.h.

References flow_header::flow_id_, and u_int16_t.

Referenced by DSRAgent::handleFlowForwarding(), DSRAgent::processFlowARS(), DSRAgent::sendOutPacketWithRoute(), and DSRAgent::xmitFlowFailed().

00171 { return sr_flow_.flow_id_; }

int& hdr_sr::flow_timeout  )  [inline]
 

Definition at line 174 of file hdr_sr.h.

References flow_timeout::flow_timeout_valid_.

Referenced by DSRAgent::handleFlowForwarding(), init(), DSRAgent::processBrokenRouteError(), DSRAgent::processUnknownFlowError(), DSRAgent::sendOutPacketWithRoute(), DSRAgent::sendUnknownFlow(), size(), DSRAgent::undeliverablePkt(), and DSRAgent::xmitFailed().

00174 { return sr_ftime_.flow_timeout_valid_; }

unsigned long& hdr_sr::flow_timeout_time  )  [inline]
 

Definition at line 175 of file hdr_sr.h.

References flow_timeout::timeout_.

Referenced by DSRAgent::handleFlowForwarding(), and DSRAgent::sendOutPacketWithRoute().

00175 { return sr_ftime_.timeout_; }

int& hdr_sr::flow_unknown  )  [inline]
 

Definition at line 177 of file hdr_sr.h.

References flow_unknown::flow_unknown_valid_.

Referenced by DSRAgent::handlePacketReceipt(), init(), DSRAgent::processUnknownFlowError(), DSRAgent::sendUnknownFlow(), and size().

00177 { return sr_funk_.flow_unknown_valid_; }

nsaddr_t& hdr_sr::get_next_addr  )  [inline]
 

Definition at line 225 of file hdr_sr.h.

References cur_addr_, nsaddr_t, and num_addrs_.

Referenced by DSRAgent::handleFlowForwarding(), SRForwarder::recv(), and DSRAgent::sendOutPacketWithRoute().

00225                                          { 
00226                 assert(cur_addr_ < num_addrs_);
00227                 return (addrs_[cur_addr_ + 1].addr);
00228         }

int& hdr_sr::get_next_type  )  [inline]
 

Definition at line 230 of file hdr_sr.h.

References cur_addr_, and num_addrs_.

Referenced by DSRAgent::handleFlowForwarding(), and DSRAgent::sendOutPacketWithRoute().

00230                                     {
00231                 assert(cur_addr_ < num_addrs_);
00232                 return (addrs_[cur_addr_ + 1].addr_type);
00233         }

int& hdr_sr::hopCount  )  [inline]
 

Definition at line 172 of file hdr_sr.h.

References flow_header::hopCount_.

Referenced by DSRAgent::handleFlowForwarding(), DSRAgent::processFlowARS(), and DSRAgent::sendOutPacketWithRoute().

00172 { return sr_flow_.hopCount_; }

void hdr_sr::init  )  [inline]
 

Definition at line 241 of file hdr_sr.h.

References cur_addr_, flow_default_unknown(), flow_header(), flow_timeout(), flow_unknown(), num_addrs_, num_route_errors(), route_error(), route_reply(), route_reply_len(), route_request(), salvaged_, and valid_.

Referenced by DSRAgent::getRouteForPacket(), SRForwarder::handlePktWithoutSR(), DSRAgent::recv(), DSRAgent::replyFromRouteCache(), DSRAgent::returnSrcRouteToRequestor(), DSRAgent::sendRouteShortening(), DSRAgent::testinit(), and DSRProto::testinit().

00241                            {
00242                 valid_ = 1;
00243                 salvaged_ = 0;
00244                 num_addrs_ = 0;
00245                 cur_addr_ = 0;
00246 
00247                 route_request() = 0;
00248                 route_reply() = 0;
00249                 route_reply_len() = 0;
00250                 route_error() = 0;
00251                 num_route_errors() = 0;
00252 
00253                 flow_timeout() = 0;
00254                 flow_unknown() = 0;
00255                 flow_default_unknown() = 0;
00256                 flow_header() = 0;
00257         }

Here is the call graph for this function:

int& hdr_sr::max_propagation  )  [inline]
 

Definition at line 159 of file hdr_sr.h.

References route_request::req_ttl_.

Referenced by DSRAgent::handleRouteRequest(), and DSRAgent::sendOutRtReq().

00159 {return sr_request_.req_ttl_; }

int hdr_sr::num_addrs  )  const [inline]
 

Definition at line 153 of file hdr_sr.h.

References num_addrs_.

00153 { return num_addrs_; }

int& hdr_sr::num_addrs  )  [inline]
 

Definition at line 148 of file hdr_sr.h.

References num_addrs_.

Referenced by Path::fillSR(), CMUTrace::format_dsr(), DSRAgent::handleFlowForwarding(), DSRAgent::handleForwarding(), Path::Path(), DSRAgent::processFlowARS(), AddSR::recv(), DSRAgent::sendOutPacketWithRoute(), DSRAgent::sendUnknownFlow(), DSRAgent::tap(), DSRAgent::testinit(), DSRProto::testinit(), DSRAgent::xmitFailed(), and DSRAgent::xmitFlowFailed().

00148 { return num_addrs_; }

int& hdr_sr::num_default_unknown  )  [inline]
 

Definition at line 182 of file hdr_sr.h.

References flow_default_err::err_count_.

Referenced by DSRAgent::processUnknownFlowError(), DSRAgent::sendUnknownFlow(), and size().

00182 { return sr_fdef_unk.err_count_; }

int& hdr_sr::num_flow_unknown  )  [inline]
 

Definition at line 178 of file hdr_sr.h.

References flow_unknown::err_count_.

Referenced by DSRAgent::processUnknownFlowError(), DSRAgent::sendUnknownFlow(), and size().

00178 { return sr_funk_.err_count_; }

int& hdr_sr::num_route_errors  )  [inline]
 

Definition at line 166 of file hdr_sr.h.

References route_error::err_count_.

Referenced by CMUTrace::format_dsr(), init(), DSRAgent::processBrokenRouteError(), DSRAgent::replyFromRouteCache(), DSRAgent::sendOutRtReq(), size(), and DSRAgent::xmitFailed().

00166 {return sr_error_.err_count_; }

int& hdr_sr::offset  )  [inline]
 

Definition at line 142 of file hdr_sr.h.

References offset_.

00142 { return offset_; }

struct sr_addr* hdr_sr::reply_addrs  )  [inline]
 

Definition at line 163 of file hdr_sr.h.

References route_reply::rep_addrs_.

Referenced by DSRAgent::acceptRouteReply(), CMUTrace::format_dsr(), DSRAgent::replyFromRouteCache(), DSRAgent::returnSrcRouteToRequestor(), DSRAgent::sendRouteShortening(), DSRAgent::tap(), and DSRAgent::undeliverablePkt().

00163 {return sr_reply_.rep_addrs_; }

int& hdr_sr::route_error  )  [inline]
 

Definition at line 165 of file hdr_sr.h.

References route_error::err_valid_.

Referenced by CMUTrace::format_dsr(), DSRAgent::handlePacketReceipt(), init(), DSRAgent::processBrokenRouteError(), DSRAgent::recv(), DSRAgent::replyFromRouteCache(), DSRAgent::sendOutPacketWithRoute(), DSRAgent::sendOutRtReq(), size(), DSRAgent::tap(), DSRAgent::undeliverablePkt(), and DSRAgent::xmitFailed().

00165 {return sr_error_.err_valid_; }

int& hdr_sr::route_reply  )  [inline]
 

Definition at line 161 of file hdr_sr.h.

References route_reply::rep_valid_.

Referenced by DSRAgent::acceptRouteReply(), CMUTrace::format_dsr(), DSRAgent::handlePacketReceipt(), init(), DSRAgent::replyFromRouteCache(), DSRAgent::returnSrcRouteToRequestor(), DSRAgent::sendOutPacketWithRoute(), DSRAgent::sendRouteShortening(), DSRAgent::sendUnknownFlow(), size(), DSRAgent::tap(), DSRAgent::undeliverablePkt(), and DSRAgent::xmitFailed().

00161 {return sr_reply_.rep_valid_; }

int& hdr_sr::route_reply_len  )  [inline]
 

Definition at line 162 of file hdr_sr.h.

References route_reply::rep_rtlen_.

Referenced by DSRAgent::acceptRouteReply(), CMUTrace::format_dsr(), init(), DSRAgent::replyFromRouteCache(), DSRAgent::returnSrcRouteToRequestor(), DSRAgent::sendRouteShortening(), size(), DSRAgent::tap(), and DSRAgent::undeliverablePkt().

00162 {return sr_reply_.rep_rtlen_; }

int& hdr_sr::route_request  )  [inline]
 

Definition at line 157 of file hdr_sr.h.

References route_request::req_valid_.

Referenced by CMUTrace::format_dsr(), DSRAgent::handlePacketReceipt(), DSRAgent::handleRouteRequest(), init(), SRForwarder::recv(), DSRAgent::recv(), AddSR::recv(), DSRAgent::replyFromRouteCache(), DSRAgent::sendOutPacketWithRoute(), DSRAgent::sendOutRtReq(), DSRAgent::sendUnknownFlow(), size(), DSRAgent::tap(), DSRAgent::undeliverablePkt(), and DSRAgent::xmitFailed().

00157 {return sr_request_.req_valid_; }

int& hdr_sr::rtreq_seq  )  [inline]
 

Definition at line 158 of file hdr_sr.h.

References route_request::req_id_.

Referenced by DSRAgent::acceptRouteReply(), CMUTrace::format_dsr(), DSRAgent::handlePacketReceipt(), DSRAgent::handleRouteRequest(), DSRAgent::ignoreRouteRequestp(), DSRAgent::replyFromRouteCache(), DSRAgent::returnSrcRouteToRequestor(), DSRAgent::sendOutRtReq(), and DSRAgent::sendRouteShortening().

00158 {return sr_request_.req_id_; }

int hdr_sr::salvaged  )  const [inline]
 

Definition at line 152 of file hdr_sr.h.

References salvaged_.

00152 { return salvaged_; }

int& hdr_sr::salvaged  )  [inline]
 

Definition at line 147 of file hdr_sr.h.

References salvaged_.

Referenced by DSRAgent::handleFlowForwarding(), and DSRAgent::undeliverablePkt().

00147 { return salvaged_; }

int hdr_sr::size  )  [inline]
 

Definition at line 185 of file hdr_sr.h.

References flow_default_unknown(), flow_header(), flow_timeout(), flow_unknown(), num_addrs_, num_default_unknown(), num_flow_unknown(), num_route_errors(), route_error(), route_reply(), route_reply_len(), route_request(), and SR_HDR_SZ.

Referenced by DSRAgent::handleForwarding(), DSRAgent::handlePacketReceipt(), DSRAgent::returnSrcRouteToRequestor(), DSRAgent::sendOutPacketWithRoute(), DSRAgent::undeliverablePkt(), and DSRAgent::xmitFlowFailed().

00185                           {
00186                 int sz = 0;
00187                 if (num_addrs_ || route_request() || 
00188                     route_reply() || route_error() ||
00189                     flow_timeout() || flow_unknown() || flow_default_unknown())
00190                         sz += SR_HDR_SZ;
00191 
00192                 if (num_addrs_)                 sz += 4 * (num_addrs_ - 1);
00193                 if (route_reply())              sz += 5 + 4 * route_reply_len();
00194                 if (route_request())            sz += 8;
00195                 if (route_error())              sz += 16 * num_route_errors();
00196                 if (flow_timeout())             sz += 4;
00197                 if (flow_unknown())             sz += 14 * num_flow_unknown();
00198                 if (flow_default_unknown())     sz += 12 * num_default_unknown();
00199 
00200                 if (flow_header())              sz += 4;
00201 
00202                 sz = ((sz+3)&(~3)); // align...
00203                 assert(sz >= 0);
00204 #if 0
00205                 printf("Size: %d (%d %d %d %d %d %d %d %d %d)\n", sz,
00206                         (num_addrs_ || route_request() ||
00207                         route_reply() || route_error() ||
00208                         flow_timeout() || flow_unknown() || 
00209                         flow_default_unknown()) ? SR_HDR_SZ : 0,
00210                         num_addrs_ ? 4 * (num_addrs_ - 1) : 0,
00211                         route_reply() ? 5 + 4 * route_reply_len() : 0,
00212                         route_request() ? 8 : 0,
00213                         route_error() ? 16 * num_route_errors() : 0,
00214                         flow_timeout() ? 4 : 0,
00215                         flow_unknown() ? 14 * num_flow_unknown() : 0,
00216                         flow_default_unknown() ? 12 * num_default_unknown() : 0,
00217                         flow_header() ? 4 : 0);
00218 #endif
00219 
00220                 return sz;
00221         }

Here is the call graph for this function:

struct flow_error* hdr_sr::unknown_defaults  )  [inline]
 

Definition at line 183 of file hdr_sr.h.

References flow_default_err::err_flows_.

Referenced by DSRAgent::processUnknownFlowError(), and DSRAgent::sendUnknownFlow().

00183 { return sr_fdef_unk.err_flows_; }

struct flow_error* hdr_sr::unknown_flows  )  [inline]
 

Definition at line 179 of file hdr_sr.h.

References flow_unknown::err_flows_.

Referenced by DSRAgent::processUnknownFlowError(), and DSRAgent::sendUnknownFlow().

00179 { return sr_funk_.err_flows_; }

int hdr_sr::valid  )  const [inline]
 

Definition at line 151 of file hdr_sr.h.

References valid_.

00151 { return valid_; }

int& hdr_sr::valid  )  [inline]
 

Definition at line 146 of file hdr_sr.h.

References valid_.

Referenced by DSRAgent::handlePacketReceipt(), DSRAgent::handlePktWithoutSR(), Path::Path(), SRForwarder::recv(), DSRAgent::recv(), AddSR::recv(), DSRAgent::sendOutPacketWithRoute(), DSRAgent::sendOutRtReq(), and DSRAgent::tap().

00146 { return valid_; }


Member Data Documentation

struct sr_addr hdr_sr::addrs_[MAX_SR_LEN] [private]
 

Definition at line 129 of file hdr_sr.h.

int hdr_sr::cur_addr_ [private]
 

Definition at line 128 of file hdr_sr.h.

Referenced by cur_addr(), dump(), get_next_addr(), get_next_type(), and init().

int hdr_sr::num_addrs_ [private]
 

Definition at line 127 of file hdr_sr.h.

Referenced by append_addr(), dump(), get_next_addr(), get_next_type(), init(), num_addrs(), and size().

int hdr_sr::offset_ [static]
 

Definition at line 35 of file hdr_sr.cc.

Referenced by access(), offset(), and SRHeaderClass::SRHeaderClass().

int hdr_sr::salvaged_ [private]
 

Definition at line 125 of file hdr_sr.h.

Referenced by init(), and salvaged().

struct route_error hdr_sr::sr_error_ [private]
 

Definition at line 133 of file hdr_sr.h.

struct flow_default_err hdr_sr::sr_fdef_unk [private]
 

Definition at line 138 of file hdr_sr.h.

struct flow_header hdr_sr::sr_flow_ [private]
 

Definition at line 135 of file hdr_sr.h.

struct flow_timeout hdr_sr::sr_ftime_ [private]
 

Definition at line 136 of file hdr_sr.h.

struct flow_unknown hdr_sr::sr_funk_ [private]
 

Definition at line 137 of file hdr_sr.h.

struct route_reply hdr_sr::sr_reply_ [private]
 

Definition at line 132 of file hdr_sr.h.

struct route_request hdr_sr::sr_request_ [private]
 

Definition at line 131 of file hdr_sr.h.

int hdr_sr::valid_ [private]
 

Definition at line 123 of file hdr_sr.h.

Referenced by init(), and valid().


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 12:50:45 2004 for NS2.26SourcesOriginal by doxygen 1.3.3