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

📄 gsdp.h

📁 Symbian mobile os C++ GSDP编程
💻 H
字号:
// gsdp.h
//
// Copyright (c) 2000-2002 Symbian Ltd.  All rights reserved.
//

#ifndef __GSDP_H
#define __GSDP_H

#include <e32std.h>

// game session datagram protocol interface specification

class MGsdpPacketHandler
	{
public:
	virtual void GsdpHandleL(const TDesC8& aData)=0;
	};

const TInt KMaxGdpDisplayName = 0x20;

class TGdpProtocolInfo
	{
public:
	TUid   iUid;
	TBuf<KMaxGdpDisplayName> iDisplayName;
	TBool  iNetworked;
	};

class CGsdpReceiveHandler;

class RGsdpSession : public RSessionBase
	{
public:
	// construct
	inline RGsdpSession() : iHandler(0) {};
	// open/close
	IMPORT_C void ConnectL(MGsdpPacketHandler& aHandler);
	IMPORT_C void Close();
	// Query supported protocols
	IMPORT_C TInt CountGdpProtocols() const;  ///< Returns count of protocols
	/// Retrieve info for particular protocol
	IMPORT_C TInt GetGdpProtocolInfo(TInt aProto, TGdpProtocolInfo& aInfo) const;
 	
    // load and get GDP protocol
	IMPORT_C TInt SetGdpProtocol(TUid aProtocol);
	IMPORT_C TUid GetGdpProtocol() const;
	IMPORT_C TBool GdpIsNetworked() const;

	// game protocol
	IMPORT_C void SetGameProtocol(TUint32 aProtocol);
	IMPORT_C TUint32 GetGameProtocol() const;
	// set and get my address and port
	IMPORT_C void SetMyPort(TUint32 aPort);
	IMPORT_C TUint32 GetMyPort() const;
	IMPORT_C TUint32 AllocMyNextPort();
	// set and get other address and port
	IMPORT_C void SetOtherAddress(const TDesC8& aAddress);
	IMPORT_C void GetOtherAddress(TDes8& aAddress) const;
	IMPORT_C void SetOtherPort(TUint32 aPort);
	IMPORT_C TUint32 GetOtherPort() const;
	// main protocol functions
	IMPORT_C void Listen();
	IMPORT_C void StopListening();
	IMPORT_C void Send(const TDesC8& aData);
	// initiate receive-all for "pull" protocols
	IMPORT_C void ReceiveAll() const;
private:
friend class CGsdpReceiveHandler;
	void Receive(TDes8& aBuffer, TRequestStatus& aStatus);
	void CancelReceive();
	CGsdpReceiveHandler* iHandler;
	};

const TInt KMaxGsdpAddress=40;
const TInt KMaxGsdpData=100;

#endif

⌨️ 快捷键说明

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