00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00022 #ifndef __RTCPENDSYSTEMMODULE_H__
00023 #define __RTCPENDSYSTEMMODULE_H__
00024
00025 #include "omnetpp.h"
00026
00027 #include "sockets.h"
00028
00029 #include "types.h"
00030 #include "RTPInnerPacket.h"
00031 #include "RTPParticipantInfo.h"
00032 #include "RTPSenderInfo.h"
00033 #include "RTPReceiverInfo.h"
00034
00040 class RTCPEndsystemModule : public cSimpleModule {
00041
00042 Module_Class_Members(RTCPEndsystemModule, cSimpleModule, 0);
00043
00047 virtual void initialize();
00048
00052 virtual void handleMessage(cMessage *msg);
00053
00054 protected:
00055
00059 virtual void handleMessageFromRTP(cMessage *msg);
00060
00064 virtual void handleMessageFromSocketLayer(cMessage *msg);
00065
00069 virtual void handleSelfMessage(cMessage *msg);
00070
00074 virtual void initializeRTCP(RTPInnerPacket *rinp);
00075
00079 virtual void senderModuleInitialized(RTPInnerPacket *rinp);
00080
00084 virtual void dataOut(RTPInnerPacket *packet);
00085
00089 virtual void dataIn(RTPInnerPacket *rinp);
00090
00096 virtual void leaveSession(RTPInnerPacket *rinp);
00097
00101 virtual void socketRet(SocketInterfacePacket *sifpIn);
00102
00106 virtual void connectRet(SocketInterfacePacket *sifpIn);
00107
00112 virtual void readRet(SocketInterfacePacket *sifpIn);
00113
00114 private:
00115
00119 int _mtu;
00120
00124 int _bandwidth;
00125
00129 int _rtcpPercentage;
00130
00134 IN_Addr _destinationAddress;
00135
00139 IN_Port _port;
00140
00144 bool _ssrcChosen;
00145
00149 bool _leaveSession;
00150
00154 RTPSenderInfo *_senderInfo;
00155
00160 cArray *_participantInfos;
00161
00165 Socket::Filedesc _socketFdIn;
00166
00170 Socket::Filedesc _socketFdOut;
00171
00176 int _packetsCalculated;
00177
00181 double _averagePacketSize;
00182
00189 cOutVector *_rtcpIntervalOutVector;
00190
00194 virtual void createServerSocket();
00195
00199 virtual void createClientSocket();
00200
00204 virtual void chooseSSRC();
00205
00210 virtual void scheduleInterval();
00211
00215 virtual void createPacket();
00216
00220 virtual void processOutgoingRTPPacket(RTPPacket *packet);
00221
00225 virtual void processIncomingRTPPacket(RTPPacket *packet, IN_Addr address, IN_Port port);
00226
00230 virtual void processIncomingRTCPPacket(RTCPCompoundPacket *packet, IN_Addr address, IN_Port port);
00231
00237 virtual RTPParticipantInfo* findParticipantInfo(u_int32 ssrc);
00238
00243 virtual void calculateAveragePacketSize(int size);
00244 };
00245
00246 #endif