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 / appc / sendrecv.h < prev   
Text File  |  1997-04-09  |  4KB  |  139 lines

  1. /* sendrecv.h */
  2. /* (C) COPYRIGHT DATA CONNECTION LIMITED 1993 */
  3.  
  4. /*****************************************************************************/
  5. /* Change History                                                            */
  6. /*                                                                           */
  7. /*       04/05/93 NGR Created.                                               */
  8. /* OUT1  02/07/93 NGR Change output string                                   */
  9. /*****************************************************************************/
  10.  
  11. /* Global variables */
  12.  
  13. #ifdef DOS5
  14.   #include <os2.h>
  15.   #include <time.h>
  16.  
  17.   #define GetTickCount clock
  18.  
  19. #endif
  20.  
  21. typedef unsigned long RESULT;
  22.  
  23. #ifdef SENDTP
  24. union
  25. {
  26.    struct appc_hdr             hdr;
  27.    struct tp_started           tpstart;
  28.    struct mc_send_conversation sndconv;
  29.    struct mc_allocate          allocate;
  30.    struct mc_send_data         snddata;
  31.    struct mc_deallocate        deallocate;
  32.    struct mc_confirm           confirm;
  33.    struct tp_ended             tpend;
  34. } vcb;
  35. #else
  36. union
  37. {
  38.    struct appc_hdr             hdr;
  39.    struct receive_allocate     rcvalloc;
  40.    struct mc_receive_and_wait  rcvwait;
  41.    struct mc_confirmed         confirmed;
  42.    struct tp_ended             tpend;
  43. } vcb;
  44. #endif
  45. char FAR * vcbptr;
  46.  
  47. struct convert cnvt;
  48. char FAR * cnvtptr;
  49.  
  50. char LocalTPName[64];
  51. unsigned short SendSize;
  52. unsigned short NumConversations;
  53. BOOL TPDead;
  54. BOOL FirstConv;
  55. char FAR * DataPtr;
  56. RESULT ConvStarted;
  57. RESULT FAR * ResultPtr;
  58. RESULT FAR * ResultBuf;
  59. char FileName[60];
  60. unsigned short ConvCount;
  61. char TPid[8];
  62. unsigned long Convid;
  63.  
  64. #ifdef SENDTP
  65. char LocalLUAlias[8];
  66. char RemoteLUAlias[8];
  67. char ModeName[8];
  68. char RemoteTPName[64];
  69. unsigned short NumSends;
  70. unsigned short ConfirmEvery;
  71. BOOL SendConversation;
  72. char datach;
  73. unsigned short SendCount;
  74. unsigned short ConfirmCount;
  75. #else
  76. BOOL Deallocated;
  77. BOOL GotNumConv;
  78. int GetStage;
  79. #endif
  80.  
  81. #if (defined(WINDOWS)||defined(WIN32))
  82. HWND hWndMain;
  83. HANDLE async_corr;
  84. unsigned short ASYNC_COMPLETE;
  85. char title[30]={'\0'};
  86. #endif
  87.  
  88. /* Function prototypes */
  89.  
  90. #ifndef SYNC
  91. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  92.                    LPSTR lpCmdLine, int nCmdShow);
  93. BOOL InitialiseWinMain(HINSTANCE hInstance);
  94. LONG FAR PASCAL TPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  95. #else
  96. void main( int argc, char FAR * argv[]);
  97. #endif
  98. void InitialiseMain(void);
  99. void IssueNextVerb(void);
  100. void ProcessReturns(void);
  101. void ReadConfig(void);
  102. void CONV_A_TO_E(char FAR * string,int length);
  103. void CONV_E_TO_A(char FAR * string,int length);
  104. void NewConversation(void);
  105. int ReadString(char FAR * lpValueName, char FAR * lpData, int maxlen);
  106. void PadString(char FAR * string, int length);
  107. void OutputResults(void);
  108. void Build_TP_ENDED(void);
  109. #ifdef SENDTP
  110. void Build_TP_STARTED(void);
  111. void Build_MC_ALLOCATE(void);
  112. void Build_MC_DEALLOCATE(void);
  113. void Build_MC_SEND_DATA(void);
  114. void Build_MC_SEND_CONVERSATION(void);
  115. void Build_MC_CONFIRM(void);
  116. void GenerateData(void);
  117. void Send_Run_Details(void);
  118. #else
  119. void Build_RECEIVE_ALLOCATE(void);
  120. void Build_MC_RECEIVE_AND_WAIT(void);
  121. void Build_MC_CONFIRMED(void);
  122. void Get_Run_Details(void);
  123. #endif
  124.  
  125. /* Macros */
  126.  
  127. #define CLEARVCB memset(vcbptr,0,sizeof(vcb));
  128. #ifdef SYNC
  129. #define OUTPUTNUMBER printf("Conversation %d\n",ConvCount);
  130. #else
  131. #ifdef SENDTP
  132. #define OUTPUTNUMBER sprintf(title,"APPC Send TP %d",ConvCount); \
  133.                      SetWindowText(hWndMain,title);
  134. #else
  135. #define OUTPUTNUMBER sprintf(title,"APPC Receive TP %d",ConvCount); \
  136.                      SetWindowText(hWndMain,title);
  137. #endif
  138. #endif
  139.