// Author: Leslie S. Liu (shihuali@usc.edu) // Written on April 22, 2003 // IMSC , University of Southern California // File: udp-pp.h // Written for : ns-2.26 // Last updated: April 24,2003 // #ifndef ns_udp_pp_h #define ns_udp_pp_h #include "udp.h" #include "ip.h" #define MAX_STR_LEN 32 // Multimedia Header Structure struct hdr_pp { int join; //a join packet if == 1 int ack_join; //an response packet to join request int leave; //a graceful leave message int ack_leave; //a response packet for leave request int v_data; //a video stream packet int check; //a check packet for connection int ack_check; //ack packet to check request nsaddr_t ref_addr; // a address holder for different purposes char msg_data[MAX_STR_LEN]; //data that carried with the packet nsaddr_t src_addr; //address where the packet from //this address information is used in application //layer,so we must include it here in hdr int seq; // pp sequence number int nbytes; // bytes for pp pkt double time; // current time int scale; // scale (0-4) associated with data rates // Packet header access functions static int offset_; inline static int& offset() { return offset_; } inline static hdr_pp* access(const Packet* p) { return (hdr_pp*) p->access(offset_); } }; // Used for Re-assemble segmented (by UDP) PP packet struct asm_pp { int seq; // pp sequence number int rbytes; // currently received bytes int tbytes; // total bytes to receive for PP packet }; // UdpPPAgent Class definition class UdpPPAgent : public UdpAgent { public: UdpPPAgent(); UdpPPAgent(packet_t); virtual int supportPP() { return 1; } virtual void enablePP() { support_pp_ = 1; } virtual void sendmsg(int nbytes, const char *flags = 0); void recv(Packet*, Handler*); protected: int support_pp_; // set to 1 if above is PPApp private: asm_pp asm_info; // packet re-assembly information }; #endif