⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 socketudp.h

📁 symbian平台S60_2nd_FP2_SC rtp实现
💻 H
字号:

#ifndef __SOCKETSENGINE_H__
#define __SOCKETSENGINE_H__


#include <utf.h>
#include "NetworkAddress.h"
#include "socketsenginenotifier.h"
#include "TDefine.h"
#include "BaseQueue.h"


class CReaderUdp;
class CWriterUdp;
class RtpSession;

class CSocketUdp :  public MSocketsEngineNotifier	// public MTimeOutNotifier,
{
public:
	static CSocketUdp* NewL(RtpSession *aSession);
	CSocketUdp(RtpSession *aSession);
	void ConstructL();
	virtual ~CSocketUdp();

public:
	void ConnectL();
	void Close();
	TInt SendToL(const NetworkAddress& DestAddress,TDesC8& aData);
	TInt SendToL(TDesC8& aData);
	void Read();
 	void ReportError(MSocketsEngineNotifier::TErrorType aErrorType, TInt /*aErrorCode*/);
	void ResponseReceived(const TDesC8& aBuffer, const TInetAddr& aRecvFrom);

	void SetServerIpAndPort(const TDesC& aIp, TInt aPort);
	char* GetAddress() ;

	int	 GetPort();
	
public:
	int transmitTo (char* buffer,const int length,NetworkAddress* dest );
    int RTPreceive(char* buffer,int bufSize );
	int RTCPreceive(char* buffer,int bufSize );
	int SelectRTPStack();
	int SelectRTCPStack();

    UdpMode getMode () { return mode;}
    void setMode ( const UdpMode theMode ) { mode = theMode; }
    
	// save recieving and transmitting address
	// NetworkAddress :
	// remote IP/PORT
	// local PORT
    void setDestination ( NetworkAddress host ) {udpAddress = host;}
	NetworkAddress getDestination(){ return udpAddress;}
 
	//Get the port being used for recieving
	int getRxPort () { return udpAddress.GetlocalPort();}
	//Get the port being used for transmitting
    int getTxPort () { return udpAddress.GetlocalPort();}
    int getDestinationPort () { return udpAddress.GetremotePort(); }
	
public:
	enum TSocketsEngineState 
	    {
		ENotConnected=0,
		EConnecting,
		EConnected,
		ESending,
        ERecving
	    };
private:
    void ChangeStatus(TSocketsEngineState aNewStatus);

private:
	TSocketsEngineState         iEngineStatus;
	RSocket                     iSocket;
	RSocketServ					iSocketSev;
	CReaderUdp*             iSocketsReader;
	CWriterUdp*             iSocketsWriter;
	TInetAddr                   iAddress;
	TBuf<KMaxSockAddrSize>		iServerIp;
    TInt                        iPort;
	MSocketsEngineNotifier*     iSocketsEngineNotifier;

	char						servIp[32];
	char						MobileStationName [32];

private:
	NetworkAddress udpAddress;
	RtpSession * iSession;

	UdpMode mode;
    float packetLossProbability;

    int numBytesReceived;
    int numPacketsReceived;
    int numBytesTransmitted;
    int numPacketsTransmitted;
private:
	BaseQueue<rtpData>  iRtpQueue;
	BaseQueue<rtpData>  iRtcpQueue;

	bool IsF;
};

#endif // __SOCKETSENGINE_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -