User Tools

Site Tools


cdc:nos2.source:nam5871:hgetda

HGETDA

Table Of Contents

  • [00014] PROC HGETDA(BUFADDR,SIZE,ACNALN,LIST,ABHWD)
  • [00096] PROC BDELINK
  • [00097] PROC DELCDR
  • [00098] PROC HSCAND
  • [00099] PROC HUPDDAW
  • [00100] PROC MRELS
  • [00101] PROC NBSTTP
  • [00102] PROC OMOVE
  • [00103] PROC XTRACE

Source Code

HGETDA.txt
  1. *DECK HGETDA
  2. USETEXT NIPDEF
  3. USETEXT ACB
  4. USETEXT ACNB
  5. USETEXT ACNT
  6. USETEXT AHEADER
  7. USETEXT APPSTAT
  8. USETEXT DEQCOM
  9. USETEXT DRHDR
  10. USETEXT FREETAB
  11. USETEXT NCNB
  12. USETEXT NP$NWNC
  13. USETEXT PT
  14. PROC HGETDA(BUFADDR,SIZE,ACNALN,LIST,ABHWD); # GET DATA MSG #
  15.  
  16. STARTIMS;
  17. #
  18. *1DC HGETDA
  19. *
  20. * 1. PROC NAME AUTHOR DATE
  21. * HGETDA E. GEE 85/05/01
  22. *
  23. * 2. FUNCTIONAL DESCRIPTION.
  24. * GET DATA MESSAGE TO DELIVER TO APPLICATION.
  25. *
  26. * 3. METHOD USED.
  27. * LOOP UNTIL NO REASON TO SCAN ANYMORE.
  28. * CALL HSCAND TO SCAN FOR DATA MESSAGE.
  29. * IF DATA MESSAGE FOUND,
  30. * CHECK IF IT IS TRANSPARENT MSG THAT MUST BE DISCARDED.
  31. * IF SO,
  32. * DISCARD DATA MESSAGE AND CONTINUE LOOPING.
  33. * ELSE (NO DATA MESSAGE FOUND),
  34. * DISCONTINUE SCANNING.
  35. * IF DATA MESSAGE FOUND,
  36. * CHECK IF DATA MESSAGE IS DELIVERABLE.
  37. * IF NOT DELIVERABLE,
  38. * RETURN ABH WORD WITH IBU BIT SET.
  39. * ELSE (DATA MESSAGE IS DELIVERABLE),
  40. * CALL BDELINK TO DELINK DATA MSG FROM ACNB DATA RING.
  41. * IF DATA MESSAGE NEEDS TO BE COPIED TO ANOTHER BUFFER,
  42. * CALL OMOVE TO COPY DATA MESSAGE TO SPECIFIED BUFFER.
  43. * IF NETWORK SIDE OF CONNECTION STILL EXISTS,
  44. * CALL NETWORK BLOCK STATE TABLE PROCESSOR TO SEND BACK.
  45. * IF HALF DUPLEX CONNECTION AND MSG OR QMSG BLK DELIVERED,
  46. * CALL HUPDTDB TO UPDATE DELIVERABLE MESSAGE STATUS.
  47. *
  48. * 4. ENTRY PARAMETERS.
  49. * ACBADDR ADDRESS OF ACB
  50. * BUFADDR ADDRESS OF BUFFER TO COPY DATA MSG TO
  51. * IF ZERO, DO NOT COPY DATA MSG
  52. * SIZE SIZE OF APP/NIP BUFFER FOR DATA MSG
  53. * ACNALN CONNECTION OR LIST NUMBER TO GET DATA FOR
  54. * LIST TYPE OF DATA TO GET
  55. * TRUE = GET DATA FOR LIST NUMBER
  56. * FALSE = GET DATA FOR CONNECTION NUMBER
  57. *
  58. * 5. EXIT PARAMETERS.
  59. * BUFADDR ADDRESS OF DELINKED DATA MESSAGE
  60. * SIZE SIZE OF DATA MESSAGE FOUND INCLUDING ABH WD
  61. * ABHWD APP BLK HEADER WORD OF DELINKED MESSAGE OR
  62. * OF UNDELIVERABLE DATA MESSAGE.
  63. * = 0 IF NO MESSAGE FOUND
  64. *
  65. * 6. COMDECKS CALLED AND SYMPL TEXTS USED.
  66. * NIPDEF CONSTANT DEFINITIONS
  67. * ACB APPLICATION CONTROL BLOCK
  68. * ACNB APPLICATION CONNECTION BLOCK
  69. * ACNT APPLICATION CONNECTION TABLE
  70. * AHEADER APPLICATION BLOCK HEADER WORD
  71. * APPSTAT APPLICATION STATUS COMMON BLOCK
  72. * DRHDR BUFFER HEADER WORD
  73. * FREETAB FREE BUFFER TABLE
  74. * NCNB NETWORK CONNECTION BLOCK
  75. * NP$NWNC CHARACTER TYPE/WORD CONVERSION TABLE
  76. * PT POINTER TABLE
  77. *
  78. * 7. ROUTINES CALLED.
  79. * BDELINK DELINK DATA BLOCK FROM DATA RING
  80. * DELCDR DELINK ACNB FROM CONNECTION DATA RING
  81. * HSCAND SCAN FOR DATA MESSAGE TO DELIVER
  82. * HUPDDAW UPDATE DATA AVAILABLE WORD
  83. * MRELS RETURN BUFFER TO FREE BUFFER CHAIN
  84. * NBSTTP NETWORK BLOCK STATE TABLE PROCESSOR
  85. * OMOVE MOVE DATA FROM ONE BUFFER TO ANOTHER
  86. * XTRACE TRACES CALLS
  87. *
  88. * 8. DAYFILE MESSAGES. NONE
  89. *
  90.  #
  91. STOPIMS;
  92. #
  93.   EXTERNAL VARIABLES
  94. #
  95. XREF BEGIN
  96. PROC BDELINK; # DELINK DATA BLOCK FROM DATA RING #
  97. PROC DELCDR; # DELINK ACNB FROM CONNECTION DATA RING #
  98. PROC HSCAND; # SCAN FOR DATA MSG TO DELIVER TO APP #
  99. PROC HUPDDAW; # UPDATE DATA AVAILABLE WORD #
  100. PROC MRELS; # RETURN BUFFER TO FREE BUFFER CHAIN #
  101. PROC NBSTTP; # NETWORK BLOCK PROTOCOL STATE TABLE PROC #
  102. PROC OMOVE; # MOVE DATA FROM ONE BUFFER TO ANOTHER #
  103. PROC XTRACE; # RECORD CALLS #
  104. END
  105. #
  106.  INPUT VARIABLES
  107. #
  108. ITEM ACNALN; # ACN/ALN IN GET/GETL CALL #
  109. ITEM BUFADDR; # ADDR OF BLOCK TO WRITE TO UCP #
  110. # FOR OUTPUT, ADR OF DELINK MSG #
  111. ITEM LIST B; # LIST NUMBER SCAN FLAG #
  112. ITEM SIZE; # SIZE OF BUFFER TO COPY MSG TO #
  113. # FOR OUTPUT, SIZE OF DELINK MSG#
  114. #
  115.  OUTPUT VARIABLES
  116. #
  117. ITEM ABHWD U; # APP BLK HDR WD OF DELINKED MSG#
  118. ITEM FOUND B; # RESULT FROM DATA SEARCH SCAN #
  119.  
  120. #
  121.   INTERNAL VARIABLES
  122. #
  123. ITEM ACNBADR; # ACNB ADDRESS #
  124. ITEM ACNTINDX U ; # ACNT INDEX #
  125. ITEM BLKADDR; # ADDR OF DELINKED DATA BLOCK #
  126. ITEM BUFSIZE; # SIZE OF BUFFER TO HOLD MSG #
  127. ITEM OLDTLW; # SIZE OF DATA MSG IN WORDS #
  128. ITEM SCAN B; # SCAN ACNB FLAG #
  129. ITEM TLW; # TEXT LENGTH IN WORDS #
  130. ITEM TRUB B; # TRUNCATE DATA FLAG #
  131. ITEM STATE ; # CURRENT STATE OF CONNECTION #
  132.  
  133. #**********************************************************************#
  134.  
  135. BEGIN
  136. CONTROL IFEQ DEBUG,1 ;
  137. XTRACE("HGEDA") ;
  138. CONTROL FI;
  139.  
  140. P<ACB> = ACBADDR; # ADDRESS OF ACB #
  141. P<ACNT> = ACBACNT[0]; # ADDRESS OF CORRESPONDING ACNT #
  142. ABHWD = 0; # INITIALIZE WORD TO CONTAIN ABH#
  143. BUFSIZE = SIZE; # SAVE SIZE OF BUFFER #
  144. #
  145.   SCAN FOR DATA MESSAGE TO DELIVER
  146. #
  147. SCAN = TRUE; # INITIALIZE SCAN REQUIRED FLAG #
  148. FOR BUFSIZE=BUFSIZE WHILE SCAN
  149. DO # SCAN UNTIL TOLD TO STOP #
  150. BEGIN
  151. FOUND = FALSE; # ASSUME NO DATA MSG FOUND #
  152. ACNBADR = 0; # ADDRSS OF ACNB OF DATA MSG #
  153. HSCAND(ACNALN,LIST,FOUND,ACNBADR);
  154. IF FOUND
  155. THEN # DATA FOUND FOR DELIVERY TO APP#
  156. BEGIN
  157. P<ACNB> = ACNBADR; # ADDR OF ASSOCIATED ACNB #
  158. P<AHEADER> = ACNBDRFP[0] + BLKHSIZE;
  159. IF (ABHXPT[0] NQ 0) AND # TRANSPARENT DATA BLOCK #
  160. ACNBNXP[0] # DISCARD TRANSPARENT DATA BLKS #
  161. THEN # GET RID OF TRANSPARENT BLOCK #
  162. BEGIN
  163. #
  164.   DISCARD TRANSPARENT BLOCK THAT APP DOES NOT WANT
  165. #
  166. P<DRHDRWD> = ACNBDRFP[0];
  167. ACT = ABHACT[0]; # APP CHAR TYPE OF DELINKED MSG #
  168. BDELINK(ACNBADR,BLKADDR,BLKBS[0]-BLKHSIZE-ABHSIZE);
  169. #
  170.   RETURN BACK BLOCK TO NETWORK
  171. #
  172. TEMPBSN = ABHABN[0] ; # BSN FOR BACK BLOCK #
  173. P<NCNB> = ACNBNCNB[0]; # ADDRESS OF CORRESPOND NCNB #
  174. IF P<NCNB> NQ 0 # NETWORK SIDE STILL EXISTS #
  175. THEN
  176. BEGIN
  177. NBSTTP(P<NCNB>,SBACK,0); # SEND BACK #
  178. END
  179. MRELS(BLKADDR) ;
  180. END
  181. ELSE # NO NEED TO DISCARD BLOCK #
  182. BEGIN
  183. ACNTINDX = ACNBACN[0] + ACNTHSIZE - ACNTMINACN[0];
  184. SCAN = FALSE; # STOP SCANNING THROUGH CDR #
  185. END
  186. END
  187. ELSE # NO DATA MSG FOUND #
  188. BEGIN
  189. SCAN = FALSE; # STOP SCANNING THROUGH CDR #
  190. END
  191. END
  192. IF FOUND
  193. THEN # MSG TO SEND TO APP #
  194. BEGIN
  195. #
  196.   CHECK IF CONNECTION IS IN RIGHT STATE FOR RECEIVING DATA
  197. #
  198. STATE = ACNTIS[ACNTINDX]; # CURRENT STATE #
  199. IF (STATE EQ HBALLD) OR # ALL DATA ALLOWED STATE #
  200. (STATE EQ HBUPIDA) OR # UPLINE DATA ALLOWED STATE #
  201. (STATE EQ HBCNTM) # CONNECTION TERMINATED #
  202. THEN # CON IN STATE TO ALLOW DELIVERY#
  203. BEGIN
  204. ABHWD = ABHWORD[0]; # APP BLK HEADER OF MSG #
  205. P<AHEADER> = LOC(ABHWD); # APP BLOCK HEADER #
  206. ABHIBU[0] = 0; # INITIALIZE IBU BIT #
  207. ABHADR[0] = ACNBACN[0]; # SET ACN IN ABH WORD #
  208. #
  209.   CHECK IF DATA BLOCK IS DELIVERABLE
  210. #
  211. ACT = ACNBICT[0]; # INPUT ACT FOR CONNECTION #
  212. IF ABHABT[0] EQ APPCMD
  213. THEN # SYNCHRNOUS SUPERVISORY MSG #
  214. BEGIN
  215. IF ACNBSCT[0]
  216. THEN # DELIVER SYNC SUP MSGS IN ACT 3#
  217. BEGIN
  218. ACT = CT12ASCII;
  219. END
  220. ELSE # DELIVER SYNC SUP MSGS IN ACT 2#
  221. BEGIN
  222. ACT = CT8ASCII;
  223. END
  224. END
  225. TLW = (2*ABHTLC[0] + NW$ROUND[ACT])/NW$FACT[ACT];
  226. OLDTLW = TLW; # SIZE IN WORDS IF NO TRUNCATION#
  227. TRUB = BUFSIZE LS TLW; # TRUE IF BLOCK IS TOO LARGE #
  228. IF (ABHXPT[0] NQ 0) AND # TRANSPARENT DATA #
  229. (ACNBICT[0] EQ CT6DISPLAY) # ICT IS DISPLAY CODE #
  230. THEN # CANNOT DELIVER TRANSPARENT BLK#
  231. BEGIN
  232. ABHIBU[0] = 1; # BLOCK IS NOT DELIVERABLE #
  233. END
  234. ELSE # STILL OKAY TO DELIVER BLOCK #
  235. BEGIN
  236. IF (ACNBDT[0] EQ DT$INTA) AND # INTRA-HOST AA CONN #
  237. (ACNBICT[0] NQ ABHACT[0]) # ACT NOT SAME AS ICT #
  238. THEN # CANNOT DELIVER BAD ACT BLK #
  239. BEGIN
  240. ABHIBU[0] = 1; # BLOCK IS NOT DELIVERABLE #
  241. END
  242. ELSE # STILL OKAY TO DELIVER BLOCK #
  243. BEGIN
  244. IF TRUB
  245. THEN # BLOCK LARGER THAN APP BUF SIZE#
  246. BEGIN
  247. IF ACNBD[0] AND # DATA TRUNCATION ALLOWED #
  248. BUFADDR EQ 0 # RETURNING TEXT TO APP/ NOT NIP#
  249. THEN # OKAY TO TRUNCATE THE DATA #
  250. BEGIN
  251. ABHTRU[0] = 1; # SET DATA TRUNCATED FLAG #
  252. TLW = BUFSIZE; # INPUT BUFFER SIZE #
  253. ABHTLC[0] = TLW * NW$FACT[ACT] / 2;
  254. END
  255. ELSE # DATA TRUNCATION NOT ALLOWED #
  256. BEGIN
  257. ABHIBU[0] = 1; # BLOCK IS NOT DELIVERABLE #
  258. END
  259. END
  260. END
  261. END
  262. SIZE = TLW + ABHSIZE; # SIZE OF COMPLETE BLOCK #
  263. IF ABHIBU[0] EQ 0 # DATA MESSAGE IS DELIVERABLE #
  264. THEN # DATA MSG TO DELIVER TO APP #
  265. BEGIN
  266. #
  267.   DELINK DATA MSG AND COPY TO ANOTHER BUFFER IF NECESSARY
  268. #
  269. BDELINK(ACNBADR,BLKADDR,OLDTLW); # DELINK DATA MSG #
  270. IF BUFADDR EQ 0
  271. THEN # DO NOT NEED TO COPY DATA MSG #
  272. BEGIN
  273. BUFADDR = BLKADDR; # RETURN ADDR OF DATA BLK #
  274. END
  275. ELSE # COPY DATA MSG TO BUFFER #
  276. BEGIN
  277. MOLD = BLKADDR + BLKHSIZE + ABHSIZE;
  278. MNEW = BUFADDR + ABHSIZE;
  279. MSIZE = TLW; # NO OF WORDS TO COPY #
  280. OMOVE;
  281. MRELS(BLKADDR); # RELEASE BUFFER OF DATA MSG #
  282. END
  283. TEMPBSN = ABHABN[0];
  284. P<NCNB> = ACNBNCNB[0];
  285. IF P<NCNB> NQ 0
  286. THEN # NETWORK SIDE STILL EXISTS #
  287. BEGIN
  288. NBSTTP(P<NCNB>,SBACK,0);
  289. END
  290. ABHABN[0] = 0; # CLEAR NETWORK BSN #
  291. ABHACT[0] = ACT; # ACT OF MSG TO DELIVER #
  292. IF ACNBH[0] AND # HALF DUPLEX MODE IS ON #
  293. ( (ABHABT[0] EQ NETMSG) OR # DELIVERING MSG BLOCK TYPE #
  294. (ABHABT[0] EQ NETQMSG) ) # DELIVERING QMSG BLOCK TYPE #
  295. THEN # NEED TO SET TEMPORARY LIST OFF#
  296. BEGIN
  297. HUPDDAW(P<ACB>,P<ACNB>,0,-ACNBBLKSQ[0]);
  298. ACNBTLO[0] = TRUE; # SET TEMPORARY LIST OFF FLAG #
  299. END
  300. END
  301. END
  302. ELSE # CON IN WRONG STATE TO DELIVER #
  303. BEGIN
  304. FOUND = FALSE; # NO DATA BLOCK TO DELIVER #
  305. END
  306. END
  307. RETURN;
  308. END
  309. TERM
cdc/nos2.source/nam5871/hgetda.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator