// Borland C++ Builder
// Copyright (c) 1995, 2005 by Borland Software Corporation
// All rights reserved

// (DO NOT EDIT: machine generated header) 'Idudpserver.pas' rev: 10.00

#ifndef IdudpserverHPP
#define IdudpserverHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member functions
#pragma pack(push,8)
#include <System.hpp>	// Pascal unit
#include <Sysinit.hpp>	// Pascal unit
#include <Idcomponent.hpp>	// Pascal unit
#include <Idexception.hpp>	// Pascal unit
#include <Idglobal.hpp>	// Pascal unit
#include <Idsockethandle.hpp>	// Pascal unit
#include <Idstackconsts.hpp>	// Pascal unit
#include <Idsys.hpp>	// Pascal unit
#include <Idthread.hpp>	// Pascal unit
#include <Idudpbase.hpp>	// Pascal unit
#include <Idstack.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <Idbasecomponent.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Idudpserver
{
//-- type declarations -------------------------------------------------------
typedef void __fastcall (__closure *TIdUDPExceptionEvent)(System::TObject* Sender, Idsockethandle::TIdSocketHandle* ABinding, const AnsiString AMessage, const TMetaClass* AExceptionClass);

typedef void __fastcall (__closure *TUDPReadEvent)(System::TObject* Sender, Idglobal::TBytes AData, Idsockethandle::TIdSocketHandle* ABinding);

class DELPHICLASS TIdUDPListenerThread;
class DELPHICLASS TIdUDPServer;
class PASCALIMPLEMENTATION TIdUDPServer : public Idudpbase::TIdUDPBase 
{
	typedef Idudpbase::TIdUDPBase inherited;
	
protected:
	Idsockethandle::TIdSocketHandles* FBindings;
	Idsockethandle::TIdSocketHandle* FCurrentBinding;
	TIdUDPListenerThread* FListenerThread;
	TUDPReadEvent FOnUDPRead;
	TIdUDPExceptionEvent FOnUDPException;
	bool FThreadedEvent;
	DYNAMIC void __fastcall BroadcastEnabledChanged(void);
	virtual void __fastcall CloseBinding(void);
	virtual void __fastcall DoUDPRead(Idglobal::TBytes AData, Idsockethandle::TIdSocketHandle* ABinding);
	virtual void __fastcall DoOnUDPException(Idsockethandle::TIdSocketHandle* ABinding, const AnsiString AMessage, const TMetaClass* AExceptionClass);
	virtual bool __fastcall GetActive(void);
	virtual Idsockethandle::TIdSocketHandle* __fastcall GetBinding(void);
	int __fastcall GetDefaultPort(void);
	virtual void __fastcall InitComponent(void);
	void __fastcall PacketReceived(Idglobal::TBytes AData, Idsockethandle::TIdSocketHandle* ABinding);
	void __fastcall ExceptionRaised(Idsockethandle::TIdSocketHandle* ABinding, const AnsiString AMessage, const TMetaClass* AExceptionClass);
	void __fastcall SetBindings(const Idsockethandle::TIdSocketHandles* Value);
	void __fastcall SetDefaultPort(const int AValue);
	
public:
	__fastcall virtual ~TIdUDPServer(void);
	
__published:
	__property Idsockethandle::TIdSocketHandles* Bindings = {read=FBindings, write=SetBindings};
	__property int DefaultPort = {read=GetDefaultPort, write=SetDefaultPort, nodefault};
	__property TUDPReadEvent OnUDPRead = {read=FOnUDPRead, write=FOnUDPRead};
	__property TIdUDPExceptionEvent OnUDPException = {read=FOnUDPException, write=FOnUDPException};
	__property bool ThreadedEvent = {read=FThreadedEvent, write=FThreadedEvent, default=0};
public:
	#pragma option push -w-inl
	/* TIdBaseComponent.Create */ inline __fastcall TIdUDPServer(Classes::TComponent* AOwner)/* overload */ : Idudpbase::TIdUDPBase(AOwner) { }
	#pragma option pop
	
};


class PASCALIMPLEMENTATION TIdUDPListenerThread : public Idthread::TIdThread 
{
	typedef Idthread::TIdThread inherited;
	
protected:
	Idsockethandle::TIdSocketHandle* FIncomingData;
	int FAcceptWait;
	DynamicArray<Byte >  FBuffer;
	int FBufferSize;
	Idstack::TIdSocketList* FReadList;
	AnsiString FCurrentException;
	TMetaClass* FCurrentExceptionClass;
	virtual void __fastcall AfterRun(void);
	virtual void __fastcall BeforeRun(void);
	virtual void __fastcall Run(void);
	
public:
	TIdUDPServer* FServer;
	__fastcall TIdUDPListenerThread(const int ABufferSize, TIdUDPServer* Owner);
	__fastcall virtual ~TIdUDPListenerThread(void);
	void __fastcall UDPRead(void);
	void __fastcall UDPException(void);
	__property int AcceptWait = {read=FAcceptWait, write=FAcceptWait, nodefault};
};


class DELPHICLASS EIdUDPServerException;
class PASCALIMPLEMENTATION EIdUDPServerException : public Idudpbase::EIdUDPException 
{
	typedef Idudpbase::EIdUDPException inherited;
	
public:
	#pragma option push -w-inl
	/* EIdException.Create */ inline __fastcall virtual EIdUDPServerException(AnsiString AMsg)/* overload */ : Idudpbase::EIdUDPException(AMsg) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* Exception.CreateFmt */ inline __fastcall EIdUDPServerException(const AnsiString Msg, System::TVarRec const * Args, const int Args_Size) : Idudpbase::EIdUDPException(Msg, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateRes */ inline __fastcall EIdUDPServerException(int Ident)/* overload */ : Idudpbase::EIdUDPException(Ident) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmt */ inline __fastcall EIdUDPServerException(int Ident, System::TVarRec const * Args, const int Args_Size)/* overload */ : Idudpbase::EIdUDPException(Ident, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateHelp */ inline __fastcall EIdUDPServerException(const AnsiString Msg, int AHelpContext) : Idudpbase::EIdUDPException(Msg, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateFmtHelp */ inline __fastcall EIdUDPServerException(const AnsiString Msg, System::TVarRec const * Args, const int Args_Size, int AHelpContext) : Idudpbase::EIdUDPException(Msg, Args, Args_Size, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResHelp */ inline __fastcall EIdUDPServerException(int Ident, int AHelpContext)/* overload */ : Idudpbase::EIdUDPException(Ident, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmtHelp */ inline __fastcall EIdUDPServerException(System::PResStringRec ResStringRec, System::TVarRec const * Args, const int Args_Size, int AHelpContext)/* overload */ : Idudpbase::EIdUDPException(ResStringRec, Args, Args_Size, AHelpContext) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~EIdUDPServerException(void) { }
	#pragma option pop
	
};


//-- var, const, procedure ---------------------------------------------------

}	/* namespace Idudpserver */
using namespace Idudpserver;
#pragma pack(pop)
#pragma option pop

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// Idudpserver
