📄 rmaengin.pas
字号:
unit RmaEngin;
interface
uses
PnResult, PnTypes, RmaPckts;
(****************************************************************************
*
* $Id: rmaengin.h,v 1.67 2000/04/17 19:10:20 dcollins Exp $
*
* Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved.
*
* http://www.real.com/devzone
*
* This program contains proprietary
* information of Progressive Networks, Inc, and is licensed
* subject to restrictions on use and distribution.
*
*
* RealMedia Architecture Callback, Networking, and Scheduling interfaces.
*
*)
(*
* Address flags starting with PNR are depricated.
*)
const
PNR_INADDR_ANY = UINT32($00000000); //THIS FLAG IS DEPRICATED
{$EXTERNALSYM PNR_INADDR_ANY}
PN_INADDR_ANY = UINT32($00000000);
{$EXTERNALSYM PN_INADDR_ANY}
(*
* 255.255.255.254
*
* Bind to all ports in IPBindings list from
* server config.
*)
PNR_INADDR_IPBINDINGS = UINT32($fffffffe); //THIS FLAG IS DEPRICATED
{$EXTERNALSYM PNR_INADDR_IPBINDINGS}
PN_INADDR_IPBINDINGS = UINT32($fffffffe);
{$EXTERNALSYM PN_INADDR_IPBINDINGS}
(* Async IO Selection Type (Unix Only) *)
PNAIO_READ = 1;
{$EXTERNALSYM PNAIO_READ}
PNAIO_WRITE = 2;
{$EXTERNALSYM PNAIO_WRITE}
PNAIO_EXCEPTION = 4;
{$EXTERNALSYM PNAIO_EXCEPTION}
(****************************************************************************
*
* Interface:
*
* IRMACallback
*
* Purpose:
*
* This interface defines a simple callback which will be used in
* various interfaces such as IRMAScheduler.
*
* IID_IRMACallback:
*
* {00000100-0901-11d1-8B06-00A024406D59}
*
*)
const
IID_IRMACallback: TGUID = '{00000100-0901-11d1-8B06-00A024406D59}';
{$EXTERNALSYM IID_IRMACallback}
type
IRMACallback = interface (IUnknown)
['{00000100-0901-11d1-8B06-00A024406D59}']
(************************************************************************
* Method:
* IRMACallback::Func
* Purpose:
* This is the function that will be called when a callback is
* to be executed.
*)
function Func: HRESULT; stdcall;
end;
{$EXTERNALSYM IRMACallback}
(****************************************************************************
*
* Interface:
*
* IRMAScheduler
*
* Purpose:
*
* This interface provides the user with a way of scheduling callbacks
* that will be executed at some time in the future.
*
* IID_IRMAScheduler:
*
* {00000101-0901-11d1-8B06-00A024406D59}
*
*)
const
IID_IRMAScheduler: TGUID = '{00000101-0901-11d1-8B06-00A024406D59}';
{$EXTERNALSYM IID_IRMAScheduler}
type
CallbackHandle = ULONG32;
{$EXTERNALSYM CallbackHandle}
_RMATimeval = record
tv_sec: UINT32;
tv_usec: UINT32;
end;
{$EXTERNALSYM _RMATimeval}
RMATimeval = _RMATimeval;
{$EXTERNALSYM RMATimeval}
type
IRMAScheduler = interface (IUnknown)
['{00000101-0901-11d1-8B06-00A024406D59}']
(************************************************************************
* Method:
* IRMAScheduler::RelativeEnter
* Purpose:
* Schedule a callback to be executed "ms" milliseconds from now
* This function is less percise then AbsoluteEnter and should only
* be used when accurate timing is not critical.
*)
function RelativeEnter(pCallback: IRMACallback; ms: UINT32): CallbackHandle; stdcall;
(************************************************************************
* Method:
* IRMAScheduler::AbsoluteEnter
* Purpose:
* Schedule a callback to be executed at time "tVal".
*)
function AbsoluteEnter(pCallback: IRMACallback; tVal: RMATimeval): CallbackHandle; stdcall;
(************************************************************************
* Method:
* IRMAScheduler::Remove
* Purpose:
* Remove a callback from the scheduler.
*)
function Remove(Handle: CallbackHandle): HRESULT; stdcall;
(************************************************************************
* Method:
* IRMAScheduler::GetCurrentSchedulerTime
* Purpose:
* Gives the current time (in the timeline of the scheduler).
*)
function GetCurrentSchedulerTime: RMATimeval; stdcall;
end;
{$EXTERNALSYM IRMAScheduler}
(****************************************************************************
*
* Interface:
*
* IRMATCPResponse
*
* Purpose:
*
* This is the response interface for the asynchronous TCP networking
* interface.
*
* IID_IRMATCPResponse:
*
* {00000102-0901-11d1-8B06-00A024406D59}
*
*)
const
IID_IRMATCPResponse: TGUID = '{00000102-0901-11d1-8B06-00A024406D59}';
{$EXTERNALSYM IID_IRMATCPResponse}
type
IRMATCPResponse = interface (IUnknown)
['{00000102-0901-11d1-8B06-00A024406D59}']
(************************************************************************
* Method:
* IRMATCPResponse::ConnectDone
* Purpose:
* A Connect operation has been completed or an error has occurred.
*)
function ConnectDone(status: PN_RESULT): HRESULT; stdcall;
(************************************************************************
* Method:
* IRMATCPResponse::ReadDone
* Purpose:
* A Read operation has been completed or an error has occurred.
* The data is returned in the IRMABuffer.
*)
function ReadDone(status: PN_RESULT; pBuffer: IRMABuffer): HRESULT; stdcall;
(************************************************************************
* Method:
* IRMATCPResponse::WriteReady
* Purpose:
* This is the response method for WantWrite.
* If PN_RESULT is ok, then the TCP channel is ok to Write to.
*)
function WriteReady(status: PN_RESULT): HRESULT; stdcall;
(************************************************************************
* Method:
* IRMATCPResponse::Closed
* Purpose:
* This method is called to inform you that the TCP channel has
* been closed by the peer or closed due to error.
*)
function Closed(status: PN_RESULT): HRESULT; stdcall;
end;
{$EXTERNALSYM IRMATCPResponse}
(****************************************************************************
*
* Interface:
*
* IRMATCPSocket
*
* Purpose:
*
* Provides the user with an asynchronous TCP networking interface.
*
* IID_IRMATCPSocket:
*
* {00000103-0901-11d1-8B06-00A024406D59}
*
*)
const
IID_IRMATCPSocket: TGUID = '{00000103-0901-11d1-8B06-00A024406D59}';
{$EXTERNALSYM IID_IRMATCPSocket}
type
IRMATCPSocket = interface (IUnknown)
['{00000103-0901-11d1-8B06-00A024406D59}']
function Init(pTCPResponse: IRMATCPResponse): HRESULT; stdcall;
function SetResponse(pTCPResponse: IRMATCPResponse): HRESULT; stdcall;
function Bind(ulLocalAddr: UINT32; nPort: UINT16): HRESULT; stdcall;
(*
* pDestination is a string containing host name or dotted-ip notation
*)
function Connect(pDestination: PChar; nPort: UINT16): HRESULT; stdcall;
function Read(Size: UINT16): HRESULT; stdcall;
function Write(pBuffer: IRMABuffer): HRESULT; stdcall;
(************************************************************************
* Method:
* IRMATCPSocket::WantWrite
* Purpose:
* This method is called when you wish to write a large amount of
* data. If you are only writing small amounts of data, you can
* just call Write (all data not ready to be transmitted will be
* buffered on your behalf). When the TCP channel is ready to be
* written to, the response interfaces WriteReady method will be
* called.
*)
function WantWrite: HRESULT; stdcall;
(************************************************************************
* Method:
* IRMATCPSocket::GetForeignAddress
* Purpose:
* Returns the address of the other end of the TCP socket as a
* ULONG32 in local host order
*)
function GetForeignAddress(var lAddress: ULONG32): HRESULT; stdcall;
function GetLocalAddress(var lAddress: ULONG32): HRESULT; stdcall;
(************************************************************************
* Method:
* IRMATCPSocket::GetForeignPort
* Purpose:
* Returns the port of the other end of the TCP socket in local
* host order.
*)
function GetForeignPort(var port: UINT16): HRESULT; stdcall;
function GetLocalPort(var port: UINT16): HRESULT; stdcall;
end;
{$EXTERNALSYM IRMATCPSocket}
(****************************************************************************
*
* Interface:
*
* IRMAListenResponse
*
* Purpose:
*
* This is the response interface for the asynchronous TCP listening
* socket interface.
*
* IID_IRMAListenResponse:
*
* {00000104-0901-11d1-8B06-00A024406D59}
*
*)
const
IID_IRMAListenResponse: TGUID = '{00000104-0901-11d1-8B06-00A024406D59}';
{$EXTERNALSYM IID_IRMAListenResponse}
type
IRMAListenResponse = interface (IUnknown)
['{00000104-0901-11d1-8B06-00A024406D59}']
function NewConnection(status: PN_RESULT; pTCPSocket: IRMATCPSocket): HRESULT; stdcall;
end;
{$EXTERNALSYM IRMAListenResponse}
(****************************************************************************
*
* Interface:
*
* IRMAListenSocket
*
* Purpose:
*
* This interfaces allows you to asynchronously listen on a port for
* TCP connections.
*
* IID_IRMAListenSocket:
*
* {00000105-0901-11d1-8B06-00A024406D59}
*
*)
const
IID_IRMAListenSocket: TGUID = '{00000105-0901-11d1-8B06-00A024406D59}';
{$EXTERNALSYM IID_IRMAListenSocket}
type
IRMAListenSocket = interface (IUnknown)
['{00000105-0901-11d1-8B06-00A024406D59}']
function Init(ulLocalAddr: UINT32; port: UINT16; pListenResponse: IRMAListenResponse): HRESULT; stdcall;
end;
{$EXTERNALSYM IRMAListenSocket}
(****************************************************************************
*
* Interface:
*
* IRMAUDPResponse
*
* Purpose:
*
* This is the response interface for the asynchronous UDP networking
* interface.
*
* IID_IRMAUDPResponse:
*
* {00000107-0901-11d1-8B06-00A024406D59}
*
*)
const
IID_IRMAUDPResponse: TGUID = '{00000107-0901-11d1-8B06-00A024406D59}';
{$EXTERNALSYM IID_IRMAUDPResponse}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -