📄 hxengin.h
字号:
/* ***** BEGIN LICENSE BLOCK *****
* Version: RCSL 1.0/RPSL 1.0
*
* Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
*
* The contents of this file, and the files included with this file, are
* subject to the current version of the RealNetworks Public Source License
* Version 1.0 (the "RPSL") available at
* http://www.helixcommunity.org/content/rpsl unless you have licensed
* the file under the RealNetworks Community Source License Version 1.0
* (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
* in which case the RCSL will apply. You may also obtain the license terms
* directly from RealNetworks. You may not use this file except in
* compliance with the RPSL or, if you have a valid RCSL with RealNetworks
* applicable to this file, the RCSL. Please see the applicable RPSL or
* RCSL for the rights, obligations and limitations governing use of the
* contents of the file.
*
* This file is part of the Helix DNA Technology. RealNetworks is the
* developer of the Original Code and owns the copyrights in the portions
* it created.
*
* This file, and the files included with this file, is distributed and made
* available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
*
* Technology Compatibility Kit Test Suite(s) Location:
* http://www.helixcommunity.org/content/tck
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** */
#ifndef _HXENGIN_H_
#define _HXENGIN_H_
#include "hxcom.h"
/*
* Forward declarations of some interfaces used here-in.
*/
typedef _INTERFACE IHXBuffer IHXBuffer;
typedef _INTERFACE IHXCallback IHXCallback;
typedef _INTERFACE IHXScheduler IHXScheduler;
typedef _INTERFACE IHXTCPResponse IHXTCPResponse;
typedef _INTERFACE IHXLBoundTCPSocket IHXLBoundTCPSocket;
typedef _INTERFACE IHXTCPSocket IHXTCPSocket;
typedef _INTERFACE IHXListenResponse IHXListenResponse;
typedef _INTERFACE IHXListenSocket IHXListenSocket;
typedef _INTERFACE IHXNetworkServices IHXNetworkServices;
typedef _INTERFACE IHXNetworkServices2 IHXNetworkServices2;
typedef _INTERFACE IHXUDPResponse IHXUDPResponse;
typedef _INTERFACE IHXUDPSocket IHXUDPSocket;
typedef _INTERFACE IHXResolver IHXResolver;
typedef _INTERFACE IHXResolverResponse IHXResolverResponse;
typedef _INTERFACE IHXInterruptSafe IHXInterruptSafe;
typedef _INTERFACE IHXAsyncIOSelection IHXAsyncIOSelection;
typedef _INTERFACE IHXUDPMulticastInit IHXUDPMulticastInit;
typedef _INTERFACE IHXInterruptState IHXInterruptState;
typedef _INTERFACE IHXOptimizedScheduler IHXOptimizedScheduler;
// $Private:
typedef _INTERFACE IHXThreadSafeScheduler IHXThreadSafeScheduler;
typedef _INTERFACE IHXBufferedSocket IHXBufferedSocket;
typedef _INTERFACE IHXNetInterfaces IHXNetInterfaces;
typedef _INTERFACE IHXNetInterfacesAdviseSink IHXNetInterfacesAdviseSink;
// $EndPrivate.
typedef _INTERFACE IHXNetworkInterfaceEnumerator IHXNetworkInterfaceEnumerator;
typedef _INTERFACE IHXUDPConnectedSocket IHXUDPConnectedSocket;
/*
* Address flags starting with PNR are depricated.
*/
#define HXR_INADDR_ANY (UINT32)0x00000000 //THIS FLAG IS DEPRICATED
#define HX_INADDR_ANY (UINT32)0x00000000
/*
* 255.255.255.254
*
* Bind to all ports in IPBindings list from
* server config.
*/
#define HXR_INADDR_IPBINDINGS (UINT32)0xfffffffe //THIS FLAG IS DEPRICATED
#define HX_INADDR_IPBINDINGS (UINT32)0xfffffffe
/* Async IO Selection Type (Unix Only) */
#define PNAIO_READ 1
#define PNAIO_WRITE 2
#define PNAIO_EXCEPTION 4
/****************************************************************************
*
* Interface:
*
* IHXCallback
*
* Purpose:
*
* This interface defines a simple callback which will be used in
* various interfaces such as IHXScheduler.
*
* IID_IHXCallback:
*
* {00000100-0901-11d1-8B06-00A024406D59}
*
*/
DEFINE_GUID(IID_IHXCallback, 0x00000100, 0x901, 0x11d1, 0x8b, 0x6, 0x0,
0xa0, 0x24, 0x40, 0x6d, 0x59);
#undef INTERFACE
#define INTERFACE IHXCallback
DECLARE_INTERFACE_(IHXCallback, IUnknown)
{
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj) PURE;
STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
STDMETHOD_(ULONG32,Release) (THIS) PURE;
/*
* IHXCallback methods
*/
/************************************************************************
* Method:
* IHXCallback::Func
* Purpose:
* This is the function that will be called when a callback is
* to be executed.
*/
STDMETHOD(Func) (THIS) PURE;
};
/****************************************************************************
*
* Interface:
*
* IHXScheduler
*
* Purpose:
*
* This interface provides the user with a way of scheduling callbacks
* that will be executed at some time in the future.
*
* IID_IHXScheduler:
*
* {00000101-0901-11d1-8B06-00A024406D59}
*
*/
DEFINE_GUID(IID_IHXScheduler, 0x00000101, 0x901, 0x11d1, 0x8b, 0x6, 0x0,
0xa0, 0x24, 0x40, 0x6d, 0x59);
#undef INTERFACE
#define INTERFACE IHXScheduler
typedef ULONG32 CallbackHandle;
typedef struct _HXTimeval
{
UINT32 tv_sec;
UINT32 tv_usec;
} HXTimeval;
DECLARE_INTERFACE_(IHXScheduler, IUnknown)
{
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj) PURE;
STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
STDMETHOD_(ULONG32,Release) (THIS) PURE;
/*
* IHXScheduler methods
*/
/************************************************************************
* Method:
* IHXScheduler::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.
*/
STDMETHOD_(CallbackHandle,RelativeEnter) (THIS_
IHXCallback* pCallback,
UINT32 ms) PURE;
/************************************************************************
* Method:
* IHXScheduler::AbsoluteEnter
* Purpose:
* Schedule a callback to be executed at time "tVal".
*/
STDMETHOD_(CallbackHandle,AbsoluteEnter) (THIS_
IHXCallback* pCallback,
HXTimeval tVal) PURE;
/************************************************************************
* Method:
* IHXScheduler::Remove
* Purpose:
* Remove a callback from the scheduler.
*/
STDMETHOD(Remove) (THIS_
CallbackHandle Handle) PURE;
/************************************************************************
* Method:
* IHXScheduler::GetCurrentSchedulerTime
* Purpose:
* Gives the current time (in the timeline of the scheduler).
*/
STDMETHOD_(HXTimeval,GetCurrentSchedulerTime) (THIS) PURE;
};
/****************************************************************************
*
* Interface:
*
* IHXTCPResponse
*
* Purpose:
*
* This is the response interface for the asynchronous TCP networking
* interface.
*
* IID_IHXTCPResponse:
*
* {00000102-0901-11d1-8B06-00A024406D59}
*
*/
DEFINE_GUID(IID_IHXTCPResponse, 0x00000102, 0x901, 0x11d1, 0x8b, 0x6, 0x0,
0xa0, 0x24, 0x40, 0x6d, 0x59);
#undef INTERFACE
#define INTERFACE IHXTCPResponse
DECLARE_INTERFACE_(IHXTCPResponse, IUnknown)
{
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj) PURE;
STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
STDMETHOD_(ULONG32,Release) (THIS) PURE;
/*
* IHXTCPResponse methods
*/
/************************************************************************
* Method:
* IHXTCPResponse::ConnectDone
* Purpose:
* A Connect operation has been completed or an error has occurred.
*/
STDMETHOD(ConnectDone) (THIS_
HX_RESULT status) PURE;
/************************************************************************
* Method:
* IHXTCPResponse::ReadDone
* Purpose:
* A Read operation has been completed or an error has occurred.
* The data is returned in the IHXBuffer.
*/
STDMETHOD(ReadDone) (THIS_
HX_RESULT status,
IHXBuffer* pBuffer) PURE;
/************************************************************************
* Method:
* IHXTCPResponse::WriteReady
* Purpose:
* This is the response method for WantWrite.
* If HX_RESULT is ok, then the TCP channel is ok to Write to.
*/
STDMETHOD(WriteReady) (THIS_
HX_RESULT status) PURE;
/************************************************************************
* Method:
* IHXTCPResponse::Closed
* Purpose:
* This method is called to inform you that the TCP channel has
* been closed by the peer or closed due to error.
*/
STDMETHOD(Closed) (THIS_
HX_RESULT status) PURE;
};
/****************************************************************************
*
* Interface:
*
* IHXTCPSocket
*
* Purpose:
*
* Provides the user with an asynchronous TCP networking interface.
*
* IID_IHXTCPSocket:
*
* {00000103-0901-11d1-8B06-00A024406D59}
*
*/
DEFINE_GUID(IID_IHXTCPSocket, 0x00000103, 0x901, 0x11d1, 0x8b, 0x6, 0x0,
0xa0, 0x24, 0x40, 0x6d, 0x59);
#undef INTERFACE
#define INTERFACE IHXTCPSocket
DECLARE_INTERFACE_(IHXTCPSocket, IUnknown)
{
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj) PURE;
STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
STDMETHOD_(ULONG32,Release) (THIS) PURE;
/*
* IHXTCPSocket methods
*
* Network addresses and ports are in native byte order
*
*/
STDMETHOD(Init) (THIS_
IHXTCPResponse* /*IN*/ pTCPResponse) PURE;
STDMETHOD(SetResponse) (THIS_
IHXTCPResponse* pTCPResponse) PURE;
STDMETHOD(Bind) (THIS_
UINT32 ulLocalAddr,
UINT16 nPort) PURE;
/*
* pDestination is a string containing host name or dotted-ip notation
*/
STDMETHOD(Connect) (THIS_
const char* pDestination,
UINT16 nPort) PURE;
STDMETHOD(Read) (THIS_
UINT16 Size) PURE;
STDMETHOD(Write) (THIS_
IHXBuffer* pBuffer) PURE;
/************************************************************************
* Method:
* IHXTCPSocket::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.
*/
STDMETHOD(WantWrite) (THIS) PURE;
/************************************************************************
* Method:
* IHXTCPSocket::GetForeignAddress
* Purpose:
* Returns the address of the other end of the TCP socket as a
* ULONG32 in local host order
*/
STDMETHOD(GetForeignAddress) (THIS_
REF(ULONG32) lAddress) PURE;
STDMETHOD(GetLocalAddress) (THIS_
REF(ULONG32) lAddress) PURE;
/************************************************************************
* Method:
* IHXTCPSocket::GetForeignPort
* Purpose:
* Returns the port of the other end of the TCP socket in local
* host order.
*/
STDMETHOD(GetForeignPort) (THIS_
REF(UINT16) port) PURE;
STDMETHOD(GetLocalPort) (THIS_
REF(UINT16) port) PURE;
};
// $Private:
/****************************************************************************
*
* Interface:
*
* IHXTCPSecureSocket
*
* Purpose:
*
* When an IHXTCPSocket also supports this interface,
* it allows you to say it's secure so it tries to use
* SSL.
*
*/
DEFINE_GUID(IID_IHXTCPSecureSocket, 0x00000203, 0x911, 0x21d1, 0x8c, 0x4, 0x0,
0xa0, 0x24, 0x40, 0x6d, 0x54);
#undef INTERFACE
#define INTERFACE IHXTCPSecureSocket
DECLARE_INTERFACE_(IHXTCPSecureSocket, IUnknown)
{
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj) PURE;
STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
STDMETHOD_(ULONG32,Release) (THIS) PURE;
/*
* IHXTCPSecureSocket method
*/
STDMETHOD(SetSecure) (THIS_
BOOL bSecure) PURE;
};
// $EndPrivate.
// $Private:
/****************************************************************************
*
* Interface:
*
* IHXSSL
*
* Purpose:
*
* This is the interface to an SSL library.
*
*/
DEFINE_GUID(IID_IHXSSL, 0x34e171d4, 0xa8f0,
0x4832, 0xbc, 0x7d, 0x06, 0xdf, 0xe3, 0xae, 0x58, 0xfd);
DECLARE_INTERFACE_(IHXSSL, IUnknown)
{
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj) PURE;
STDMETHOD_(ULONG32, AddRef) (THIS) PURE;
STDMETHOD_(ULONG32, Release) (THIS) PURE;
/*
*
*/
STDMETHOD(Initialize) (THIS) PURE;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -