00001 /*************************************************************************** 00002 RTSPClientLayer.h 00003 ------------------- 00004 begin : Sun Jun 09 2002 00005 ***************************************************************************/ 00006 00007 /*************************************************************************** 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 ***************************************************************************/ 00015 00020 #include "omnetpp.h" 00021 00022 #include "sockets.h" 00023 #include "in_addr.h" 00024 #include "in_port.h" 00025 00026 #include "RTSPMessage_m.h" 00027 00033 class RTSPClientLayer : public cSimpleModule { 00034 00035 00039 enum FSM_STATES { 00040 00041 INIT = 0, 00042 READY = FSM_Steady(1), 00043 PLAYING = FSM_Steady(2), 00044 }; 00045 00046 00047 Module_Class_Members(RTSPClientLayer, cSimpleModule, 0); 00048 00052 virtual void initialize(); 00053 00057 virtual void handleMessage(cMessage *msg); 00058 00059 00060 protected: 00061 00065 virtual void handleMessageFromApp(cMessage *msg); 00066 00070 virtual void handleMessageFromRTP(cMessage *msg); 00071 00075 virtual void handleMessageFromSocketLayer(cMessage *msg); 00076 00080 virtual void handleResponse(SocketInterfacePacket *sifp); 00081 00085 virtual void handleResponseStateInit(rtspResponse *response); 00086 00090 virtual void handleResponseStateReady(rtspResponse *response); 00091 00095 virtual void handleResponseStatePlaying(rtspResponse *response); 00096 00100 virtual void handleSelfMessage(cMessage *msg); 00101 00105 virtual void closeSession(); 00106 00107 private: 00108 00109 /* 00110 The finite state machine 00111 */ 00112 cFSM fsm; 00113 00117 int _cseq; 00118 00122 IN_Port _portRTP; 00123 00127 opp_string _sessionId; 00128 00132 rtspRequest *request; 00133 00137 rtspRequest *requestCopy; 00138 00142 cMessage *timeoutMsg; 00143 00147 simtime_t _timeout; 00148 00152 Socket::Filedesc _socketFd; 00153 00157 bool _debug; 00158 00162 virtual void writeRequestContents(rtspRequest *request); 00163 00167 virtual void writeResponseContents(rtspResponse *response); 00168 00169 };