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

srm-ssm.h

Go to the documentation of this file.
00001 // Copyright (c) 2000 by the University of Southern California
00002 // All rights reserved.
00003 //
00004 // Permission to use, copy, modify, and distribute this software and its
00005 // documentation in source and binary forms for non-commercial purposes
00006 // and without fee is hereby granted, provided that the above copyright
00007 // notice appear in all copies and that both the copyright notice and
00008 // this permission notice appear in supporting documentation. and that
00009 // any documentation, advertising materials, and other materials related
00010 // to such distribution and use acknowledge that the software was
00011 // developed by the University of Southern California, Information
00012 // Sciences Institute.  The name of the University may not be used to
00013 // endorse or promote products derived from this software without
00014 // specific prior written permission.
00015 //
00016 // THE UNIVERSITY OF SOUTHERN CALIFORNIA makes no representations about
00017 // the suitability of this software for any purpose.  THIS SOFTWARE IS
00018 // PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
00019 // INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
00020 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 //
00022 // Other copyrights might apply to parts of this software and are so
00023 // noted when applicable.
00024 //
00025 // $Header: /nfs/jade/vint/CVSROOT/ns-2/mcast/srm-ssm.h,v 1.4 2000/09/01 03:04:07 haoboy Exp $
00026 
00027 #ifndef ns_ssmsrm_h
00028 #define ns_ssmsrm_h
00029 
00030 #include "config.h"
00031 //#include "heap.h"
00032 #include "srm-state.h"
00033 
00034 
00035 /* Constants for scope flags and types of session messages */
00036 #define SRM_LOCAL 1
00037 #define SRM_GLOBAL 2
00038 #define SRM_RINFO  3  /* Session Message with reps information */
00039 
00040 struct hdr_srm_ext {
00041         int     repid_;
00042         int     origTTL_;
00043 
00044         static int offset_;
00045         inline static int& offset() { return offset_; }
00046         inline static hdr_srm_ext* access(const Packet* p) {
00047                 return (hdr_srm_ext*) p->access(offset_);
00048         }
00049 
00050         // per field member functions
00051         int& repid()    { return repid_; }
00052         int& ottl()    { return origTTL_; } 
00053 };
00054 
00055 class SSMSRMAgent : public SRMAgent 
00056 {
00057   int   glb_sessCtr_;             /* # of global session messages sent */
00058   int   loc_sessCtr_;             /* # of local session messages sent */
00059   int   rep_sessCtr_;             /* # of rep session messages sent */
00060   int   scopeFlag_;
00061   int   groupScope_;              /* Scope of the group, ttl */
00062   int   localScope_;              /* Scope of the local messages, ttl */
00063   int   senderFlag_;
00064   int   repid_;
00065 
00066   void recv_data(int sender, int id, int repid, u_char* data);
00067   //void recv_repr(int sender, int msgid, int repid, u_char* data);
00068   void recv_rqst(int requestor, int round, int sender, int repid, int msgid);
00069   void recv_sess(int sessCtr, int* data, Packet *p);
00070   void recv_glb_sess(int sessCtr, int* data, Packet *p);
00071   void recv_loc_sess(int sessCtr, int* data, Packet *p);
00072   void recv_rep_sess(int sessCtr, int* data, Packet *p);
00073   void send_ctrl(int type, int round, int sender, int msgid, int size);
00074   void send_sess();
00075   void send_glb_sess();
00076   void send_loc_sess();
00077   void send_rep_sess();
00078   void timeout_info();
00079   int is_active(SRMinfo *sp);
00080 public:
00081   SSMSRMAgent();
00082   int command(int argc, const char*const* argv);
00083   void recv(Packet* p, Handler* h);
00084 };
00085 
00086 
00087 #endif // ns_srm_ssm_h

Generated on Tue Apr 20 12:14:33 2004 for NS2.26SourcesOriginal by doxygen 1.3.3