128 lines
6.5 KiB
C++
128 lines
6.5 KiB
C++
// CodeGear C++Builder
|
|
// Copyright (c) 1995, 2025 by Embarcadero Technologies, Inc.
|
|
// All rights reserved
|
|
|
|
// (DO NOT EDIT: machine generated header) 'uCEFServerComponent.pas' rev: 37.00 (Windows)
|
|
|
|
#ifndef uCEFServerComponentHPP
|
|
#define uCEFServerComponentHPP
|
|
|
|
#pragma delphiheader begin
|
|
#pragma option push
|
|
#if defined(__BORLANDC__) && !defined(__clang__)
|
|
#pragma option -w- // All warnings off
|
|
#pragma option -Vx // Zero-length empty class member
|
|
#endif
|
|
#pragma pack(push,8)
|
|
#include <System.hpp>
|
|
#include <SysInit.hpp>
|
|
#include <Winapi.Windows.hpp>
|
|
#include <Winapi.Messages.hpp>
|
|
#include <Winapi.ActiveX.hpp>
|
|
#include <System.Classes.hpp>
|
|
#include <System.Math.hpp>
|
|
#include <uCEFTypes.hpp>
|
|
#include <uCEFInterfaces.hpp>
|
|
#include <uCEFConstants.hpp>
|
|
#include <uCEFServer.hpp>
|
|
#include <uCEFServerEvents.hpp>
|
|
#include <uCEFServerHandler.hpp>
|
|
|
|
//-- user supplied -----------------------------------------------------------
|
|
|
|
namespace Ucefservercomponent
|
|
{
|
|
//-- forward type declarations -----------------------------------------------
|
|
class DELPHICLASS TCEFServerComponent;
|
|
//-- type declarations -------------------------------------------------------
|
|
class PASCALIMPLEMENTATION TCEFServerComponent : public System::Classes::TComponent
|
|
{
|
|
typedef System::Classes::TComponent inherited;
|
|
|
|
protected:
|
|
Ucefinterfaces::_di_ICefServerHandler FHandler;
|
|
Ucefinterfaces::_di_ICefServer FServer;
|
|
bool FInitialized;
|
|
Ucefserverevents::TOnServerCreated FOnServerCreated;
|
|
Ucefserverevents::TOnServerDestroyed FOnServerDestroyed;
|
|
Ucefserverevents::TOnClientConnected FOnClientConnected;
|
|
Ucefserverevents::TOnClientDisconnected FOnClientDisconnected;
|
|
Ucefserverevents::TOnHttpRequest FOnHttpRequest;
|
|
Ucefserverevents::TOnWebSocketRequest FOnWebSocketRequest;
|
|
Ucefserverevents::TOnWebSocketConnected FOnWebSocketConnected;
|
|
Ucefserverevents::TOnWebSocketMessage FOnWebSocketMessage;
|
|
bool __fastcall GetInitialized();
|
|
bool __fastcall GetIsRunning();
|
|
Uceftypes::ustring __fastcall GetAddress();
|
|
bool __fastcall GetHasConnection();
|
|
virtual void __fastcall doOnServerCreated(const Ucefinterfaces::_di_ICefServer server);
|
|
virtual void __fastcall doOnServerDestroyed(const Ucefinterfaces::_di_ICefServer server);
|
|
virtual void __fastcall doOnClientConnected(const Ucefinterfaces::_di_ICefServer server, int connection_id);
|
|
virtual void __fastcall doOnClientDisconnected(const Ucefinterfaces::_di_ICefServer server, int connection_id);
|
|
virtual void __fastcall doOnHttpRequest(const Ucefinterfaces::_di_ICefServer server, int connection_id, const Uceftypes::ustring client_address, const Ucefinterfaces::_di_ICefRequest request);
|
|
virtual void __fastcall doOnWebSocketRequest(const Ucefinterfaces::_di_ICefServer server, int connection_id, const Uceftypes::ustring client_address, const Ucefinterfaces::_di_ICefRequest request, const Ucefinterfaces::_di_ICefCallback callback);
|
|
virtual void __fastcall doOnWebSocketConnected(const Ucefinterfaces::_di_ICefServer server, int connection_id);
|
|
virtual void __fastcall doOnWebSocketMessage(const Ucefinterfaces::_di_ICefServer server, int connection_id, const void * data, System::NativeUInt data_size);
|
|
void __fastcall InitializeEvents();
|
|
|
|
public:
|
|
__fastcall virtual TCEFServerComponent(System::Classes::TComponent* AOwner);
|
|
__fastcall virtual ~TCEFServerComponent();
|
|
void __fastcall CreateServer(const Uceftypes::ustring address = L"127.0.0.1", System::UInt16 port = (System::Word)(0x1fa3), int backlog = 0xa);
|
|
void __fastcall Shutdown();
|
|
bool __fastcall IsValidConnection(int connection_id);
|
|
void __fastcall SendHttp200response(int connection_id, const Uceftypes::ustring content_type, const void * data, System::NativeUInt data_size);
|
|
void __fastcall SendHttp404response(int connection_id);
|
|
void __fastcall SendHttp500response(int connection_id, const Uceftypes::ustring error_message);
|
|
void __fastcall SendHttpResponse(int connection_id, int response_code, const Uceftypes::ustring content_type, __int64 content_length, const Ucefinterfaces::_di_ICefStringMultimap extra_headers);
|
|
void __fastcall SendRawData(int connection_id, const void * data, System::NativeUInt data_size);
|
|
void __fastcall CloseConnection(int connection_id);
|
|
void __fastcall SendWebSocketMessage(int connection_id, const void * data, System::NativeUInt data_size);
|
|
__property bool Initialized = {read=GetInitialized, nodefault};
|
|
__property bool IsRunning = {read=GetIsRunning, nodefault};
|
|
__property Uceftypes::ustring Address = {read=GetAddress};
|
|
__property bool HasConnection = {read=GetHasConnection, nodefault};
|
|
|
|
__published:
|
|
__property Ucefserverevents::TOnServerCreated OnServerCreated = {read=FOnServerCreated, write=FOnServerCreated};
|
|
__property Ucefserverevents::TOnServerDestroyed OnServerDestroyed = {read=FOnServerDestroyed, write=FOnServerDestroyed};
|
|
__property Ucefserverevents::TOnClientConnected OnClientConnected = {read=FOnClientConnected, write=FOnClientConnected};
|
|
__property Ucefserverevents::TOnClientDisconnected OnClientDisconnected = {read=FOnClientDisconnected, write=FOnClientDisconnected};
|
|
__property Ucefserverevents::TOnHttpRequest OnHttpRequest = {read=FOnHttpRequest, write=FOnHttpRequest};
|
|
__property Ucefserverevents::TOnWebSocketRequest OnWebSocketRequest = {read=FOnWebSocketRequest, write=FOnWebSocketRequest};
|
|
__property Ucefserverevents::TOnWebSocketConnected OnWebSocketConnected = {read=FOnWebSocketConnected, write=FOnWebSocketConnected};
|
|
__property Ucefserverevents::TOnWebSocketMessage OnWebSocketMessage = {read=FOnWebSocketMessage, write=FOnWebSocketMessage};
|
|
private:
|
|
void *__IServerEvents; // Ucefinterfaces::IServerEvents
|
|
|
|
public:
|
|
#if defined(MANAGED_INTERFACE_OPERATORS)
|
|
// {06A1B3C6-0967-4F6C-A751-8AA3A29E2FF5}
|
|
operator Ucefinterfaces::_di_IServerEvents()
|
|
{
|
|
Ucefinterfaces::_di_IServerEvents intf;
|
|
this->GetInterface(intf);
|
|
return intf;
|
|
}
|
|
#else
|
|
operator Ucefinterfaces::IServerEvents*(void) { return (Ucefinterfaces::IServerEvents*)&__IServerEvents; }
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
//-- var, const, procedure ---------------------------------------------------
|
|
#define DEFAULT_CEFSERVER_ADDRESS L"127.0.0.1"
|
|
static _DELPHI_CONST System::Word DEFAULT_CEFSERVER_PORT = System::Word(0x1fa3);
|
|
static _DELPHI_CONST System::Int8 DEFAULT_CEFSERVER_BACKLOG = System::Int8(0xa);
|
|
} /* namespace Ucefservercomponent */
|
|
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_UCEFSERVERCOMPONENT)
|
|
using namespace Ucefservercomponent;
|
|
#endif
|
|
#pragma pack(pop)
|
|
#pragma option pop
|
|
|
|
#pragma delphiheader end.
|
|
//-- end unit ----------------------------------------------------------------
|
|
#endif // uCEFServerComponentHPP
|