home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / repldist.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  13.4 KB  |  489 lines

  1. #ifndef _REPLDIST_H_
  2. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  3. #define _REPLDIST_H_
  4.  
  5. // OLEDB header
  6. #include "oledb.h"
  7.  
  8. #ifndef __IDistributionStore_FWD_DEFINED__
  9. #define __IDistributionStore_FWD_DEFINED__
  10. typedef interface IDistributionStore IDistributionStore;
  11. #endif     /* __IDistributionStore_FWD_DEFINED__ */
  12.  
  13. #ifndef __IDistributionStore_INTERFACE_DEFINED__
  14. #define __IDistributionStore_INTERFACE_DEFINED__
  15.  
  16. //    SQLDistributionStore's CLSID
  17. // {16D9A8E2-C326-11d0-94E9-00C04FC2DB9C}
  18. DEFINE_GUID(CLSID_SQLDistribution, 
  19. 0x16d9a8e2, 0xc326, 0x11d0, 0x94, 0xe9, 0x0, 0xc0, 0x4f, 0xc2, 0xdb, 0x9c);
  20.  
  21.  // {63797CA0-9684-11d0-94DD-00C04FC2DB9C}
  22. DEFINE_GUID(IID_IDistributionStore, 
  23. 0x63797ca0, 0x9684, 0x11d0, 0x94, 0xdd, 0x0, 0xc0, 0x4f, 0xc2, 0xdb, 0x9c);
  24.  
  25. // {074EACFD-A791-11d0-94E0-00C04FC2DB9C}
  26. DEFINE_GUID(IID_IDistributionLog, 
  27. 0x74eacfd, 0xa791, 0x11d0, 0x94, 0xe0, 0x0, 0xc0, 0x4f, 0xc2, 0xdb, 0x9c);
  28.  
  29. typedef DWORD DISTCMDTYPE;
  30.  
  31. class DistByteArray 
  32. {
  33. private:
  34.     BYTE rgDistByteArray[16];
  35. public:
  36.     DistByteArray(){memset(rgDistByteArray, 0, sizeof(rgDistByteArray));}
  37.     ~DistByteArray(){}
  38.  
  39.     BYTE* operator& ()
  40.     {
  41.         return rgDistByteArray;
  42.     }
  43.  
  44.     // Pre-increment
  45.     DistByteArray& operator++ ()
  46.     {
  47.         return Increment();
  48.     }
  49.  
  50.     // Post-increment
  51.     DistByteArray& operator++ (int dummy)
  52.     {
  53.         return Increment();
  54.     }
  55.  
  56.     DistByteArray& Increment()
  57.     {
  58.         for (int i=sizeof(rgDistByteArray)-1; i>=0; i--)
  59.         {
  60.             UCHAR *pByte = ((UCHAR *) rgDistByteArray + i);
  61.             if (0xFF == *pByte)
  62.             {
  63.                 *pByte = 0;
  64.                 continue;
  65.             }
  66.             else
  67.             {
  68.                 (*pByte)++;
  69.                 break;
  70.             }
  71.         }
  72.         return *this;
  73.     }
  74. };
  75.  
  76. enum DISTCMDTYPEENUM
  77.     {    
  78.     DISTCMDTYPE_SQL    = 1,
  79.     DISTCMDTYPE_SCRIPT = 2,
  80.     DISTCMDTYPE_NATIVE_BCP = 3,
  81.     DISTCMDTYPE_CHAR_BCP = 4,
  82.     DISTCMDTYPE_SQL_WORKINGDIR = 7
  83.     };
  84.  
  85. typedef struct  tagDISTCOMMANDDESC
  86.     {
  87.     INT        PublicationId;
  88.     INT        ArticleId;
  89.     INT        CommandId;
  90.     DISTCMDTYPE    CommandType;
  91.     BOOL    fPartialCommand;
  92.     LPSTR    szCommand;
  93.     BYTE*    pXactId;
  94.     BYTE*    pXactSeqno;
  95.     LPSTR    szOriginator;
  96.     LPSTR    szOriginatorDB;
  97.     }    DISTCOMMANDDESC;
  98.  
  99.  
  100. // Error source type
  101. typedef enum {
  102.     DIST_SOURCE_NULL        = 0,
  103.     DIST_SOURCE_COMMAND        = 1,
  104.     DIST_SOURCE_AGENT        = 2,
  105.     DIST_SOURCE_OS            = 3,
  106.     DIST_SOURCE_ODBC        = 4,
  107.     DIST_SOURCE_SQLSERVER    = 5
  108. } DISTERRSRCTYPE;
  109.  
  110.  
  111. typedef struct  tagDISTERRORDESC
  112.     {
  113.     DISTERRSRCTYPE        SourceType; 
  114.     CHAR                szSourceName[31]; 
  115.     CHAR                szErrorCode[31];
  116.     BSTR                bstrErrorText;
  117.     }    DISTERRORDESC;
  118.  
  119. typedef DWORD DISTLOGSTATUS;
  120.  
  121. enum DISTLOGSTATUSENUM
  122.     {    
  123.     DISTLOG_STARTUP = 1,
  124.     DISTLOG_SUCCESS = 2,
  125.     DISTLOG_INPROGRESS = 3,
  126.     DISTLOG_IDLE = 4,
  127.     DISTLOG_RETRY = 5,
  128.     DISTLOG_FAILURE = 6
  129.     };
  130.  
  131. typedef BYTE DISTAPPTYPE;
  132.  
  133. enum DISTTYPEENUM
  134.     {    
  135.     DISTTYPE_SNAPSHOT = 0,
  136.     DISTTYPE_LOGREADER = 1
  137.     };
  138.  
  139.  
  140. enum DISTPROPENUM  
  141.     {    DBPROP_INIT_PUBLISHER_NAME = 0xFF1,
  142.         DBPROP_INIT_PUBLISHER_DATASOURCE = 0xFF2,
  143.         DBPROP_INIT_XACTID_SIZE = 0xFF3,
  144.         DBPROP_INIT_XACT_SEQNO_SIZE = 0xFF4,
  145.         DBPROP_PUBLICATION_NAME = 0xFF5,
  146.         DBPROP_APPLICATION_NAME = 0xFF6,
  147.         DBPROP_APPLICATION_TYPE = 0xFF7
  148.     };
  149.  
  150. EXTERN_C const IID IID_IDistributionStore;
  151.  
  152. #if defined(__cplusplus) && !defined(CINTERFACE)
  153.     
  154.     interface IDistributionStore : public IUnknown
  155.     {
  156.     public:
  157.         virtual HRESULT STDMETHODCALLTYPE Abort( void) = 0;
  158.         virtual HRESULT STDMETHODCALLTYPE Commit( void) = 0;
  159.         virtual HRESULT STDMETHODCALLTYPE GetLastTransaction(
  160.             /* [out] */ BYTE* pXactId,
  161.             /* [out] */ BYTE* pXactSeqno) = 0;
  162.         virtual HRESULT STDMETHODCALLTYPE AddTransactionCommands( 
  163.             /* [in] */ ULONG cCommandDescs,
  164.             /* [size_is][in] */ const DISTCOMMANDDESC __RPC_FAR rgCommandDescs[  ]) = 0;
  165.         virtual HRESULT STDMETHODCALLTYPE StartTransaction( void) = 0;
  166.     };
  167.     
  168. #else     /* C style interface */
  169.  
  170.     typedef struct IDistributionStoreVtbl
  171.     {
  172.         BEGIN_INTERFACE
  173.         
  174.         HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( 
  175.             IDistributionStore __RPC_FAR * This,
  176.             /* [in] */ REFIID riid,
  177.             /* [out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
  178.         
  179.         ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( 
  180.             IDistributionStore __RPC_FAR * This);
  181.         
  182.         ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( 
  183.             IDistributionStore __RPC_FAR * This);
  184.         
  185.         HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Abort )( 
  186.             IDistributionStore __RPC_FAR * This);
  187.  
  188.         HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Commit )( 
  189.             IDistributionStore __RPC_FAR * This);
  190.         
  191.         HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLastTransaction )( 
  192.             IDistributionStore __RPC_FAR * This,
  193.             /* [out] */ BYTE* pXactId,
  194.             /* [out] */ BYTE* pXactSeqno);
  195.         
  196.         HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AddTransactionCommands )( 
  197.             IDistributionStore __RPC_FAR * This,
  198.             /* [in] */ ULONG cCommandDescs,
  199.             /* [size_is][in] */ const DISTCOMMANDDESC __RPC_FAR rgCommandDescs[  ]);
  200.         
  201.         HRESULT ( STDMETHODCALLTYPE __RPC_FAR *StartTransaction )( 
  202.             IDistributionStore __RPC_FAR * This);
  203.  
  204.         END_INTERFACE
  205.     } IDistributionStoreVtbl;
  206.  
  207.     interface IDistributionStore
  208.     {
  209.         CONST_VTBL struct IDistributionStoreVtbl __RPC_FAR *lpVtbl;
  210.     };
  211.  
  212.     
  213.  
  214. #ifdef COBJMACROS
  215.  
  216. #define IDistributionStore_QueryInterface(This,riid,ppvObject)    \
  217.     (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
  218.  
  219. #define IDistributionStore_AddRef(This)    \
  220.     (This)->lpVtbl -> AddRef(This)
  221.  
  222. #define IDistributionStore_Release(This)    \
  223.     (This)->lpVtbl -> Release(This)
  224.  
  225. #define IDistributionStore_Abort(This)    \
  226.     (This)->lpVtbl -> Abort(This)
  227.  
  228. #define IDistributionStore_Commit(This)    \
  229.     (This)->lpVtbl -> Commit(This)
  230.  
  231. #define IDistributionStore_GetLastTransaction(This)    \
  232.     (This)->lpVtbl -> GetLastTransaction(This, pXactId, pXactSeqno)
  233.  
  234. #define IDistributionStore_AddTransactionCommands(This)    \
  235.     (This)->lpVtbl -> AddTransactionCommands(This, cCommandDescs, rgCommandDescs)
  236.  
  237. #define IDistributionStore_StartTransaction(This)    \
  238.     (This)->lpVtbl -> StartTransaction(This)
  239.  
  240. #endif /* COBJMACROS */
  241.  
  242.  
  243. #endif     /* C style interface */
  244.  
  245.  
  246.  
  247. HRESULT STDMETHODCALLTYPE IDistributionStore_Abort_Proxy( 
  248.     IDistributionStore __RPC_FAR * This);
  249.  
  250.  
  251. void __RPC_STUB IDistributionStore_Abort_Stub(
  252.     IRpcStubBuffer *This,
  253.     IRpcChannelBuffer *_pRpcChannelBuffer,
  254.     PRPC_MESSAGE _pRpcMessage,
  255.     DWORD *_pdwStubPhase);
  256.  
  257. HRESULT STDMETHODCALLTYPE IDistributionStore_Commit_Proxy( 
  258.     IDistributionStore __RPC_FAR * This);
  259.  
  260.  
  261. void __RPC_STUB IDistributionStore_Commit_Stub(
  262.     IRpcStubBuffer *This,
  263.     IRpcChannelBuffer *_pRpcChannelBuffer,
  264.     PRPC_MESSAGE _pRpcMessage,
  265.     DWORD *_pdwStubPhase);
  266.  
  267.  
  268. HRESULT STDMETHODCALLTYPE IDistributionStore_GetLastTransaction_Proxy( 
  269.     IDistributionStore __RPC_FAR * This,
  270.     BYTE* pXactId,
  271.     BYTE* pXactSeqno);
  272.  
  273.  
  274. void __RPC_STUB IDistributionStore_GetLastTransaction_Stub(
  275.     IRpcStubBuffer *This,
  276.     IRpcChannelBuffer *_pRpcChannelBuffer,
  277.     PRPC_MESSAGE _pRpcMessage,
  278.     DWORD *_pdwStubPhase);
  279.  
  280.  
  281. HRESULT STDMETHODCALLTYPE IDistributionStore_AddTransactionCommands_Proxy( 
  282.     IDistributionStore __RPC_FAR * This,
  283.     ULONG cCommandDescs,
  284.     const DISTCOMMANDDESC __RPC_FAR rgCommandDescs[  ]);
  285.  
  286.  
  287. void __RPC_STUB IDistributionStore_AddTransactionCommands_Stub(
  288.     IRpcStubBuffer *This,
  289.     IRpcChannelBuffer *_pRpcChannelBuffer,
  290.     PRPC_MESSAGE _pRpcMessage,
  291.     DWORD *_pdwStubPhase);
  292.  
  293.  
  294. HRESULT STDMETHODCALLTYPE IDistributionStore_StartTransaction_Proxy( 
  295.     IDistributionStore __RPC_FAR * This);
  296.  
  297.  
  298. void __RPC_STUB IDistributionStore_StartTransaction_Stub(
  299.     IRpcStubBuffer *This,
  300.     IRpcChannelBuffer *_pRpcChannelBuffer,
  301.     PRPC_MESSAGE _pRpcMessage,
  302.     DWORD *_pdwStubPhase);
  303.  
  304.  
  305. #endif     /* __IDistributionStore_INTERFACE_DEFINED__ */
  306.  
  307. #ifndef __IDistributionLog_FWD_DEFINED__
  308. #define __IDistributionLog_FWD_DEFINED__
  309. typedef interface IDistributionLog IDistributionLog;
  310. #endif     /* __IDistributionLog_FWD_DEFINED__ */
  311.  
  312. #ifndef __IDistributionLog_INTERFACE_DEFINED__
  313. #define __IDistributionLog_INTERFACE_DEFINED__
  314.  
  315. EXTERN_C const IID IID_IDistributionLog;
  316.  
  317. #if defined(__cplusplus) && !defined(CINTERFACE)
  318.     
  319.     interface IDistributionLog : public IUnknown
  320.     {
  321.     public:
  322.         virtual HRESULT STDMETHODCALLTYPE AddLog( 
  323.             /* [in] */ DWORD dwStatusId,
  324.             /* [in] */ LPSTR szComment,
  325.             /* [in] */ BYTE* pXactSeqno,
  326.             /* [in] */ ULONG ulTransactions,
  327.             /* [in] */ ULONG ulCommands,
  328.             /* [in] */ ULONG cErrorDescs,
  329.             /* [size_is][in] */ const DISTERRORDESC __RPC_FAR rgErrorDescs[  ]) = 0;
  330.     };
  331.     
  332. #else     /* C style interface */
  333.  
  334.     typedef struct IDistributionLogVtbl
  335.     {
  336.         BEGIN_INTERFACE
  337.         
  338.         HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( 
  339.             IDistributionLog __RPC_FAR * This,
  340.             /* [in] */ REFIID riid,
  341.             /* [out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
  342.         
  343.         ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( 
  344.             IDistributionLog __RPC_FAR * This);
  345.         
  346.            HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AddLog )( 
  347.             IDistributionLog __RPC_FAR * This,
  348.             /* [in] */ DWORD dwStatusId,
  349.             /* [in] */ LPSTR szComment,
  350.             /* [in] */ BYTE* pXactSeqno,
  351.             /* [in] */ ULONG ulTransactions,
  352.             /* [in] */ ULONG ulCommands,
  353.             /* [in] */ ULONG cErrorDescs,
  354.             /* [size_is][in] */ const DISTERRORDESC __RPC_FAR rgErrorDescs[  ]);
  355.         
  356.         END_INTERFACE
  357.     } IDistributionLogVtbl;
  358.  
  359.     interface IDistributionLog
  360.     {
  361.         CONST_VTBL struct IDistributionLogVtbl __RPC_FAR *lpVtbl;
  362.     };
  363.  
  364.     
  365.  
  366. #ifdef COBJMACROS
  367.  
  368. #define IDistributionLog_QueryInterface(This,riid,ppvObject)    \
  369.     (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
  370.  
  371. #define IDistributionLog_AddRef(This)    \
  372.     (This)->lpVtbl -> AddRef(This)
  373.  
  374. #define IDistributionLog_Release(This)    \
  375.     (This)->lpVtbl -> Release(This)
  376.  
  377. #define IDistributionLog_AddLog(This)    \
  378.     (This)->lpVtbl -> AddLog(This, dwStatusId, szComment, pXactSeqno, cTransactions, cCommands, cErrorDescs, rgErrorDescs)
  379.  
  380. #endif /* COBJMACROS */
  381.  
  382.  
  383. #endif     /* C style interface */
  384.  
  385.  
  386. HRESULT STDMETHODCALLTYPE IDistributionLog_AddLog_Proxy( 
  387.     IDistributionLog __RPC_FAR * This,
  388.     DWORD dwStatusId,
  389.     LPSTR szComment,
  390.     BYTE* pXactSeqno,
  391.     ULONG ulTransactions,
  392.     ULONG ulCommands,
  393.     ULONG cErrorDescs,
  394.     const DISTERRORDESC __RPC_FAR rgErrorDescs[  ]);
  395.  
  396.  
  397. void __RPC_STUB IDistributionLog_AddLog_Stub(
  398.     IRpcStubBuffer *This,
  399.     IRpcChannelBuffer *_pRpcChannelBuffer,
  400.     PRPC_MESSAGE _pRpcMessage,
  401.     DWORD *_pdwStubPhase);
  402.  
  403. #endif     /* __IDistributionLog_INTERFACE_DEFINED__ */
  404.  
  405.  
  406. #ifndef __IGetCustomErrorInfo_FWD_DEFINED__
  407. #define __IGetCustomErrorInfo_FWD_DEFINED__
  408. typedef interface IGetCustomErrorInfo IGetCustomErrorInfo ;
  409. #endif     /* __IGetCustomErrorInfo_FWD_DEFINED__ */
  410.  
  411.  
  412. #ifndef __IGetCustomErrorInfo_INTERFACE_DEFINED__
  413. #define __IGetCustomErrorInfo_INTERFACE_DEFINED__
  414.  
  415. // @msg IID_IGetCustomErrorInfo |  {D83B7C8D-F22F-11d0-9AE8-00C04FB6B6EF}
  416. // Interface ID to the IGetCustomErrorInfo interface
  417. DEFINE_GUID(IID_IGetCustomErrorInfo, 0xd83b7c8d, 0xf22f, 0x11d0, 0x9a, 0xe8, 0x0, 0xc0, 0x4f, 0xb6, 0xb6, 0xef);
  418.  
  419. // @msg CLSID_DistErrorLookup | {246CBC55-F3E8-11d0-9AEB-00C04FB6B6EF}
  420. // ID of the Distribution Error Lookup Service class
  421. DEFINE_GUID(CLSID_DistErrorLookup,0x246cbc55, 0xf3e8, 0x11d0, 0x9a, 0xeb, 0x0, 0xc0, 0x4f, 0xb6, 0xb6, 0xef);
  422.  
  423.  
  424. EXTERN_C const IID IID_IGetCustomErrorInfo;
  425.  
  426. #if defined(__cplusplus) && !defined(CINTERFACE)
  427.     
  428.     interface IGetCustomErrorInfo : public IUnknown
  429.     {
  430.     public:
  431.         virtual HRESULT STDMETHODCALLTYPE GetCustomErrorInfo(DISTERRORDESC * pDistErrorDesc) = 0;
  432.     };
  433.     
  434. #else     /* C style interface */
  435.  
  436.     typedef struct IGetCustomErrorInfoVtbl
  437.     {
  438.         BEGIN_INTERFACE
  439.         
  440.         HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( 
  441.             IGetCustomErrorInfo __RPC_FAR * This,
  442.             /* [in] */ REFIID riid,
  443.             /* [out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
  444.         
  445.         ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( 
  446.             IGetCustomErrorInfo __RPC_FAR * This);
  447.         
  448.         ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( 
  449.             IGetCustomErrorInfo __RPC_FAR * This);
  450.         
  451.         HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCustomErrorInfo )( 
  452.             IGetCustomErrorInfo __RPC_FAR * This,
  453.             /* out */ REPL_ERROR * pReplError);
  454.         
  455.         END_INTERFACE
  456.     } IGetCustomErrorInfoVtbl;
  457.  
  458.     interface IGetCustomErrorInfo
  459.     {
  460.         CONST_VTBL struct IGetCustomErrorInfoVtbl __RPC_FAR *lpVtbl;
  461.     };
  462.  
  463.     
  464.  
  465. #ifdef COBJMACROS
  466.  
  467.  
  468. #define IGetCustomErrorInfo_QueryInterface(This,riid,ppvObject)    \
  469.     (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
  470.  
  471. #define IGetCustomErrorInfo_AddRef(This)    \
  472.     (This)->lpVtbl -> AddRef(This)
  473.  
  474. #define IGetCustomErrorInfo_Release(This)    \
  475.     (This)->lpVtbl -> Release(This)
  476.  
  477. #define IGetCustomErrorInfo_GetCustomErrorInfo(This,pReplError)    \
  478.     (This)->lpVtbl -> GetCustomErrorInfo(This,pReplError)
  479.  
  480. #endif /* COBJMACROS */
  481.  
  482.  
  483. #endif     /* C style interface */
  484.  
  485. #endif     /* __IGetCustomErrorInfo_INTERFACE_DEFINED__ */
  486.  
  487. #pragma option pop /*P_O_Pop*/
  488. #endif // _REPLDIST_H_
  489.