home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / netds / sna / aremote / appclib.h < prev    next >
C/C++ Source or Header  |  1997-04-09  |  2KB  |  80 lines

  1. #define CLEARVCB(vcb) memset(&vcb, 0, sizeof(vcb))
  2.  
  3. #undef DEBUG
  4. #undef DEBUGCALLS
  5.  
  6. #ifdef DEBUGCALLS
  7. #define ASYNCAPPC(handle, vcbp, hasync) {                             \
  8.     printf("asyncappc: %x . . . ", APPC_FLIPI(vcbp->hdr.opcode));     \
  9.     hasync = WinAsyncAPPCEx(handle, (long) vcbp);                     \
  10.     printf("done\n");                                                \
  11. }
  12. #else
  13. #define ASYNCAPPC(handle, vcbp, hasync)                             \
  14.     hasync = WinAsyncAPPCEx(handle, (long) vcbp)
  15. #endif
  16.  
  17. #ifdef DEBUG
  18. #define APPCDBG(x) x
  19. #else
  20. #define APPCDBG(x)
  21. #endif
  22.  
  23. #define WINAPPCVERSION 0x0001
  24.  
  25. typedef union vcb_u {
  26.     struct appc_hdr                 hdr;
  27.     struct receive_allocate         rcvalloc;
  28.     struct mc_receive_and_wait      rcvwait;
  29.     struct tp_ended                 tpend;
  30.     struct tp_started                tpstart;
  31.     struct mc_allocate                allocate;
  32.     struct mc_send_data                snddata;
  33.     struct mc_flush                    flush;
  34.     struct mc_prepare_to_receive    torec;
  35.     struct mc_confirm                confirm;
  36.     struct mc_confirmed                confirmed;
  37.     struct mc_deallocate            dealloc;
  38.     struct mc_get_attributes        getattrib;
  39. } vcb_t;
  40.  
  41. typedef struct tpconvid_st {
  42.     /* TP ID and Conversation ID for read conversation */
  43.     unsigned char                r_tp_id[8];
  44.     unsigned long int             r_conv_id;
  45.     unsigned char                r_valid;
  46.     /* TP ID and Conversation ID for write conversation */
  47.     unsigned char                w_tp_id[8];
  48.     unsigned long int            w_conv_id;
  49.     unsigned char                 w_valid;
  50. } *tpconvid_t;
  51.  
  52. // this has the fully qualified partner lu name and time used for identifing 
  53. // incoming sessions
  54. typedef struct name_time_st {
  55.     unsigned char                fqplu_name[17];
  56.     DWORD                        time;
  57. } name_time_t;
  58.  
  59. typedef struct readnode_st {
  60.     name_time_t                    name_time;
  61.     tpconvid_t                    tpconv;
  62. } *readnode_t;
  63.  
  64. // --- error codes ---
  65. #define APPCLIB_ERROR_BASE 0x20000000                // bit 29 is user error
  66.  
  67. #define APPCLIB_ASYNC_FAILED APPCLIB_ERROR_BASE + 0    // WinAPPCAsyncEx failed
  68. #define APPCLIB_NO_INIT APPCLIB_ERROR_BASE + 1        // appcinit() wasn't called
  69.  
  70. // --- exported function prototypes ---
  71. int appcinit(void);
  72. BOOL WINAPI appcdestroy(void);
  73. tpconvid_t appclisten(TCHAR *tpname);
  74. tpconvid_t appcconnect(TCHAR *lu_alias, TCHAR *plu_alias, 
  75.                        TCHAR *tp_name, TCHAR *loc_tp_name, TCHAR *mode_name);
  76. int appcread(tpconvid_t tpconv, void *data, int maxlen);
  77. void appcwrite(tpconvid_t tpconv, void *data, int len);
  78. int appcvalid(tpconvid_t tpconv);
  79. void appcclose(tpconvid_t tpconv);
  80.