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

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

#ifndef InudpserverHPP
#define InudpserverHPP

#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 <Classes.hpp>	// Pascal unit
#include <Incomponent.hpp>	// Pascal unit
#include <Inexception.hpp>	// Pascal unit
#include <Inglobal.hpp>	// Pascal unit
#include <Insockethandle.hpp>	// Pascal unit
#include <Instackconsts.hpp>	// Pascal unit
#include <Inthread.hpp>	// Pascal unit
#include <Inudpbase.hpp>	// Pascal unit
#include <Instack.hpp>	// Pascal unit
#include <Inbasecomponent.hpp>	// Pascal unit

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

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

typedef void __fastcall (__closure *TUDPReadEvent)(System::TObject* Sender, Inglobal::TBytes AData, Insockethandle::TInSocketHandle* ABinding);

class DELPHICLASS TIdUDPListenerThread;
class DELPHICLASS TInUDPServer;
class PASCALIMPLEMENTATION TInUDPServer : public Inudpbase::TInUDPBase 
{
	typedef Inudpbase::TInUDPBase inherited;
	
protected:
	Insockethandle::TInSocketHandles* FBindings;
	Insockethandle::TInSocketHandle* FCurrentBinding;
	TIdUDPListenerThread* FListenerThread;
	TUDPReadEvent FOnUDPRead;
	TIdUDPExceptionEvent FOnUDPException;
	bool FThreadedEvent;
	DYNAMIC void __fastcall BroadcastEnabledChanged(void);
	virtual void __fastcall CloseBinding(void);
	virtual void __fastcall DoUDPRead(Inglobal::TBytes AData, Insockethandle::TInSocketHandle* ABinding);
	virtual void __fastcall DoOnUDPException(Insockethandle::TInSocketHandle* ABinding, const AnsiString AMessage, const TMetaClass* AExceptionClass);
	virtual bool __fastcall GetActive(void);
	virtual Insockethandle::TInSocketHandle* __fastcall GetBinding(void);
	int __fastcall GetDefaultPort(void);
	virtual void __fastcall InitComponent(void);
	void __fastcall PacketReceived(Inglobal::TBytes AData, Insockethandle::TInSocketHandle* ABinding);
	void __fastcall ExceptionRaised(Insockethandle::TInSocketHandle* ABinding, const AnsiString AMessage, const TMetaClass* AExceptionClass);
	void __fastcall SetBindings(const Insockethandle::TInSocketHandles* Value);
	void __fastcall SetDefaultPort(const int AValue);
	
public:
	__fastcall virtual ~TInUDPServer(void);
	
__published:
	__property Insockethandle::TInSocketHandles* 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
	/* TInBaseComponent.Create */ inline __fastcall TInUDPServer(Classes::TComponent* AOwner)/* overload */ : Inudpbase::TInUDPBase(AOwner) { }
	#pragma option pop
	
};


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


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


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

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

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