• Main Page
  • Classes
  • Files
  • File List

/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/mcast/lms.h

00001 
00002 /*
00003  * lms.h
00004  * Copyright (C) 2001 by the University of Southern California
00005  * $Id: lms.h,v 1.3 2005/08/25 18:58:07 johnh Exp $
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License,
00009  * version 2, as published by the Free Software Foundation.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License along
00017  * with this program; if not, write to the Free Software Foundation, Inc.,
00018  * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00019  *
00020  *
00021  * The copyright of this module includes the following
00022  * linking-with-specific-other-licenses addition:
00023  *
00024  * In addition, as a special exception, the copyright holders of
00025  * this module give you permission to combine (via static or
00026  * dynamic linking) this module with free software programs or
00027  * libraries that are released under the GNU LGPL and with code
00028  * included in the standard release of ns-2 under the Apache 2.0
00029  * license or under otherwise-compatible licenses with advertising
00030  * requirements (or modified versions of such code, with unchanged
00031  * license).  You may copy and distribute such a system following the
00032  * terms of the GNU GPL for this module and the licenses of the
00033  * other code concerned, provided that you include the source code of
00034  * that other code when and as the GNU GPL requires distribution of
00035  * source code.
00036  *
00037  * Note that people who make modified versions of this module
00038  * are not obligated to grant this special exception for their
00039  * modified versions; it is their choice whether to do so.  The GNU
00040  * General Public License gives permission to release a modified
00041  * version without this exception; this exception also makes it
00042  * possible to release a modified version which carries forward this
00043  * exception.
00044  *
00045  */
00046 
00047 /*
00048  * Light-Weight Multicast Services (LMS), Reliable Multicast
00049  *
00050  * lms.h
00051  *
00052  * This holds the packet header structures, and packet type constants for
00053  * the LMS implementation.
00054  *
00055  * Christos Papadopoulos. 
00056  * christos@isi.edu
00057  */
00058 
00059 #ifndef lms_h
00060 #define lms_h
00061 
00062 class LmsAgent;
00063 
00064 #include "node.h"
00065 #include "packet.h"
00066 
00067 
00068 #define LMS_NOADDR      -1
00069 #define LMS_NOPORT      -1
00070 #define LMS_NOIFACE     -99
00071 #define LMS_INFINITY    1000000
00072 
00073 /*
00074  * PT_LMS packet types
00075  */
00076 #define LMS_SRC_REFRESH 1
00077 #define LMS_REFRESH     2
00078 #define LMS_LEAVE       3
00079 #define LMS_REQ         4
00080 #define LMS_DMCAST      5
00081 #define LMS_SETUP       6
00082 #define LMS_SPM         7
00083 #define LMS_LINKS       8
00084 
00085 /*
00086  * LMS header
00087  */
00088 struct hdr_lms {
00089     int         type_;          // packet type
00090     int         ttl_;           // time-to-live
00091     int         cost_;          // cost advertisements for LMS_REFRESH
00092     nsaddr_t    from_;          // real source of packet for DMCASTs
00093     nsaddr_t    src_;           // original source of mcast packet
00094     nsaddr_t    group_;         // mcast group
00095     nsaddr_t    tp_addr_;       // turning point address
00096     int         tp_port_;       // turning point port id 
00097     int         tp_iface_;      // turning point interface
00098     int         lo_, hi_;       // range of lost packets
00099     double      ts_;            // timestamp for RTT estimation
00100     
00101     static int offset_;
00102     inline static int& offset() { return offset_; }
00103     inline static hdr_lms* access(Packet* p) {
00104         return (hdr_lms*)p->access(offset_);
00105     }
00106 
00107     /* per-field member functions */    
00108     int&        type ()  { return type_;  }
00109     nsaddr_t&   from ()  { return from_;  }
00110     nsaddr_t&   src ()   { return src_;   }
00111     nsaddr_t&   tp_addr ()  { return tp_addr_;  }
00112     nsaddr_t&  tp_port ()  { return (nsaddr_t&) tp_port_;  }
00113     nsaddr_t&   group () { return group_; }
00114 };
00115 
00116 struct lms_ctl {
00117     int         hop_cnt_;       // hop counter (similar to ttl)
00118     int         cost_;          // cost advertisements for LMS_REFRESH
00119     nsaddr_t    tp_addr_;       // turning point address
00120     nsaddr_t    tp_port_;       // turning point port id
00121     ns_addr_t   downstream_lms_;// needed when in incrDeployment       
00122     int         tp_iface_;      // turning point interface
00123     int         nak_lo_;
00124     int         nak_hi_;        // range of lost packets
00125     double      ts_;            // timestamp
00126 };
00127 
00128 struct lms_nak {
00129         int     nak_lo_;
00130         int     nak_hi_;
00131         int     nak_seqn_;
00132         int     dup_cnt_;    // num of dup requests for each NAK
00133         packet_t t;
00134         int     datsize;    
00135 };
00136 
00137 struct lms_rdl {
00138         int             seqn_;
00139         double          ts_;
00140         struct lms_rdl  *next_;
00141 };
00142 
00143 struct lms_spm {
00144         int             spm_seqno_;
00145         nsaddr_t        spm_path_;
00146         double          spm_ts_;
00147 };
00148 
00149 #endif   /* end ifndef lms_h */

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