• Main Page
  • Classes
  • Files
  • File List

/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/common/packet-stamp.h

00001 /* -*- c++ -*-
00002    packet-stamp.h
00003    $Id: packet-stamp.h,v 1.3 1999/03/13 03:52:58 haoboy Exp $
00004 
00005    Information carried by a packet to allow a receive to decide if it
00006    will recieve the packet or not.
00007 
00008 */
00009 
00010 #ifndef _cmu_packetstamp_h_
00011 #define _cmu_packetstamp_h_
00012 
00013 class MobileNode;
00014 /* to avoid a pretty wild circular dependence among header files
00015    (between packet.h and queue.h), I can't do the #include here:
00016    #include <cmu/node.h>
00017    Since PacketStamp is just a container class, it doesn't really matter .
00018    -dam 8/8/98
00019    */
00020 #include <antenna.h>
00021 
00022 class PacketStamp {
00023 public:
00024 
00025   PacketStamp() : ant(0), node(0), Pr(-1), lambda(-1) { }
00026 
00027   void init(const PacketStamp *s) {
00028           Antenna* ant;
00029           if (s->ant != NULL)
00030                   ant = s->ant->copy();
00031           else
00032                   ant = 0;
00033           
00034           //Antenna *ant = (s->ant) ? s->ant->copy(): 0;
00035           stamp(s->node, ant, s->Pr, s->lambda);
00036   }
00037 
00038   void stamp(MobileNode *n, Antenna *a, double xmitPr, double lam) {
00039     ant = a;
00040     node = n;
00041     Pr = xmitPr;
00042     lambda = lam;
00043   }
00044 
00045   inline Antenna * getAntenna() {return ant;}
00046   inline MobileNode * getNode() {return node;}
00047   inline double getTxPr() {return Pr;}
00048   inline double getLambda() {return lambda;}
00049 
00050   /* WILD HACK: The following two variables are a wild hack.
00051      They will go away in the next release...
00052      They're used by the mac-802_11 object to determine
00053      capture.  This will be moved into the net-if family of 
00054      objects in the future. */
00055   double RxPr;                  // power with which pkt is received
00056   double CPThresh;              // capture threshold for recving interface
00057 
00058 protected:
00059   Antenna       *ant;
00060   MobileNode    *node;
00061   double        Pr;             // power pkt sent with
00062   double        lambda;         // wavelength of signal
00063 };
00064 
00065 #endif /* !_cmu_packetstamp_h_ */

Generated on Tue Aug 10 2010 16:16:06 for ns-2.33 by  doxygen 1.7.1