• Main Page
  • Classes
  • Files
  • File List

/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/tutorial_nsbyexample/udp-mm.h

00001 //
00002 // Author:    Jae Chung
00003 // File:      udp-mm.h 
00004 // Written:   07/17/99 (for ns-2.1b4a)
00005 // Modifed:   10/14/01 (for ns-2.1b8a)
00006 // 
00007 
00008 #ifndef ns_udp_mm_h
00009 #define ns_udp_mm_h
00010 
00011 #include "udp.h"
00012 #include "ip.h"
00013 
00014 // Multimedia Header Structure
00015 struct hdr_mm {
00016         int ack;     // is it ack packet?
00017         int seq;     // mm sequence number
00018         int nbytes;  // bytes for mm pkt
00019         double time; // current time
00020         int scale;   // scale (0-4) associated with data rates
00021 
00022         // Packet header access functions
00023         static int offset_;
00024         inline static int& offset() { return offset_; }
00025         inline static hdr_mm* access(const Packet* p) {
00026                 return (hdr_mm*) p->access(offset_);
00027         }
00028 };
00029 
00030 
00031 // Used for Re-assemble segmented (by UDP) MM packet
00032 struct asm_mm { 
00033         int seq;     // mm sequence number
00034         int rbytes;  // currently received bytes
00035         int tbytes;  // total bytes to receive for MM packet
00036 };
00037 
00038 
00039 // UdpMmAgent Class definition
00040 class UdpMmAgent : public UdpAgent {
00041 public:
00042         UdpMmAgent();
00043         UdpMmAgent(packet_t);
00044         virtual int supportMM() { return 1; }
00045         virtual void enableMM() { support_mm_ = 1; }
00046         virtual void sendmsg(int nbytes, const char *flags = 0);
00047         void recv(Packet*, Handler*);
00048 protected:
00049         int support_mm_; // set to 1 if above is MmApp
00050 private:
00051         asm_mm asm_info; // packet re-assembly information
00052 };
00053 
00054 #endif

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