hxengin.h
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:64k
源码类别:

Symbian

开发平台:

C/C++

  1. /* ***** BEGIN LICENSE BLOCK ***** 
  2.  * Version: RCSL 1.0/RPSL 1.0 
  3.  *  
  4.  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  5.  *      
  6.  * The contents of this file, and the files included with this file, are 
  7.  * subject to the current version of the RealNetworks Public Source License 
  8.  * Version 1.0 (the "RPSL") available at 
  9.  * http://www.helixcommunity.org/content/rpsl unless you have licensed 
  10.  * the file under the RealNetworks Community Source License Version 1.0 
  11.  * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
  12.  * in which case the RCSL will apply. You may also obtain the license terms 
  13.  * directly from RealNetworks.  You may not use this file except in 
  14.  * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
  15.  * applicable to this file, the RCSL.  Please see the applicable RPSL or 
  16.  * RCSL for the rights, obligations and limitations governing use of the 
  17.  * contents of the file.  
  18.  *  
  19.  * This file is part of the Helix DNA Technology. RealNetworks is the 
  20.  * developer of the Original Code and owns the copyrights in the portions 
  21.  * it created. 
  22.  *  
  23.  * This file, and the files included with this file, is distributed and made 
  24.  * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
  25.  * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
  26.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
  27.  * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
  28.  * 
  29.  * Technology Compatibility Kit Test Suite(s) Location: 
  30.  *    http://www.helixcommunity.org/content/tck 
  31.  * 
  32.  * Contributor(s): 
  33.  *  
  34.  * ***** END LICENSE BLOCK ***** */ 
  35. #ifndef _HXENGIN_H_
  36. #define _HXENGIN_H_
  37. #include "hxcom.h"
  38. /*
  39.  * Forward declarations of some interfaces used here-in.
  40.  */
  41. typedef _INTERFACE IHXBuffer IHXBuffer;
  42. typedef _INTERFACE IHXCallback IHXCallback;
  43. typedef _INTERFACE IHXScheduler IHXScheduler;
  44. typedef _INTERFACE IHXTCPResponse IHXTCPResponse;
  45. typedef _INTERFACE IHXLBoundTCPSocket IHXLBoundTCPSocket;
  46. typedef _INTERFACE IHXTCPSocket IHXTCPSocket;
  47. typedef _INTERFACE IHXListenResponse IHXListenResponse;
  48. typedef _INTERFACE IHXListenSocket IHXListenSocket;
  49. typedef _INTERFACE IHXNetworkServices IHXNetworkServices;
  50. typedef _INTERFACE IHXNetworkServices2 IHXNetworkServices2;
  51. typedef _INTERFACE IHXUDPResponse      IHXUDPResponse;
  52. typedef _INTERFACE IHXUDPSocket IHXUDPSocket;
  53. typedef _INTERFACE IHXResolver IHXResolver;
  54. typedef _INTERFACE IHXResolverResponse IHXResolverResponse;
  55. typedef _INTERFACE IHXInterruptSafe IHXInterruptSafe;
  56. typedef _INTERFACE IHXAsyncIOSelection IHXAsyncIOSelection;
  57. typedef _INTERFACE IHXUDPMulticastInit IHXUDPMulticastInit;
  58. typedef _INTERFACE IHXInterruptState IHXInterruptState;
  59. typedef _INTERFACE IHXOptimizedScheduler IHXOptimizedScheduler;
  60. // $Private:
  61. typedef _INTERFACE IHXThreadSafeScheduler IHXThreadSafeScheduler;
  62. typedef _INTERFACE IHXBufferedSocket IHXBufferedSocket;
  63. typedef _INTERFACE IHXNetInterfaces IHXNetInterfaces;
  64. typedef _INTERFACE IHXNetInterfacesAdviseSink IHXNetInterfacesAdviseSink;
  65. // $EndPrivate.
  66. typedef _INTERFACE IHXNetworkInterfaceEnumerator IHXNetworkInterfaceEnumerator;
  67. typedef _INTERFACE IHXUDPConnectedSocket           IHXUDPConnectedSocket;
  68. /*
  69.  * Address flags starting with PNR are depricated.
  70.  */
  71. #define HXR_INADDR_ANY (UINT32)0x00000000  //THIS FLAG IS DEPRICATED
  72. #define HX_INADDR_ANY (UINT32)0x00000000
  73. /*
  74.  * 255.255.255.254
  75.  *
  76.  * Bind to all ports in IPBindings list from
  77.  * server config.
  78.  */
  79. #define HXR_INADDR_IPBINDINGS (UINT32)0xfffffffe    //THIS FLAG IS DEPRICATED
  80. #define HX_INADDR_IPBINDINGS (UINT32)0xfffffffe
  81. /* Async IO Selection Type (Unix Only) */
  82. #define PNAIO_READ 1
  83. #define PNAIO_WRITE 2
  84. #define PNAIO_EXCEPTION 4
  85. /****************************************************************************
  86.  * 
  87.  *  Interface:
  88.  * 
  89.  * IHXCallback
  90.  * 
  91.  *  Purpose:
  92.  * 
  93.  * This interface defines a simple callback which will be used in
  94.  * various interfaces such as IHXScheduler.
  95.  * 
  96.  *  IID_IHXCallback:
  97.  * 
  98.  * {00000100-0901-11d1-8B06-00A024406D59}
  99.  * 
  100.  */
  101. DEFINE_GUID(IID_IHXCallback, 0x00000100, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  102. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  103. #undef  INTERFACE
  104. #define INTERFACE   IHXCallback
  105. DECLARE_INTERFACE_(IHXCallback, IUnknown)
  106. {
  107.     /*
  108.      *  IUnknown methods
  109.      */
  110.     STDMETHOD(QueryInterface) (THIS_
  111. REFIID riid,
  112. void** ppvObj) PURE;
  113.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  114.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  115.     /*
  116.      *  IHXCallback methods
  117.      */
  118.     /************************************************************************
  119.      * Method:
  120.      *     IHXCallback::Func
  121.      * Purpose:
  122.      *     This is the function that will be called when a callback is
  123.      *     to be executed.
  124.      */
  125.     STDMETHOD(Func) (THIS) PURE;
  126. };
  127. /****************************************************************************
  128.  * 
  129.  *  Interface:
  130.  * 
  131.  * IHXScheduler
  132.  * 
  133.  *  Purpose:
  134.  * 
  135.  * This interface provides the user with a way of scheduling callbacks
  136.  * that will be executed at some time in the future.
  137.  * 
  138.  *  IID_IHXScheduler:
  139.  * 
  140.  * {00000101-0901-11d1-8B06-00A024406D59}
  141.  * 
  142.  */
  143. DEFINE_GUID(IID_IHXScheduler, 0x00000101, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  144. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  145. #undef  INTERFACE
  146. #define INTERFACE   IHXScheduler
  147. typedef ULONG32 CallbackHandle;
  148. typedef struct _HXTimeval
  149. {
  150.     UINT32 tv_sec;
  151.     UINT32 tv_usec;
  152. } HXTimeval;
  153. DECLARE_INTERFACE_(IHXScheduler, IUnknown)
  154. {
  155.     /*
  156.      *  IUnknown methods
  157.      */
  158.     STDMETHOD(QueryInterface) (THIS_
  159. REFIID riid,
  160. void** ppvObj) PURE;
  161.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  162.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  163.     /*
  164.      * IHXScheduler methods
  165.      */
  166.     /************************************************************************
  167.      * Method:
  168.      *     IHXScheduler::RelativeEnter
  169.      * Purpose:
  170.      *     Schedule a callback to be executed "ms" milliseconds from now
  171.      *     This function is less percise then AbsoluteEnter and should only
  172.      *     be used when accurate timing is not critical.
  173.      */
  174.     STDMETHOD_(CallbackHandle,RelativeEnter) (THIS_
  175. IHXCallback* pCallback,
  176. UINT32 ms) PURE;
  177.     /************************************************************************
  178.      * Method:
  179.      *     IHXScheduler::AbsoluteEnter
  180.      * Purpose:
  181.      *     Schedule a callback to be executed at time "tVal".
  182.      */
  183.     STDMETHOD_(CallbackHandle,AbsoluteEnter) (THIS_
  184. IHXCallback* pCallback,
  185. HXTimeval tVal) PURE;
  186.     /************************************************************************
  187.      * Method:
  188.      *     IHXScheduler::Remove
  189.      * Purpose:
  190.      *     Remove a callback from the scheduler.
  191.      */
  192.     STDMETHOD(Remove) (THIS_
  193.      CallbackHandle Handle) PURE;
  194.     /************************************************************************
  195.      * Method:
  196.      *     IHXScheduler::GetCurrentSchedulerTime
  197.      * Purpose:
  198.      *     Gives the current time (in the timeline of the scheduler).
  199.      */
  200.     STDMETHOD_(HXTimeval,GetCurrentSchedulerTime) (THIS) PURE;
  201. };
  202. /****************************************************************************
  203.  * 
  204.  *  Interface:
  205.  * 
  206.  * IHXTCPResponse
  207.  * 
  208.  *  Purpose:
  209.  * 
  210.  * This is the response interface for the asynchronous TCP networking 
  211.  * interface.
  212.  * 
  213.  *  IID_IHXTCPResponse:
  214.  * 
  215.  * {00000102-0901-11d1-8B06-00A024406D59}
  216.  * 
  217.  */
  218. DEFINE_GUID(IID_IHXTCPResponse, 0x00000102, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  219. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  220. #undef  INTERFACE
  221. #define INTERFACE   IHXTCPResponse
  222. DECLARE_INTERFACE_(IHXTCPResponse, IUnknown)
  223. {
  224.     /*
  225.      *  IUnknown methods
  226.      */
  227.     STDMETHOD(QueryInterface) (THIS_
  228. REFIID riid,
  229. void** ppvObj) PURE;
  230.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  231.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  232.     /*
  233.      * IHXTCPResponse methods
  234.      */
  235.     /************************************************************************
  236.      * Method:
  237.      *     IHXTCPResponse::ConnectDone
  238.      * Purpose:
  239.      *     A Connect operation has been completed or an error has occurred.
  240.      */
  241.     STDMETHOD(ConnectDone) (THIS_
  242. HX_RESULT status) PURE;
  243.     /************************************************************************
  244.      * Method:
  245.      *     IHXTCPResponse::ReadDone
  246.      * Purpose:
  247.      *     A Read operation has been completed or an error has occurred.
  248.      *     The data is returned in the IHXBuffer.
  249.      */
  250.     STDMETHOD(ReadDone) (THIS_
  251. HX_RESULT status,
  252. IHXBuffer* pBuffer) PURE;
  253.     /************************************************************************
  254.      * Method:
  255.      *     IHXTCPResponse::WriteReady
  256.      * Purpose:
  257.      *     This is the response method for WantWrite.
  258.      *     If HX_RESULT is ok, then the TCP channel is ok to Write to.
  259.      */
  260.     STDMETHOD(WriteReady) (THIS_
  261.      HX_RESULT status) PURE;
  262.     /************************************************************************
  263.      * Method:
  264.      *     IHXTCPResponse::Closed
  265.      * Purpose:
  266.      *     This method is called to inform you that the TCP channel has
  267.      *     been closed by the peer or closed due to error.
  268.      */
  269.     STDMETHOD(Closed) (THIS_
  270. HX_RESULT status) PURE;
  271. };
  272. /****************************************************************************
  273.  * 
  274.  *  Interface:
  275.  * 
  276.  * IHXTCPSocket
  277.  * 
  278.  *  Purpose:
  279.  * 
  280.  * Provides the user with an asynchronous TCP networking interface.
  281.  * 
  282.  *  IID_IHXTCPSocket:
  283.  * 
  284.  * {00000103-0901-11d1-8B06-00A024406D59}
  285.  * 
  286.  */
  287. DEFINE_GUID(IID_IHXTCPSocket, 0x00000103, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  288. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  289. #undef  INTERFACE
  290. #define INTERFACE   IHXTCPSocket
  291. DECLARE_INTERFACE_(IHXTCPSocket, IUnknown)
  292. {
  293.     /*
  294.      *  IUnknown methods
  295.      */
  296.     STDMETHOD(QueryInterface) (THIS_
  297. REFIID riid,
  298. void** ppvObj) PURE;
  299.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  300.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  301.     /*
  302.      * IHXTCPSocket methods
  303.      *
  304.      *  Network addresses and ports are in native byte order
  305.      *  
  306.      */
  307.     STDMETHOD(Init) (THIS_
  308. IHXTCPResponse*    /*IN*/  pTCPResponse) PURE;
  309.     STDMETHOD(SetResponse) (THIS_
  310.      IHXTCPResponse*     pTCPResponse) PURE;
  311.     STDMETHOD(Bind) (THIS_
  312. UINT32     ulLocalAddr,
  313. UINT16      nPort) PURE;
  314.     /*
  315.      * pDestination is a string containing host name or dotted-ip notation
  316.      */
  317.     STDMETHOD(Connect) (THIS_
  318. const char*     pDestination,
  319. UINT16      nPort) PURE;
  320.     STDMETHOD(Read) (THIS_
  321. UINT16     Size) PURE;
  322.     STDMETHOD(Write) (THIS_
  323. IHXBuffer*     pBuffer) PURE;
  324.     /************************************************************************
  325.      * Method:
  326.      *     IHXTCPSocket::WantWrite
  327.      * Purpose:
  328.      *     This method is called when you wish to write a large amount of
  329.      *     data.  If you are only writing small amounts of data, you can
  330.      *     just call Write (all data not ready to be transmitted will be
  331.      *     buffered on your behalf).  When the TCP channel is ready to be
  332.      *     written to, the response interfaces WriteReady method will be 
  333.      *     called.
  334.      */
  335.     STDMETHOD(WantWrite) (THIS) PURE;
  336.     /************************************************************************
  337.      * Method:
  338.      *     IHXTCPSocket::GetForeignAddress
  339.      * Purpose:
  340.      *     Returns the address of the other end of the TCP socket as a
  341.      *     ULONG32 in local host order
  342.      */
  343.     STDMETHOD(GetForeignAddress) (THIS_
  344.      REF(ULONG32) lAddress) PURE;
  345.     STDMETHOD(GetLocalAddress) (THIS_
  346.      REF(ULONG32) lAddress) PURE;
  347.     /************************************************************************
  348.      * Method:
  349.      *     IHXTCPSocket::GetForeignPort
  350.      * Purpose:
  351.      *     Returns the port of the other end of the TCP socket in local
  352.      *      host order.
  353.      */
  354.     STDMETHOD(GetForeignPort) (THIS_
  355.      REF(UINT16) port) PURE;
  356.     STDMETHOD(GetLocalPort) (THIS_
  357.      REF(UINT16) port) PURE;
  358. };
  359. // $Private:
  360. /****************************************************************************
  361.  * 
  362.  *  Interface:
  363.  * 
  364.  * IHXTCPSecureSocket
  365.  * 
  366.  *  Purpose:
  367.  * 
  368.  * When an IHXTCPSocket also supports this interface,
  369.  * it allows you to say it's secure so it tries to use
  370.  * SSL.
  371.  * 
  372.  */
  373. DEFINE_GUID(IID_IHXTCPSecureSocket, 0x00000203, 0x911, 0x21d1, 0x8c, 0x4, 0x0, 
  374. 0xa0, 0x24, 0x40, 0x6d, 0x54);
  375. #undef  INTERFACE
  376. #define INTERFACE   IHXTCPSecureSocket
  377. DECLARE_INTERFACE_(IHXTCPSecureSocket, IUnknown)
  378. {
  379.     /*
  380.      *  IUnknown methods
  381.      */
  382.     STDMETHOD(QueryInterface) (THIS_
  383. REFIID riid,
  384. void** ppvObj) PURE;
  385.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  386.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  387.     /*
  388.      *  IHXTCPSecureSocket method
  389.      */
  390.     STDMETHOD(SetSecure) (THIS_
  391.      BOOL bSecure) PURE;
  392. };
  393. // $EndPrivate.
  394. // $Private:
  395. /****************************************************************************
  396.  * 
  397.  *  Interface:
  398.  * 
  399.  * IHXSSL
  400.  * 
  401.  *  Purpose:
  402.  * 
  403.  * This is the interface to an SSL library.
  404.  * 
  405.  */
  406. DEFINE_GUID(IID_IHXSSL, 0x34e171d4, 0xa8f0,
  407.            0x4832, 0xbc, 0x7d, 0x06, 0xdf, 0xe3, 0xae, 0x58, 0xfd);
  408. DECLARE_INTERFACE_(IHXSSL, IUnknown)
  409. {
  410. /*
  411.  * IUnknown methods
  412.  */
  413. STDMETHOD(QueryInterface) (THIS_
  414. REFIID riid,
  415. void** ppvObj) PURE;
  416. STDMETHOD_(ULONG32, AddRef) (THIS) PURE;
  417. STDMETHOD_(ULONG32, Release) (THIS) PURE;
  418. /*
  419.  *
  420.  */
  421. STDMETHOD(Initialize) (THIS) PURE;
  422. STDMETHOD(Shutdown) (THIS) PURE;
  423. STDMETHOD(PostConnect) (THIS_
  424. LONG32 nSocketNumber) PURE;
  425. STDMETHOD_(LONG32, Read) (THIS_
  426. LONG32 nSocketNumber,
  427. void* buff,
  428. LONG32 buffLen) PURE;
  429. STDMETHOD_(LONG32, Write) (THIS_
  430. LONG32 nSocketNumber,
  431. void* buff,
  432. LONG32 buffLen) PURE;
  433. STDMETHOD(Close) (THIS_
  434. LONG32 nSocketNumber) PURE;
  435. STDMETHOD(SetCallbacks) (THIS_
  436. void* readCallback,
  437. void* writeCallback,
  438. void* closeCallback) PURE;
  439. };
  440. // $EndPrivate.
  441. // $Private:
  442. /****************************************************************************
  443.  * 
  444.  *  Interface:
  445.  * 
  446.  * IHXBufferedSocket
  447.  * 
  448.  *  Purpose:
  449.  * 
  450.  * This provdies a method for doing for doing more optimal
  451.  *      TCP delivery using desired packet size and writev.  
  452.  * 
  453.  *  IID_IHXTCPSocket:
  454.  * 
  455.  * {00001402-0901-11d1-8B06-00A024406D59}
  456.  * 
  457.  */
  458. DEFINE_GUID(IID_IHXBufferedSocket, 
  459.     0x00001402, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);
  460. #undef  INTERFACE
  461. #define INTERFACE   IHXBufferedSocket
  462. DECLARE_INTERFACE_(IHXBufferedSocket, IUnknown)
  463. {
  464.     /*
  465.      *  IUnknown methods
  466.      */
  467.     STDMETHOD(QueryInterface) (THIS_
  468. REFIID riid,
  469. void** ppvObj) PURE;
  470.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  471.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  472.     /*
  473.      * IHXTCPSocket methods
  474.      */
  475.     STDMETHOD(BufferedWrite) (THIS_
  476. IHXBuffer* pBuffer) PURE;
  477.     STDMETHOD(FlushWrite) (THIS) PURE;
  478.     STDMETHOD(SetDesiredPacketSize)     (THIS_
  479. UINT32 ulPacketSize) PURE;
  480. };
  481. // $EndPrivate.
  482. /****************************************************************************
  483.  * 
  484.  *  Interface:
  485.  * 
  486.  * IHXListenResponse
  487.  * 
  488.  *  Purpose:
  489.  * 
  490.  * This is the response interface for the asynchronous TCP listening
  491.  * socket interface.
  492.  * 
  493.  *  IID_IHXListenResponse:
  494.  * 
  495.  * {00000104-0901-11d1-8B06-00A024406D59}
  496.  * 
  497.  */
  498. DEFINE_GUID(IID_IHXListenResponse, 0x00000104, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  499. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  500. #undef  INTERFACE
  501. #define INTERFACE   IHXListenResponse
  502. DECLARE_INTERFACE_(IHXListenResponse, IUnknown)
  503. {
  504.     /*
  505.      *  IUnknown methods
  506.      */
  507.     STDMETHOD(QueryInterface) (THIS_
  508. REFIID riid,
  509. void** ppvObj) PURE;
  510.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  511.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  512.     /*
  513.      * IHXListenResponse methods
  514.      */
  515.     STDMETHOD(NewConnection) (THIS_
  516. HX_RESULT status,
  517. IHXTCPSocket* pTCPSocket) PURE;
  518. };
  519. /****************************************************************************
  520.  * 
  521.  *  Interface:
  522.  * 
  523.  * IHXListenSocket
  524.  * 
  525.  *  Purpose:
  526.  * 
  527.  * This interfaces allows you to asynchronously listen on a port for
  528.  * TCP connections.
  529.  * 
  530.  *  IID_IHXListenSocket:
  531.  * 
  532.  * {00000105-0901-11d1-8B06-00A024406D59}
  533.  * 
  534.  */
  535. DEFINE_GUID(IID_IHXListenSocket, 0x00000105, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  536. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  537. #undef  INTERFACE
  538. #define INTERFACE   IHXListenSocket
  539. DECLARE_INTERFACE_(IHXListenSocket, IUnknown)
  540. {
  541.     /*
  542.      *  IUnknown methods
  543.      */
  544.     STDMETHOD(QueryInterface) (THIS_
  545. REFIID riid,
  546. void** ppvObj) PURE;
  547.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  548.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  549.     /*
  550.      * IHXListenSocket methods
  551.      */
  552.     STDMETHOD(Init) (THIS_
  553. UINT32 ulLocalAddr,
  554. UINT16 port,
  555. IHXListenResponse*    /*IN*/ pListenResponse
  556. ) PURE;
  557. };
  558. /****************************************************************************
  559.  * 
  560.  *  Interface:
  561.  * 
  562.  * IHXNetworkServices
  563.  * 
  564.  *  Purpose:
  565.  * 
  566.  * This is a factory interface for the various types of networking
  567.  * interfaces described above.
  568.  * 
  569.  *  IID_IHXNetworkServices:
  570.  * 
  571.  * {00000106-0901-11d1-8B06-00A024406D59}
  572.  * 
  573.  */
  574. DEFINE_GUID(IID_IHXNetworkServices, 0x00000106, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  575. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  576. #undef  INTERFACE
  577. #define INTERFACE   IHXNetworkServices
  578. DECLARE_INTERFACE_(IHXNetworkServices, IUnknown)
  579. {
  580.     /*
  581.      *  IUnknown methods
  582.      */
  583.     STDMETHOD(QueryInterface) (THIS_
  584. REFIID riid,
  585. void** ppvObj) PURE;
  586.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  587.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  588.     /*
  589.      * IHXNetworkServices methods
  590.      */
  591.     /************************************************************************
  592.      * Method:
  593.      *     IHXNetworkServices::CreateTCPSocket
  594.      * Purpose:
  595.      *     Create a new TCP socket.
  596.      */
  597.     STDMETHOD(CreateTCPSocket) (THIS_
  598. IHXTCPSocket**    /*OUT*/  ppTCPSocket) PURE;
  599.     /************************************************************************
  600.      * Method:
  601.      *     IHXNetworkServices::CreateUDPSocket
  602.      * Purpose:
  603.      *     Create a new UDP socket.
  604.      */
  605.     STDMETHOD(CreateUDPSocket) (THIS_
  606. IHXUDPSocket**    /*OUT*/  ppUDPSocket) PURE;
  607.     /************************************************************************
  608.      * Method:
  609.      *     IHXNetworkServices::CreateListenSocket
  610.      * Purpose:
  611.      *     Create a new TCP socket that will listen for connections on a
  612.      *     particular port.
  613.      */
  614.     STDMETHOD(CreateListenSocket)   (THIS_
  615.     IHXListenSocket** /*OUT*/ ppListenSocket
  616.     ) PURE;
  617.     /************************************************************************
  618.      * Method:
  619.      *     IHXNetworkServices::CreateResolver
  620.      * Purpose:
  621.      *     Create a new resolver that can lookup host names
  622.      */
  623.     STDMETHOD(CreateResolver)   (THIS_
  624.      IHXResolver**    /*OUT*/     ppResolver) PURE;
  625. };
  626. /****************************************************************************
  627.  * 
  628.  *  Interface:
  629.  * 
  630.  * IHXNetworkServices2
  631.  * 
  632.  *  Purpose:
  633.  * 
  634.  * This is a factory interface for the various types of networking
  635.  * interfaces described above.
  636.  * 
  637.  *  IID_IHXNetworkServices:
  638.  * 
  639.  * {17951551-5683-11d3-B6BA-00C0F031C237}
  640.  * 
  641.  */
  642. // {17951551-5683-11d3-B6BA-00C0F031C237}
  643. DEFINE_GUID(IID_IHXNetworkServices2, 0x17951551, 0x5683, 0x11d3, 0xb6, 0xba, 0x0, 0xc0, 0xf0, 0x31, 0xc2, 0x37);
  644. #undef  INTERFACE
  645. #define INTERFACE   IHXNetworkServices2
  646. DECLARE_INTERFACE_(IHXNetworkServices2, IHXNetworkServices)
  647. {
  648.     /************************************************************************
  649.      * Method:
  650.      *     IHXNetworkServices2::CreateLBoundTCPSocket
  651.      * Purpose:
  652.      *     Create a new local bound TCP socket.
  653.      */
  654.     STDMETHOD(CreateLBoundTCPSocket) (THIS_
  655. IHXTCPSocket**    /*OUT*/  ppTCPSocket) PURE;
  656. };
  657. /****************************************************************************
  658.  * 
  659.  *  Interface:
  660.  * 
  661.  * IHXUDPResponse
  662.  * 
  663.  *  Purpose:
  664.  * 
  665.  * This is the response interface for the asynchronous UDP networking 
  666.  * interface.
  667.  * 
  668.  *  IID_IHXUDPResponse:
  669.  * 
  670.  * {00000107-0901-11d1-8B06-00A024406D59}
  671.  * 
  672.  */
  673. DEFINE_GUID(IID_IHXUDPResponse, 0x00000107, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  674. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  675. #undef  INTERFACE
  676. #define INTERFACE   IHXUDPResponse
  677. DECLARE_INTERFACE_(IHXUDPResponse, IUnknown)
  678. {
  679.     /*
  680.      *  IUnknown methods
  681.      */
  682.     STDMETHOD(QueryInterface) (THIS_
  683. REFIID riid,
  684. void** ppvObj) PURE;
  685.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  686.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  687.     /*
  688.      * IHXUDPResponse methods
  689.      */
  690.     STDMETHOD(ReadDone) (THIS_
  691. HX_RESULT status,
  692. IHXBuffer* pBuffer,
  693. ULONG32 ulAddr,
  694. UINT16 nPort) PURE;
  695. };
  696. /****************************************************************************
  697.  * 
  698.  *  Interface:
  699.  * 
  700.  * IHXUDPSocket
  701.  * 
  702.  *  Purpose:
  703.  * 
  704.  * Provides the user with an asynchronous UDP networking interface.
  705.  * 
  706.  *  IID_IHXUDPSocket:
  707.  * 
  708.  * {00000108-0901-11d1-8B06-00A024406D59}
  709.  * 
  710.  */
  711. DEFINE_GUID(IID_IHXUDPSocket, 0x00000108, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  712. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  713. #undef  INTERFACE
  714. #define INTERFACE   IHXUDPSocket
  715. DECLARE_INTERFACE_(IHXUDPSocket, IUnknown)
  716. {
  717.     /*
  718.      *  IUnknown methods
  719.      */
  720.     STDMETHOD(QueryInterface) (THIS_
  721. REFIID riid,
  722. void** ppvObj) PURE;
  723.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  724.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  725.     /*
  726.      * IHXUDPSocket methods
  727.      *
  728.      *  Network addresses and ports are in native byte order
  729.      */
  730.     STDMETHOD(Init) (THIS_
  731. ULONG32 ulAddr,
  732. UINT16 nPort,
  733. IHXUDPResponse* pUDPResponse) PURE;
  734.     STDMETHOD(Bind) (THIS_
  735. UINT32     ulLocalAddr,
  736. UINT16      nPort) PURE;
  737.     STDMETHOD(Read) (THIS_
  738. UINT16 Size) PURE;
  739.     STDMETHOD(Write) (THIS_
  740. IHXBuffer* pBuffer) PURE;
  741.     STDMETHOD(WriteTo) (THIS_
  742.      ULONG32 ulAddr,
  743. UINT16 nPort,
  744. IHXBuffer* pBuffer) PURE;
  745.     STDMETHOD(GetLocalPort) (THIS_
  746.      REF(UINT16) port) PURE;
  747.     STDMETHOD(JoinMulticastGroup) (THIS_
  748.      ULONG32     ulMulticastAddr,
  749.      ULONG32     ulInterfaceAddr) PURE;
  750.     
  751.     STDMETHOD(LeaveMulticastGroup) (THIS_
  752.      ULONG32     ulMulticastAddr,
  753.      ULONG32     ulInterfaceAddr) PURE;
  754. };
  755. /****************************************************************************
  756.  * 
  757.  *  Interface:
  758.  * 
  759.  * IHXResolver
  760.  * 
  761.  *  Purpose:
  762.  * 
  763.  * This interface allows you to asynchronously resolve hostnames.
  764.  * 
  765.  *  IID_IHXResolver:
  766.  * 
  767.  * {00000109-0901-11d1-8B06-00A024406D59}
  768.  * 
  769.  */
  770. DEFINE_GUID(IID_IHXResolver, 0x00000109, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  771. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  772. #undef  INTERFACE
  773. #define INTERFACE   IHXResolver
  774. DECLARE_INTERFACE_(IHXResolver, IUnknown)
  775. {
  776.     /*
  777.      *  IUnknown methods
  778.      */
  779.     STDMETHOD(QueryInterface) (THIS_
  780. REFIID riid,
  781. void** ppvObj) PURE;
  782.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  783.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  784.     /*
  785.      * IHXResolver methods
  786.      */
  787.     STDMETHOD(Init) (THIS_
  788. IHXResolverResponse*  pResponse) PURE;
  789.     STDMETHOD(GetHostByName) (THIS_
  790. const char* pHostName) PURE;
  791. };
  792. /****************************************************************************
  793.  * 
  794.  *  Interface:
  795.  * 
  796.  * IHXResolverResponse
  797.  * 
  798.  *  Purpose:
  799.  * 
  800.  * This is the response interface for the asynchronous DNS hostname
  801.  * resolver.
  802.  * 
  803.  *  IID_IHXResolverResponse:
  804.  * 
  805.  * {0000010A-0901-11d1-8B06-00A024406D59}
  806.  * 
  807.  */
  808. DEFINE_GUID(IID_IHXResolverResponse, 0x0000010A, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  809. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  810. #undef  INTERFACE
  811. #define INTERFACE   IHXResolverResponse
  812. DECLARE_INTERFACE_(IHXResolverResponse, IUnknown)
  813. {
  814.     /*
  815.      *  IUnknown methods
  816.      */
  817.     STDMETHOD(QueryInterface) (THIS_
  818. REFIID riid,
  819. void** ppvObj) PURE;
  820.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  821.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  822.     /*
  823.      * IHXResolverResponse methods
  824.      */
  825.     STDMETHOD(GetHostByNameDone) (THIS_
  826. HX_RESULT status,
  827. ULONG32 ulAddr) PURE;
  828. };
  829. /****************************************************************************
  830.  * 
  831.  *  Interface:
  832.  * 
  833.  * IHXInterruptSafe
  834.  * 
  835.  *  Purpose:
  836.  * 
  837.  * This interface is used in Macintosh implementations of callback 
  838.  * functions, renderers, etc... to determine if interrupt time execution  
  839.  * is supported. If this interface is not implemented then it is assumed
  840.  * that interrupt time execution is NOT supported. There are restrictions 
  841.  * on what may be executed at interrupt time; please consult the Macintosh
  842.  * Deferred Task Manager tech notes from Apple.
  843.  * 
  844.  *  IID_IHXInterruptSafe:
  845.  * 
  846.  * {0000010B-0901-11d1-8B06-00A024406D59}
  847.  * 
  848.  */
  849. DEFINE_GUID(IID_IHXInterruptSafe, 0x0000010B, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  850. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  851. #undef  INTERFACE
  852. #define INTERFACE   IHXInterruptSafe
  853. DECLARE_INTERFACE_(IHXInterruptSafe, IUnknown)
  854. {
  855.     /*
  856.      *  IUnknown methods
  857.      */
  858.     STDMETHOD(QueryInterface) (THIS_
  859. REFIID riid,
  860. void** ppvObj) PURE;
  861.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  862.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  863.     /*
  864.      *  IHXInterruptSafe methods
  865.      */
  866.     /************************************************************************
  867.      * Method:
  868.      *     IHXInterruptSafe::IsInterruptSafe
  869.      * Purpose:
  870.      *     This is the function that will be called to determine if
  871.      *     interrupt time execution is supported.
  872.      */
  873.     STDMETHOD_(BOOL,IsInterruptSafe) (THIS) PURE;
  874. };
  875. /****************************************************************************
  876.  * 
  877.  *  Interface:
  878.  * 
  879.  * IHXAsyncIOSelection
  880.  * 
  881.  *  Purpose:
  882.  * 
  883.  *      This interface is implemented by the server/player context on Unix
  884.  *      platforms.  This interface allows your plugin to get callbacks based
  885.  *      I/O events that are normally handled by select().  This interface
  886.  * allows you to setup callbacks which will be executed when a file
  887.  * descriptor is ready for reading, writing, or has an exception.
  888.  * 
  889.  *  IID_IHXAsyncIOSelection:
  890.  * 
  891.  * {0000010C-0901-11d1-8B06-00A024406D59}
  892.  * 
  893.  */
  894. DEFINE_GUID(IID_IHXAsyncIOSelection, 0x0000010C, 0x901, 0x11d1, 0x8b, 0x6, 0x0,
  895. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  896. #undef  INTERFACE
  897. #define INTERFACE   IHXAsyncIOSelection
  898. DECLARE_INTERFACE_(IHXAsyncIOSelection, IUnknown)
  899. {
  900.     /*
  901.      *  IUnknown methods
  902.      */
  903.     STDMETHOD(QueryInterface) (THIS_
  904. REFIID riid,
  905. void** ppvObj) PURE;
  906.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  907.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  908.     /*
  909.      * IHXAsyncIOSelection methods
  910.      */
  911.     /************************************************************************
  912.      * Method:
  913.      *     IHXAsyncIOSelection::Add
  914.      * Purpose:
  915.      *     This function will allow you to receive a callback when the
  916.      *     given descriptor is ready for read, write, or has an
  917.      *     exception.  This function is only available on Unix, and is
  918.      *     intended to replace the functionality of select().
  919.      */
  920.     STDMETHOD(Add) (THIS_
  921. IHXCallback* pCallback,
  922. INT32 lFileDescriptor,
  923. UINT32 ulType) PURE;
  924.     /************************************************************************
  925.      * Method:
  926.      *     IHXAsyncIOSelection::Remove
  927.      * Purpose:
  928.      *     This function will allow you remove the callback associated
  929.      *     with the given descriptor from the event handler.
  930.      *     This function is only available on Unix, and is intended to
  931.      *     replace the functionality of select().
  932.      */
  933.     STDMETHOD(Remove)                   (THIS_
  934.                                         INT32           lFileDescriptor,
  935. UINT32 ulType) PURE;
  936. };
  937. /****************************************************************************
  938.  * 
  939.  *  Interface:
  940.  * 
  941.  * IHXUDPMulticastInit
  942.  * 
  943.  *  Purpose:
  944.  * 
  945.  * Provides the user with a way to set the TTL for outgoing multicast
  946.  * UDP packets.  Usually shared with IHXUDPSocket.
  947.  * 
  948.  *  IID_IHXUDPMulticastInit:
  949.  * 
  950.  * {0000010D-0901-11d1-8B06-00A024406D59}
  951.  * 
  952.  */
  953. DEFINE_GUID(IID_IHXUDPMulticastInit, 0x0000010D, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  954. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  955. #undef  INTERFACE
  956. #define INTERFACE   IHXUDPMulticastInit
  957. DECLARE_INTERFACE_(IHXUDPMulticastInit, IUnknown)
  958. {
  959.     /*
  960.      *  IUnknown methods
  961.      */
  962.     STDMETHOD(QueryInterface) (THIS_
  963. REFIID riid,
  964. void** ppvObj) PURE;
  965.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  966.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  967.     /*
  968.      * IHXUDPMulticastInit methods
  969.      *
  970.      */
  971.      /************************************************************************
  972.      * Method:
  973.      *     IHXUDPMulticastInit::InitMulticast
  974.      * Purpose:
  975.      *     This function will set the TTL (time to live) for the UDP socket
  976.      *      so it can be used as a multicast socket, sending packets across
  977.      *      the number of routers specified in the ulTTL parameter.  
  978.      */
  979.     STDMETHOD(InitMulticast) (THIS_
  980.      UINT8     chTTL) PURE;
  981. };
  982. /****************************************************************************
  983.  * 
  984.  *  Interface:
  985.  * 
  986.  * IHXInterruptState
  987.  * 
  988.  *  Purpose:
  989.  * 
  990.  * This interface is used in Macintosh implementations to inform the
  991.  * the client engine when entering & leaving an interupt task. It is
  992.  * also used to determine if it is currently at interrupt time.
  993.  * Please consult the Macintosh Deferred Task Manager tech notes from Apple
  994.  * for information on interrupt tasks.
  995.  * 
  996.  *  IID_IHXInterruptState:
  997.  * 
  998.  * {0000010E-0901-11d1-8B06-00A024406D59}
  999.  * 
  1000.  */
  1001. DEFINE_GUID(IID_IHXInterruptState, 0x0000010E, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  1002. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  1003. #undef  INTERFACE
  1004. #define INTERFACE   IHXInterruptState
  1005. DECLARE_INTERFACE_(IHXInterruptState, IUnknown)
  1006. {
  1007.     /*
  1008.      *  IUnknown methods
  1009.      */
  1010.     STDMETHOD(QueryInterface) (THIS_
  1011. REFIID riid,
  1012. void** ppvObj) PURE;
  1013.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  1014.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  1015.     /*
  1016.      *  IHXInterruptState methods
  1017.      */
  1018.     /************************************************************************
  1019.      * Method:
  1020.      *     IHXInterruptState::AtInterruptTime
  1021.      * Purpose:
  1022.      *     This function is called to determine if we are currently at
  1023.      *     interrupt task time.
  1024.      */
  1025.         STDMETHOD_(BOOL,AtInterruptTime) (THIS) PURE;
  1026.     /************************************************************************
  1027.      * Method:
  1028.      *     IHXInterruptState::EnterInterruptState
  1029.      * Purpose:
  1030.      *     This function is called when starting a deferred/interrupt task
  1031.      */
  1032.     STDMETHOD(EnterInterruptState) (THIS) PURE;
  1033.     /************************************************************************
  1034.      * Method:
  1035.      *     IHXInterruptState::LeaveInterruptState
  1036.      * Purpose:
  1037.      *     This function is called when leaving a deferred/interrupt task
  1038.      */
  1039.     STDMETHOD(LeaveInterruptState) (THIS) PURE;
  1040.     /************************************************************************
  1041.      * Method:
  1042.      *     IHXInterruptState::EnableInterrupt
  1043.      * Purpose:
  1044.      *     This function can be called to enable/disable interrupt time 
  1045.      *     processsing
  1046.      */
  1047.     STDMETHOD(EnableInterrupt) (THIS_
  1048. BOOL bEnable) PURE;
  1049.     
  1050.     /************************************************************************
  1051.      * Method:
  1052.      *     IHXInterruptState::IsInterruptEnabled
  1053.      * Purpose:
  1054.      *     This function can be called to find if the core is currently
  1055.      *     interrupt enabled.
  1056.      */
  1057.     STDMETHOD_(BOOL, IsInterruptEnabled)   (THIS) PURE;
  1058. };
  1059. /****************************************************************************
  1060.  * 
  1061.  *  Interface:
  1062.  * 
  1063.  * IHXOptimizedScheduler
  1064.  * 
  1065.  *  Purpose:
  1066.  * 
  1067.  * This interface provides the user with a way of scheduling callbacks
  1068.  * that will be executed at some time in the future.
  1069.  *
  1070.  * This interface should ONLY be used if you need accurately timed 
  1071.  * callbacks. These callbacks should be efficient and should not consume 
  1072.  * much time/CPU. This is not a thread safe interface. The user has to 
  1073.  * take care of synchronization in their callbacks.
  1074.  * 
  1075.  *  IID_IHXOptimizedScheduler:
  1076.  * 
  1077.  * {0000010F-0901-11d1-8B06-00A024406D59}
  1078.  * 
  1079.  */
  1080. DEFINE_GUID(IID_IHXOptimizedScheduler, 0x0000010F, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  1081. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  1082. #undef  INTERFACE
  1083. #define INTERFACE   IHXOptimizedScheduler
  1084. DECLARE_INTERFACE_(IHXOptimizedScheduler, IUnknown)
  1085. {
  1086.     /*
  1087.      *  IUnknown methods
  1088.      */
  1089.     STDMETHOD(QueryInterface) (THIS_
  1090. REFIID riid,
  1091. void** ppvObj) PURE;
  1092.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  1093.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  1094.     /*
  1095.      * IHXOptimizedScheduler methods
  1096.      */
  1097.     /************************************************************************
  1098.      * Method:
  1099.      *     IHXOptimizedScheduler::RelativeEnter
  1100.      * Purpose:
  1101.      *     Schedule a callback to be executed "ms" milliseconds from now
  1102.      *     This function is less percise then AbsoluteEnter and should only
  1103.      *     be used when accurate timing is not critical.
  1104.      */
  1105.     STDMETHOD_(CallbackHandle,RelativeEnter) (THIS_
  1106. IHXCallback* pCallback,
  1107. UINT32 ms) PURE;
  1108.     /************************************************************************
  1109.      * Method:
  1110.      *     IHXOptimizedScheduler::AbsoluteEnter
  1111.      * Purpose:
  1112.      *     Schedule a callback to be executed at time "tVal".
  1113.      */
  1114.     STDMETHOD_(CallbackHandle,AbsoluteEnter) (THIS_
  1115. IHXCallback* pCallback,
  1116. HXTimeval tVal) PURE;
  1117.     /************************************************************************
  1118.      * Method:
  1119.      *     IHXOptimizedScheduler::Remove
  1120.      * Purpose:
  1121.      *     Remove a callback from the scheduler.
  1122.      */
  1123.     STDMETHOD(Remove) (THIS_
  1124.      CallbackHandle Handle) PURE;
  1125.     /************************************************************************
  1126.      * Method:
  1127.      *     IHXOptimizedScheduler::GetCurrentSchedulerTime
  1128.      * Purpose:
  1129.      *     Gives the current time (in the timeline of the scheduler).
  1130.      */
  1131.     STDMETHOD_(HXTimeval,GetCurrentSchedulerTime) (THIS) PURE;
  1132. };
  1133. /****************************************************************************
  1134.  *
  1135.  *  Interface:
  1136.  *
  1137.  *     IHXThreadSafeScheduler
  1138.  *
  1139.  *  Purpose:
  1140.  *
  1141.  *     This interface provides the user with a way of scheduling callbacks
  1142.  *     that will be executed at some time in the future.  This is identical
  1143.  *      to IHXScheduler except the scheduler events are considered thread-safe.
  1144.  *
  1145.  *  IID_IHXThreadSafeScheduler:
  1146.  *
  1147.  *     {00000120-0901-11d1-8B06-00A024406D59}
  1148.  *
  1149.  */
  1150. DEFINE_GUID(IID_IHXThreadSafeScheduler, 0x00000120, 0x901, 0x11d1, 0x8b, 0x6, 0x0,
  1151.                        0xa0, 0x24, 0x40, 0x6d, 0x59);
  1152. #undef  INTERFACE
  1153. #define INTERFACE   IHXThreadSafeScheduler
  1154. DECLARE_INTERFACE_(IHXThreadSafeScheduler, IUnknown)
  1155. {
  1156.     /*
  1157.      *  IUnknown methods
  1158.      */
  1159.     STDMETHOD(QueryInterface)          (THIS_
  1160.                                        REFIID riid,
  1161.                                        void** ppvObj) PURE;
  1162.     STDMETHOD_(ULONG32,AddRef)         (THIS) PURE;
  1163.     STDMETHOD_(ULONG32,Release)                (THIS) PURE;
  1164.     /*
  1165.      * IHXThreadSafeScheduler methods
  1166.      */
  1167.     /************************************************************************
  1168.      * Method:
  1169.      *     IHXThreadSafeScheduler::RelativeEnter
  1170.      * Purpose:
  1171.      *     Schedule a callback to be executed "ms" milliseconds from now
  1172.      *     This function is less percise then AbsoluteEnter and should only
  1173.      *     be used when accurate timing is not critical.
  1174.      */
  1175.     STDMETHOD_(CallbackHandle,RelativeEnter)   (THIS_
  1176.                                                IHXCallback* pCallback,
  1177.                                                UINT32 ms) PURE;
  1178.     /************************************************************************
  1179.      * Method:
  1180.      *     IHXThreadSafeScheduler::AbsoluteEnter
  1181.      * Purpose:
  1182.      *     Schedule a callback to be executed at time "tVal".
  1183.      */
  1184.     STDMETHOD_(CallbackHandle,AbsoluteEnter)   (THIS_
  1185.                                                IHXCallback* pCallback,
  1186.                                                HXTimeval tVal) PURE;
  1187.     /************************************************************************
  1188.      * Method:
  1189.      *     IHXThreadSafeScheduler::Remove
  1190.      * Purpose:
  1191.      *     Remove a callback from the scheduler.
  1192.      */
  1193.     STDMETHOD(Remove)          (THIS_
  1194.                                CallbackHandle Handle) PURE;
  1195. };
  1196. /****************************************************************************
  1197.  *
  1198.  *  Interface:
  1199.  *
  1200.  *     IHXProcessEntryPoint
  1201.  *
  1202.  *  Purpose:
  1203.  *
  1204.  *     This interface is the entry point for an IHXProcess
  1205.  *
  1206.  *  IID_IHXProcessEntryPoint
  1207.  *
  1208.  *     {00000123-0901-11d1-8B06-00A024406D59}
  1209.  *
  1210.  */
  1211. DEFINE_GUID(IID_IHXProcessEntryPoint, 0x00000123, 0x901, 0x11d1, 0x8b, 0x6,
  1212.             0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);
  1213. #undef  INTERFACE
  1214. #define INTERFACE   IHXProcessEntryPoint
  1215. DECLARE_INTERFACE_(IHXProcessEntryPoint, IUnknown)
  1216. {
  1217.     /*
  1218.      *  IUnknown methods
  1219.      */
  1220.     STDMETHOD(QueryInterface)          (THIS_
  1221.                                        REFIID riid,
  1222.                                        void** ppvObj) PURE;
  1223.     STDMETHOD_(ULONG32,AddRef)         (THIS) PURE;
  1224.     STDMETHOD_(ULONG32,Release)        (THIS) PURE;
  1225.     STDMETHOD(Func)                   (THIS_
  1226.                                        IUnknown* pContext) PURE;
  1227. };
  1228. /****************************************************************************
  1229.  *
  1230.  *  Interface:
  1231.  *
  1232.  *     IHXProcess
  1233.  *
  1234.  *  Purpose:
  1235.  *
  1236.  *     This interface allows you to create new server processes and specify
  1237.  *  an entry point.  It is queried off the context.
  1238.  *
  1239.  *  IID_IHXProcess
  1240.  *
  1241.  *     {00000122-0901-11d1-8B06-00A024406D59}
  1242.  *
  1243.  */
  1244. DEFINE_GUID(IID_IHXProcess, 0x00000122, 0x901, 0x11d1, 0x8b, 0x6, 0x0,
  1245.                        0xa0, 0x24, 0x40, 0x6d, 0x59);
  1246. #undef  INTERFACE
  1247. #define INTERFACE   IHXProcess
  1248. DECLARE_INTERFACE_(IHXProcess, IUnknown)
  1249. {
  1250.     /*
  1251.      *  IUnknown methods
  1252.      */
  1253.     STDMETHOD(QueryInterface)          (THIS_
  1254.                                        REFIID riid,
  1255.                                        void** ppvObj) PURE;
  1256.     STDMETHOD_(ULONG32,AddRef)         (THIS) PURE;
  1257.     STDMETHOD_(ULONG32,Release)        (THIS) PURE;
  1258.     STDMETHOD(Start)                   (THIS_
  1259.                                        const char* pProcessName,
  1260.                                        IHXProcessEntryPoint* pEntryPoint) PURE;
  1261. };
  1262. /****************************************************************************
  1263.  * 
  1264.  *  Interface:
  1265.  * 
  1266.  * IHXLoadBalancedListen
  1267.  * 
  1268.  *  Purpose:
  1269.  * 
  1270.  * This interface is queried off of IHXListenSocket.  It allows
  1271.  * a plugin to specify that it wants the server to load balance
  1272.  * multiple instances of itself.  The server will instantiate multiple
  1273.  * instances of the plugin as needed based on socket / descriptor limits.
  1274.  * Each plugin instance should attempt to listen on the same port as
  1275.  * other instances (they will share the port).
  1276.  * 
  1277.  *  IID_IHXLoadBalancedListen:
  1278.  * 
  1279.  * {00000110-0901-11d1-8B06-00A024406D59}
  1280.  * 
  1281.  */
  1282. DEFINE_GUID(IID_IHXLoadBalancedListen, 0x00000110, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  1283. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  1284. #undef  INTERFACE
  1285. #define INTERFACE   IHXLoadBalancedListen
  1286. DECLARE_INTERFACE_(IHXLoadBalancedListen, IUnknown)
  1287. {
  1288.     /*
  1289.      *  IUnknown methods
  1290.      */
  1291.     STDMETHOD(QueryInterface) (THIS_
  1292. REFIID riid,
  1293. void** ppvObj) PURE;
  1294.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  1295.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  1296.     /*
  1297.      * IHXLoadBalancedListen methods
  1298.      */
  1299.     /************************************************************************
  1300.      * Method:
  1301.      *     IHXLoadBalancedListen::SetID
  1302.      * Purpose:
  1303.      *     This function set's the unique ID for this listen socket.  This
  1304.      *     ID is used to determine whether or not different instances of
  1305.      *     a plugin trying to listen on a single port are actually the
  1306.      *     same plugin.  Without this function, it would be possible for
  1307.      *     two completely different plugins to listen on the same port using
  1308.      *     the load balanced listener.
  1309.      */
  1310.     STDMETHOD(SetID) (THIS_
  1311.      REFIID ID) PURE;
  1312.     /************************************************************************
  1313.      * Method:
  1314.      *     IHXLoadBalancedListen::SetReserveLimit
  1315.      * Purpose:
  1316.      *     Sets the reserve limit for descriptors / sockets.  If less
  1317.      *     than reserve limit descriptors / sockets are left then a new
  1318.      *     instance of the plugin will be created.
  1319.      */
  1320.     STDMETHOD(SetReserveLimit) (THIS_
  1321.      UINT32 ulDescriptors,
  1322. UINT32 ulSockets) PURE;
  1323. };
  1324. /****************************************************************************
  1325.  * 
  1326.  *  Interface:
  1327.  * 
  1328.  * IHXOverrideDefaultServices
  1329.  * 
  1330.  *  Purpose:
  1331.  * 
  1332.  * This interface is queried off of the context.  It allows
  1333.  * a plugin to override any default services provided by the G2 system.
  1334.  * Currently, it is supported only on the client side. 
  1335.  * You may currently override IHXNetworkServices using this interface
  1336.  * You can use the same interface to later restore back the overriden services.
  1337.  * This is done by calling the same OverrideServices() function with the 
  1338.  * original service QIed before the initial override.
  1339.  * 
  1340.  *  IID_IHXOverrideDefaultServices:
  1341.  * 
  1342.  * {00000111-0901-11d1-8B06-00A024406D59}
  1343.  * 
  1344.  */
  1345. DEFINE_GUID(IID_IHXOverrideDefaultServices, 0x00000111, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  1346. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  1347. #undef  INTERFACE
  1348. #define INTERFACE   IHXOverrideDefaultServices
  1349. DECLARE_INTERFACE_(IHXOverrideDefaultServices, IUnknown)
  1350. {
  1351.     /*
  1352.      * IUnknown methods
  1353.      */
  1354.     STDMETHOD(QueryInterface)   (THIS_
  1355.                                 REFIID riid,
  1356. void** ppvObj) PURE;
  1357.     STDMETHOD_(ULONG32,AddRef)  (THIS) PURE;
  1358.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  1359.    /*
  1360.     * IHXOverrideDefaultServices methods
  1361.     */
  1362.    /************************************************************************
  1363.     *  Method:
  1364.     *      IHXOverrideDefaultServices::OverrideServices
  1365.     *  Purpose:
  1366.     *      Override default services provided by the G2 system.
  1367.     *
  1368.     */
  1369.     STDMETHOD(OverrideServices)         (THIS_
  1370. IUnknown* pContext) PURE;
  1371. };
  1372. typedef enum _HX_SOCKET_OPTION
  1373. {
  1374.     HX_SOCKOPT_REUSE_ADDR,
  1375.     HX_SOCKOPT_REUSE_PORT,
  1376.     HX_SOCKOPT_BROADCAST,
  1377.     HX_SOCKOPT_SET_RECVBUF_SIZE,
  1378.     HX_SOCKOPT_SET_SENDBUF_SIZE,
  1379.     HX_SOCKOPT_MULTICAST_IF,
  1380.     HX_SOCKOPT_IP_TOS
  1381. } HX_SOCKET_OPTION;
  1382. /****************************************************************************
  1383.  * 
  1384.  *  Interface:
  1385.  * 
  1386.  * IHXSetSocketOption
  1387.  * 
  1388.  *  Purpose:
  1389.  * 
  1390.  * Set sockt option
  1391.  * 
  1392.  *  IID_IHXSetSocketOption:
  1393.  * 
  1394.  * IID_IHXSetSocketOption:    {00000114-0901-11d1-8B06-00A024406D59}
  1395.  * 
  1396.  */
  1397. DEFINE_GUID(IID_IHXSetSocketOption,
  1398.     0x00000114, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);
  1399. #undef  INTERFACE
  1400. #define INTERFACE   IHXSetSocketOption
  1401. DECLARE_INTERFACE_(IHXSetSocketOption, IUnknown)
  1402. {
  1403.     /*
  1404.      *  IUnknown methods
  1405.      */
  1406.     STDMETHOD(QueryInterface) (THIS_
  1407. REFIID riid,
  1408. void** ppvObj) PURE;
  1409.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  1410.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  1411.     /*
  1412.      * IHXListenSocket methods
  1413.      */
  1414.     STDMETHOD(SetOption) (THIS_ 
  1415.  HX_SOCKET_OPTION option,
  1416.  UINT32 ulValue) PURE;  
  1417. };
  1418. #define HX_THREADSAFE_METHOD_FF_GETPACKET 0x00000001
  1419. /*
  1420.  * FileFormat::GetPacket() only calls:
  1421.  *     CCF->CI(Buffer), CCF->CI(Packet), CCF->CI(Values), *Alloc, *Free, 
  1422.  *     FS->Read(), FS->Close(), FS->Seek(),
  1423.  *     FFR->PacketReady(), FFR->StreamDone()
  1424.  *     Context->Scheduler->*,
  1425.  *     CCF->CI(Mutex), Mutex->*
  1426.  *     Context->ErrorMessages
  1427.  *
  1428.  * XXXSMPNOW
  1429.  */
  1430. #define HX_THREADSAFE_METHOD_FS_READ 0x00000002
  1431. /*
  1432.  * FileSystem::Read()/Seek()/Close() only calls:
  1433.  *     CCF->CI(Buffer), CCF->CI(Packet), CCF->CI(Values), *Alloc, *Free, 
  1434.  *     FS->Read(), FS->Close(), FS->Seek(),
  1435.  *     Context->Scheduler->*,
  1436.  *     CCF->CI(Mutex), Mutex->*
  1437.  *     Context->ErrorMessages
  1438.  *
  1439.  * XXXSMPNOW
  1440.  */
  1441. #define HX_THREADSAFE_METHOD_FSR_READDONE 0x00000004
  1442. /*
  1443.  * FileFormat::ReadDone()/SeekDone()/CloseDone() only calls:
  1444.  *     CCF->CI(Buffer), CCF->CI(Packet), CCF->CI(Values), *Alloc, *Free, 
  1445.  *     FS->Read(), FS->Close(), FS->Seek(),
  1446.  *     FFR->PacketReady(), FFR->StreamDone()
  1447.  *     Context->Scheduler->*,
  1448.  *     CCF->CI(Mutex), Mutex->*
  1449.  *     Context->ErrorMessages
  1450.  *
  1451.  * XXXSMPNOW
  1452.  */
  1453. #define HX_THREADSAFE_METHOD_CACHE_FILE 0x00000008
  1454. /*
  1455.  * FileSystem::Read()/Seek()/Close() only calls:
  1456.  *     CCF->CI(Buffer), CCF->CI(Packet), CCF->CI(Values), *Alloc, *Free, 
  1457.  *     FS->Read(), FS->Close(), FS->Seek(),
  1458.  *     IHXCacheFile->*, IHXCacheFileResponse->*,
  1459.  *     Context->Scheduler->*,
  1460.  *     CCF->CI(Mutex), Mutex->*
  1461.  *     Context->ErrorMessages
  1462.  *
  1463.  * XXXSMPNOW
  1464.  */
  1465. #define HX_THREADSAFE_METHOD_CACHE_FILE_RESPONSE 0x00000010
  1466. /*
  1467.  * FileSystem::Read()/Seek()/Close() only calls:
  1468.  *     CCF->CI(Buffer), CCF->CI(Packet), CCF->CI(Values), *Alloc, *Free, 
  1469.  *     FS->Read(), FS->Close(), FS->Seek(),
  1470.  *     IHXCacheFile->*, IHXCacheFileResponse->*,
  1471.  *     Context->Scheduler->*,
  1472.  *     CCF->CI(Mutex), Mutex->*
  1473.  *     Context->ErrorMessages
  1474.  *
  1475.  * XXXSMPNOW
  1476.  */
  1477. /*
  1478.  * Thread Safe flags for IHXDataConvert
  1479.  */
  1480. #define HX_THREADSAFE_METHOD_CONVERT_HEADERS 0x00000020
  1481. /*
  1482.  * IHXDataConvert::ConvertXXX()/CtrlBufferReady() only calls:
  1483.  *     CCF->CI(Buffer), CCF->CI(Packet), CCF->CI(Values), *Alloc, *Free, 
  1484.  *     IHXDataConvertResponse->*
  1485.  *     Context->Scheduler->*,
  1486.  *     CCF->CI(Mutex), Mutex->*
  1487.  *     Context->ErrorMessages
  1488.  *
  1489.  * XXXSMPNOW
  1490.  */
  1491. #define HX_THREADSAFE_METHOD_CONVERT_DATA 0x00000040
  1492. /*
  1493.  * IHXDataConvert::ConvertXXX()/CtrlBufferReady() only calls:
  1494.  *     CCF->CI(Buffer), CCF->CI(Packet), CCF->CI(Values), *Alloc, *Free, 
  1495.  *     IHXDataConvertResponse->*
  1496.  *     Context->Scheduler->*,
  1497.  *     CCF->CI(Mutex), Mutex->*
  1498.  *     Context->ErrorMessages
  1499.  *
  1500.  * XXXSMPNOW
  1501.  */
  1502. #define HX_THREADSAFE_METHOD_CONVERT_CTRL_BUFFER_READY 0x00000080
  1503. /*
  1504.  * IHXDataConvert::ConvertXXX()/CtrlBufferReady() only calls:
  1505.  *     CCF->CI(Buffer), CCF->CI(Packet), CCF->CI(Values), *Alloc, *Free, 
  1506.  *     IHXDataConvertResponse->*
  1507.  *     Context->Scheduler->*,
  1508.  *     CCF->CI(Mutex), Mutex->*
  1509.  *     Context->ErrorMessages
  1510.  *
  1511.  * XXXSMPNOW
  1512.  */
  1513. #define HX_THREADSAFE_METHOD_SOCKET_READDONE  0x00000100
  1514. #define HX_THREADSAFE_METHOD_ALL  (~0)
  1515. /****************************************************************************
  1516.  * 
  1517.  *  Interface:
  1518.  * 
  1519.  * IHXThreadSafeMethods
  1520.  * 
  1521.  *  Purpose:
  1522.  * 
  1523.  * XXXSMPNOW
  1524.  * 
  1525.  *  IID_IHXThreadSafeMethods:
  1526.  * 
  1527.  * {00000115-0901-11d1-8B06-00A024406D59}
  1528.  * 
  1529.  */
  1530. DEFINE_GUID(IID_IHXThreadSafeMethods, 0x00000115, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  1531. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  1532. #undef  INTERFACE
  1533. #define INTERFACE   IHXThreadSafeMethods
  1534. DECLARE_INTERFACE_(IHXThreadSafeMethods, IUnknown)
  1535. {
  1536.     /*
  1537.      * IUnknown methods
  1538.      */
  1539.     STDMETHOD(QueryInterface) (THIS_
  1540. REFIID riid,
  1541. void** ppvObj) PURE;
  1542.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  1543.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  1544.     /*
  1545.      * IHXThreadSafeMethods methods
  1546.      */
  1547.     /************************************************************************
  1548.      * Method:
  1549.      *     IHXThreadSafeMethods::IsThreadSafe
  1550.      * Purpose:
  1551.      *     XXXSMPNOW
  1552.      */
  1553.     STDMETHOD_(UINT32,IsThreadSafe)     (THIS) PURE;
  1554. };
  1555. /****************************************************************************
  1556.  * 
  1557.  *  Interface:
  1558.  * 
  1559.  * IHXMutex
  1560.  * 
  1561.  *  Purpose:
  1562.  * 
  1563.  * XXXSMPNOW
  1564.  * 
  1565.  *  IID_IHXMutex:
  1566.  * 
  1567.  * {00000116-0901-11d1-8B06-00A024406D59}
  1568.  * 
  1569.  */
  1570. DEFINE_GUID(IID_IHXMutex, 0x00000116, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  1571. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  1572. #undef  INTERFACE
  1573. #define INTERFACE   IHXMutex
  1574. /*
  1575.  *  The IHXCommonClassFactory supports creating an instance
  1576.  *  of this object.
  1577.  */
  1578. #define CLSID_IHXMutex IID_IHXMutex
  1579. DECLARE_INTERFACE_(IHXMutex, IUnknown)
  1580. {
  1581.     /*
  1582.      * IUnknown methods
  1583.      */
  1584.     STDMETHOD(QueryInterface) (THIS_
  1585. REFIID riid,
  1586. void** ppvObj) PURE;
  1587.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  1588.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  1589.     /*
  1590.      * IHXMutex methods
  1591.      */
  1592.      /* XXXSMPNOW Comments */
  1593.     STDMETHOD(Lock)     (THIS) PURE;
  1594.     STDMETHOD(TryLock)     (THIS) PURE;
  1595.     STDMETHOD(Unlock)     (THIS) PURE;
  1596. };
  1597. // $Private:
  1598. /****************************************************************************
  1599.  * 
  1600.  *  Interface:
  1601.  * 
  1602.  * IHXFastPathNetWrite
  1603.  * 
  1604.  *  Purpose:
  1605.  * 
  1606.  * Private interface for high speed UDP output.
  1607.  * 
  1608.  *  IID_IHXFastPathNetWrite:
  1609.  * 
  1610.  * {00000117-0901-11d1-8B06-00A024406D59}
  1611.  * 
  1612.  */
  1613. DEFINE_GUID(IID_IHXFastPathNetWrite, 0x00000117, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  1614. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  1615. #undef  INTERFACE
  1616. #define INTERFACE   IHXFastPathNetWrite
  1617. DECLARE_INTERFACE_(IHXFastPathNetWrite, IUnknown)
  1618. {
  1619.     /*
  1620.      *  IUnknown methods
  1621.      */
  1622.     STDMETHOD(QueryInterface) (THIS_
  1623. REFIID riid,
  1624. void** ppvObj) PURE;
  1625.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  1626.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  1627.     /*
  1628.      * IHXFastPathNetWrite methods
  1629.      *
  1630.      */
  1631.     STDMETHOD(FastWrite) (THIS_
  1632. const UINT8* pBuffer, UINT32 ulLen) PURE;
  1633. };
  1634. /****************************************************************************
  1635.  * 
  1636.  *  Interface:
  1637.  * 
  1638.  * IHXWouldBlockResponse
  1639.  * 
  1640.  *  Purpose:
  1641.  * 
  1642.  * Get notifications of EWOULDBLOCK conditions.
  1643.  * 
  1644.  *  IID_IHXWouldBlockResponse:
  1645.  * 
  1646.  * {00000118-0901-11d1-8B06-00A024406D59}
  1647.  * 
  1648.  */
  1649. DEFINE_GUID(IID_IHXWouldBlockResponse, 0x00000118, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);
  1650. #undef  INTERFACE
  1651. #define INTERFACE   IHXWouldBlockResponse
  1652. DECLARE_INTERFACE_(IHXWouldBlockResponse, IUnknown)
  1653. {
  1654.     /*
  1655.      *  IUnknown methods
  1656.      */
  1657.     STDMETHOD(QueryInterface) (THIS_
  1658. REFIID riid,
  1659. void** ppvObj) PURE;
  1660.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  1661.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  1662.     /*
  1663.      * IHXWouldBlockResponse methods
  1664.      *
  1665.      */
  1666.     
  1667.     
  1668.     /*
  1669.      * WouldBlock
  1670.      *
  1671.      * Return HXR_OK to go into blocked mode, causing a future
  1672.      * WouldBlockCleared call.  HXR_anythingelse to ignore.
  1673.      */
  1674.     
  1675.     STDMETHOD(WouldBlock) (THIS_ UINT32 id) PURE;
  1676.     STDMETHOD(WouldBlockCleared)(THIS_ UINT32 id) PURE;
  1677. };
  1678. /****************************************************************************
  1679.  * 
  1680.  *  Interface:
  1681.  * 
  1682.  * IHXWouldBlock
  1683.  * 
  1684.  *  Purpose:
  1685.  * 
  1686.  * Notifier for EWOULDBLOCK conditions.
  1687.  * 
  1688.  *  IID_IHXWouldBlock:
  1689.  * 
  1690.  * {00000119-0901-11d1-8B06-00A024406D59}
  1691.  * 
  1692.  */
  1693. DEFINE_GUID(IID_IHXWouldBlock, 0x00000119, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  1694. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  1695. #undef  INTERFACE
  1696. #define INTERFACE   IHXWouldBlock
  1697. DECLARE_INTERFACE_(IHXWouldBlock, IUnknown)
  1698. {
  1699.     /*
  1700.      *  IUnknown methods
  1701.      */
  1702.     STDMETHOD(QueryInterface) (THIS_
  1703. REFIID riid,
  1704. void** ppvObj) PURE;
  1705.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  1706.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  1707.     /*
  1708.      * IHXWouldBlock methods
  1709.      *
  1710.      */
  1711.     
  1712.     STDMETHOD(WantWouldBlock) (THIS_
  1713.      IHXWouldBlockResponse*, UINT32 id) PURE;
  1714. };
  1715. /****************************************************************************
  1716.  *
  1717.  *  Interface:
  1718.  *
  1719.  *     IHXSharedUDPServices
  1720.  *
  1721.  *  Purpose:
  1722.  *
  1723.  *     Private interface for tying a UDP socket (via IHXUDPSocketContext) to
  1724.  *  a shared UDP resend port.  Used to send UDP packet resend requests to one
  1725.  *  shared UDP port per streamer.
  1726.  *
  1727.  *  IID_IHXSharedUDPServices
  1728.  *
  1729.  *     {00000123-0901-11d1-8B06-00A024406D59}
  1730.  *
  1731.  */
  1732. DEFINE_GUID(IID_IHXSharedUDPServices, 0x00000124, 0x901, 0x11d1, 0x8b, 0x6, 0x0,
  1733.                        0xa0, 0x24, 0x40, 0x6d, 0x59);
  1734. #undef  INTERFACE
  1735. #define INTERFACE   IHXSharedUDPServices
  1736. DECLARE_INTERFACE_(IHXSharedUDPServices, IUnknown)
  1737. {
  1738.     /*
  1739.      *  IUnknown methods
  1740.      */
  1741.     STDMETHOD(QueryInterface)          (THIS_
  1742.                                        REFIID riid,
  1743.                                        void** ppvObj) PURE;
  1744.     STDMETHOD_(ULONG32,AddRef)         (THIS) PURE;
  1745.     STDMETHOD_(ULONG32,Release)        (THIS) PURE;
  1746.     /*
  1747.      * IHXSharedUDPServices methods
  1748.      */
  1749.     STDMETHOD(RegisterSharedResponse) (THIS_
  1750.  IHXUDPResponse* response,
  1751.  UINT16 sPortEnum) PURE;
  1752.     STDMETHOD(UnregisterSharedResponse) (THIS) PURE;
  1753.     STDMETHOD_(UINT16, GetSharedPort) (THIS) PURE;
  1754. };
  1755. /****************************************************************************
  1756.  *
  1757.  *  Interface:
  1758.  *
  1759.  *     IHXThreadLocal
  1760.  *
  1761.  *  Purpose:
  1762.  *
  1763.  *     Thread-local information, namely the procnum.
  1764.  *
  1765.  *  IID_IHXThreadLocal
  1766.  *
  1767.  *     {00000125-0901-11d1-8B06-00A024406D59}
  1768.  *
  1769.  */
  1770. DEFINE_GUID(IID_IHXThreadLocal, 0x00000125, 0x901, 0x11d1, 0x8b, 0x6, 0x0,
  1771.                        0xa0, 0x24, 0x40, 0x6d, 0x59);
  1772. #undef  INTERFACE
  1773. #define INTERFACE   IHXThreadLocal
  1774. #define CLSID_IHXThreadLocal IID_IHXThreadLocal
  1775. DECLARE_INTERFACE_(IHXThreadLocal, IUnknown)
  1776. {
  1777.     /*
  1778.      *  IUnknown methods
  1779.      */
  1780.     STDMETHOD(QueryInterface)          (THIS_
  1781.                                        REFIID riid,
  1782.                                        void** ppvObj) PURE;
  1783.     STDMETHOD_(ULONG32,AddRef)         (THIS) PURE;
  1784.     STDMETHOD_(ULONG32,Release)        (THIS) PURE;
  1785.     /*
  1786.      * IHXThreadLocal methods
  1787.      */
  1788.     /*
  1789.      *  IHXThreadLocal::GetMaxThreads()
  1790.      *
  1791.      *  Maximum number of threads on the system (MAX_THREADS on server)
  1792.      */
  1793.     STDMETHOD_(int, GetMaxThreads) (THIS) PURE;
  1794.     /*
  1795.      *  IHXThreadLocal::GetThreadNumber()
  1796.      *
  1797.      *  This thread's number (< MAX_THREADS)
  1798.      */
  1799.     STDMETHOD_(int, GetThreadNumber) (THIS) PURE;
  1800. };
  1801. /****************************************************************************
  1802.  *
  1803.  *  Interface:
  1804.  *
  1805.  *     IHXMemoryServices
  1806.  *
  1807.  *  Purpose:
  1808.  *
  1809.  *     Exposes server memory functions
  1810.  *
  1811.  *  IID_IHXMemoryServices
  1812.  *
  1813.  *     {00000126-0901-11d1-8B06-00A024406D59}
  1814.  *
  1815.  */
  1816. DEFINE_GUID(IID_IHXMemoryServices, 0x00000126, 0x901, 0x11d1, 0x8b, 0x6, 0x0,
  1817.                        0xa0, 0x24, 0x40, 0x6d, 0x59);
  1818. #undef  INTERFACE
  1819. #define INTERFACE   IHXMemoryServices
  1820. #define CLSID_IHXMemoryServices IID_IHXMemoryServices
  1821. DECLARE_INTERFACE_(IHXMemoryServices, IUnknown)
  1822. {
  1823.     /*
  1824.      *  IUnknown methods
  1825.      */
  1826.     STDMETHOD(QueryInterface)          (THIS_
  1827.                                        REFIID riid,
  1828.                                        void** ppvObj) PURE;
  1829.     STDMETHOD_(ULONG32,AddRef)         (THIS) PURE;
  1830.     STDMETHOD_(ULONG32,Release)        (THIS) PURE;
  1831.     /*
  1832.      * IHXMemoryServices methods
  1833.      */
  1834.     /*
  1835.      *  IHXMemoryServices::ValidateMemory()
  1836.      *
  1837.      *  Make consistency checks on the server shared memory space.
  1838.      *
  1839.      * lStartPage, lPages
  1840.      *
  1841.      * Specifies a page range to allow smaller searches, if you have a 
  1842.      * repro case and want to fail as soon as possible after the scribble.
  1843.      * Use lPages == 0 to check to the last page.  (Pages in the shared
  1844.      * space are numbered starting from zero.  You can decide on a range
  1845.      * based on the printout of previous errors.)
  1846.      *
  1847.      * ulFlags
  1848.      *
  1849.      * 0x00000001 fail -- abort() -- on finding an error.
  1850.      * 0x00000002 do rudimentary checks on internal SharedMemory data arrays.
  1851.      *
  1852.      */
  1853.     STDMETHOD(ValidateMemory) (THIS_
  1854.  INT32 lStartPage, 
  1855.  INT32 lPages, 
  1856.  UINT32 ulFlags) PURE;
  1857. };
  1858. typedef enum _HX_PRIVATE_SOCKET_OPTION
  1859. {
  1860.     HX_PRIVATE_SOCKOPT_IGNORE_WSAECONNRESET
  1861. } HX_PRIVATE_SOCKET_OPTION;
  1862. /****************************************************************************
  1863.  * 
  1864.  *  Interface:
  1865.  * 
  1866.  * IHXSetPrivateSocketOption
  1867.  * 
  1868.  *  Purpose:
  1869.  * 
  1870.  * Set private sockt option
  1871.  * 
  1872.  *  IID_IHXSetPrivateSocketOption:
  1873.  *
  1874.  *     {00000127-0901-11d1-8B06-00A024406D59}
  1875.  * 
  1876.  */
  1877. DEFINE_GUID(IID_IHXSetPrivateSocketOption, 
  1878.     0x00000127, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);
  1879.  
  1880. #undef  INTERFACE
  1881. #define INTERFACE   IHXSetPrivateSocketOption
  1882. DECLARE_INTERFACE_(IHXSetPrivateSocketOption, IUnknown)
  1883. {
  1884.     /*
  1885.      *  IUnknown methods
  1886.      */
  1887.     STDMETHOD(QueryInterface) (THIS_
  1888. REFIID riid,
  1889. void** ppvObj) PURE;
  1890.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  1891.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  1892.     /*
  1893.      * IHXSetPrivateSocketOption methods
  1894.      */
  1895.     STDMETHOD(SetOption) (THIS_ 
  1896.  HX_PRIVATE_SOCKET_OPTION option,
  1897.  UINT32 ulValue) PURE;  
  1898. };
  1899. /****************************************************************************
  1900.  * 
  1901.  *  Interface:
  1902.  * 
  1903.  * IHXNetInterfaces
  1904.  * 
  1905.  *  Purpose:
  1906.  * 
  1907.  * Network Interfaces
  1908.  * 
  1909.  *  IID_IHXNetInterfaces:
  1910.  *
  1911.  *     {00000128-0901-11d1-8B06-00A024406D59}
  1912.  * 
  1913.  */
  1914. typedef enum
  1915. {
  1916.     UNKNOWN,
  1917.     LOOPBACK,
  1918.     POINTTOPOINT,
  1919.     BROADCAST
  1920. } NIType;
  1921. typedef struct _NIInfo
  1922. {
  1923.     NIType type;
  1924.     BOOL bActive;
  1925.     UINT32 ulNetAddress;
  1926.     UINT32 ulNetMask;
  1927. } NIInfo;
  1928. DEFINE_GUID(IID_IHXNetInterfaces, 
  1929.     0x00000128, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);
  1930.  
  1931. #undef  INTERFACE
  1932. #define INTERFACE   IHXNetInterfaces
  1933. DECLARE_INTERFACE_(IHXNetInterfaces, IUnknown)
  1934. {
  1935.     /*
  1936.      *  IUnknown methods
  1937.      */
  1938.     STDMETHOD(QueryInterface) (THIS_
  1939. REFIID riid,
  1940. void** ppvObj) PURE;
  1941.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  1942.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  1943.     /*
  1944.      * IHXNetworkInterfaces methods
  1945.      */
  1946.     STDMETHOD(UpdateNetInterfaces) (THIS) PURE;
  1947.     STDMETHOD_(UINT32, GetNumOfNetInterfaces) (THIS) PURE;
  1948.     STDMETHOD(GetNetInterfaces) (THIS_
  1949. UINT16 lIndex,
  1950. REF(NIInfo*) pNIInfo) PURE;
  1951.     STDMETHOD(AddAdviseSink) (THIS_
  1952. IHXNetInterfacesAdviseSink* pSink) PURE;
  1953.     STDMETHOD(RemoveAdviseSink) (THIS_
  1954. IHXNetInterfacesAdviseSink* pSink) PURE;
  1955. };
  1956. /****************************************************************************
  1957.  * 
  1958.  *  Interface:
  1959.  * 
  1960.  * IHXNetInterfacesAdviseSink
  1961.  * 
  1962.  *  Purpose:
  1963.  * 
  1964.  * Network Interfaces Advise Sink
  1965.  * 
  1966.  *  IID_IHXNetInterfaces:
  1967.  *
  1968.  *     {00000129-0901-11d1-8B06-00A024406D59}
  1969.  * 
  1970.  */
  1971. DEFINE_GUID(IID_IHXNetInterfacesAdviseSink, 
  1972.     0x00000129, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);
  1973.  
  1974. #undef  INTERFACE
  1975. #define INTERFACE   IHXNetInterfacesAdviseSink
  1976. DECLARE_INTERFACE_(IHXNetInterfacesAdviseSink, IUnknown)
  1977. {
  1978.     /*
  1979.      *  IUnknown methods
  1980.      */
  1981.     STDMETHOD(QueryInterface) (THIS_
  1982. REFIID riid,
  1983. void** ppvObj) PURE;
  1984.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  1985.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  1986.     /*
  1987.      * IHXNetInterfacesAdviseSink methods
  1988.      */
  1989.     STDMETHOD(NetInterfacesUpdated) (THIS) PURE;
  1990. };
  1991. // $EndPrivate.
  1992. /****************************************************************************
  1993.  * 
  1994.  *  Interface:
  1995.  * 
  1996.  * IHXNetworkInterfaceEnumerator
  1997.  * 
  1998.  *  Purpose:
  1999.  * 
  2000.  * Enumerate interfaces on a box.
  2001.  * 
  2002.  *  IID_IHXNetworkInterfaceEnumerator;
  2003.  * 
  2004.  * {00000121-0901-11d1-8B06-00A024406D59}
  2005.  * 
  2006.  */
  2007. DEFINE_GUID(IID_IHXNetworkInterfaceEnumerator, 0x00000121, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  2008. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  2009. #undef  INTERFACE
  2010. #define INTERFACE   IHXNetworkInterfaceEnumerator
  2011. DECLARE_INTERFACE_(IHXNetworkInterfaceEnumerator, IUnknown)
  2012. {
  2013.     /*
  2014.      *  IUnknown methods
  2015.      */
  2016.     STDMETHOD(QueryInterface) (THIS_
  2017. REFIID riid,
  2018. void** ppvObj) PURE;
  2019.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  2020.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  2021.     /************************************************************************
  2022.      * Method:
  2023.      *     IHXNetworkInterfaceEnumerator::EnumerateInterfaces
  2024.      * Purpose:
  2025.      *     returns a list of local interfaces
  2026.      * Usage:
  2027.      *     If a buffer passed in is too small, it will return 
  2028.      *     HXR_BUFFERTOOSMALL with ulNumInterfaces updated.
  2029.      */
  2030.     STDMETHOD(EnumerateInterfaces) (THIS_
  2031. REF(UINT32*) pulInterfaces, REF(UINT32) ulNumInterfaces) PURE;
  2032. };
  2033. /****************************************************************************
  2034.  * 
  2035.  *  Interface:
  2036.  * 
  2037.  * IHXUDPConnectedSocket
  2038.  * 
  2039.  *  Purpose:
  2040.  * 
  2041.  * Connect and disconnect a UDP socket
  2042.  * 
  2043.  *  IID_IHXUDPConnectedSocket;
  2044.  * 
  2045.  * {0000012A-0901-11d1-8B06-00A024406D59}
  2046.  * 
  2047.  */
  2048. DEFINE_GUID(IID_IHXUDPConnectedSocket, 0x0000012a, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 
  2049. 0xa0, 0x24, 0x40, 0x6d, 0x59);
  2050. #undef  INTERFACE
  2051. #define INTERFACE   IHXUDPConnectedSocket
  2052. DECLARE_INTERFACE_(IHXUDPConnectedSocket, IUnknown)
  2053. {
  2054.     /*
  2055.      *  IUnknown methods
  2056.      */
  2057.     STDMETHOD(QueryInterface) (THIS_
  2058. REFIID riid,
  2059. void** ppvObj) PURE;
  2060.     STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
  2061.     STDMETHOD_(ULONG32,Release) (THIS) PURE;
  2062.     /************************************************************************
  2063.      * Method:
  2064.      *     IHXUDPConnectedSocket::UDPConnect
  2065.      * Purpose:
  2066.      *     Connect the udp socket
  2067.      * Usage:
  2068.      *     Connect to the foreign addr and port the socket already knows
  2069.      *      about; this is implementation-dependent.
  2070.      */
  2071.     STDMETHOD(UDPConnect) (THIS) PURE;
  2072.     /************************************************************************
  2073.      * Method:
  2074.      *     IHXUDPConnectedSocket::UDPConnect(ULONG32 ulAddr, UINT16 nPort);
  2075.      * Purpose:
  2076.      *     Connect the udp socket
  2077.      * Usage:
  2078.      *     Specify the host-ordered foreign addr and port to connect to.
  2079.      */
  2080.     STDMETHOD(UDPConnect) (THIS_ ULONG32 ulAddr, UINT16 nPort) PURE;
  2081.     /************************************************************************
  2082.      * Method:
  2083.      *     IHXUDPConnectedSocket::UDPDisconnect
  2084.      * Purpose:
  2085.      *     Disconnect the udp socket
  2086.      */
  2087.     STDMETHOD(UDPDisconnect) (THIS) PURE;
  2088.     /************************************************************************
  2089.      * Method:
  2090.      *     IHXUDPConnectedSocket::IsUDPConnected
  2091.      * Purpose:
  2092.      *     Return whether the socket is connected.
  2093.      */
  2094.     STDMETHOD_(BOOL, IsUDPConnected) (THIS) PURE;
  2095.     /************************************************************************
  2096.      * Method:
  2097.      *     IHXUDPConnectedSocket::IsUDPConnected(REF(ULONG32) ulAddr, 
  2098.      *                                            REF(UINT16) nPort)
  2099.      * Purpose:
  2100.      *     Return whether the socket is connected, and the connected addr/port.
  2101.      * Usage:
  2102.      *      Return the foreign addr/port the socket knows about, regardless of
  2103.      *      whether it's connected.  This is the foreign addr that is connected
  2104.      *      to (if TRUE) or that will be used if Connect(void) called (if FALSE).
  2105.      */
  2106.     STDMETHOD_(BOOL, IsUDPConnected) (THIS_ REF(ULONG32) ulAddr, 
  2107.                                             REF(UINT16) nPort) PURE;
  2108. };
  2109. #endif /* _HXENGIN_H_ */