Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

879 lines
21 KiB

  1. /*++
  2. Copyright (c) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. tcpdump.c
  5. Abstract:
  6. Contains all TCP structure dumping functions.
  7. Author:
  8. Scott Holden (sholden) 24-Apr-1999
  9. Revision History:
  10. --*/
  11. #include "tcpipxp.h"
  12. BOOL
  13. DumpTCB(
  14. TCB *pTcb,
  15. ULONG_PTR TcbAddr,
  16. VERB verb
  17. )
  18. /*++
  19. Routine Description:
  20. Dumps the TCB.
  21. Arguments:
  22. pTcb - Pointer to TCB.
  23. TcbAddr - Real address of TCB in tcpip.sys
  24. verb - Verbosity of dump. VERB_MIN and VERB_MAX supported.
  25. Return Value:
  26. ERROR_SUCCESS on success, else...
  27. --*/
  28. {
  29. BOOL status = TRUE;
  30. if (verb == VERB_MAX)
  31. {
  32. PrintStartNamedStruct(TCB, TcbAddr);
  33. #if DBG
  34. Print_sig(pTcb, tcb_sig);
  35. #endif
  36. Print_ptr(pTcb, tcb_next);
  37. Print_CTELock(pTcb, tcb_lock);
  38. Print_SeqNum(pTcb, tcb_senduna);
  39. Print_SeqNum(pTcb, tcb_sendnext);
  40. Print_SeqNum(pTcb, tcb_sendmax);
  41. Print_uint(pTcb, tcb_sendwin);
  42. Print_uint(pTcb, tcb_unacked);
  43. Print_uint(pTcb, tcb_maxwin);
  44. Print_uint(pTcb, tcb_cwin);
  45. Print_uint(pTcb, tcb_ssthresh);
  46. Print_uint(pTcb, tcb_phxsum);
  47. Print_ptr(pTcb, tcb_cursend);
  48. Print_ptr(pTcb, tcb_sendbuf);
  49. Print_uint(pTcb, tcb_sendofs);
  50. Print_uint(pTcb, tcb_sendsize);
  51. Print_Queue(pTcb, tcb_sendq);
  52. Print_SeqNum(pTcb, tcb_rcvnext);
  53. Print_int(pTcb, tcb_rcvwin);
  54. Print_SeqNum(pTcb, tcb_sendwl1);
  55. Print_SeqNum(pTcb, tcb_sendwl2);
  56. Print_ptr(pTcb, tcb_currcv);
  57. Print_uint(pTcb, tcb_indicated);
  58. Print_flags(pTcb, tcb_flags, FlagsTcb);
  59. Print_flags(pTcb, tcb_fastchk, FlagsFastChk);
  60. Print_PtrSymbol(pTcb, tcb_rcvhndlr);
  61. Print_IPAddr(pTcb, tcb_daddr);
  62. Print_IPAddr(pTcb, tcb_saddr);
  63. Print_port(pTcb, tcb_dport);
  64. Print_port(pTcb, tcb_sport);
  65. #if TRACE_EVENT
  66. Print_uint(pTcb, tcb_cpsize);
  67. Print_ptr(pTcb, tcb_cpcontext);
  68. #endif
  69. Print_ushort(pTcb, tcb_mss);
  70. Print_ushort(pTcb, tcb_rexmit);
  71. Print_uint(pTcb, tcb_refcnt);
  72. Print_SeqNum(pTcb, tcb_rttseq);
  73. Print_ushort(pTcb, tcb_smrtt);
  74. Print_ushort(pTcb, tcb_delta);
  75. Print_ushort(pTcb, tcb_remmss);
  76. Print_uchar(pTcb, tcb_slowcount);
  77. Print_uchar(pTcb, tcb_pushtimer);
  78. Print_enum(pTcb, tcb_state, StateTcb);
  79. Print_uchar(pTcb, tcb_rexmitcnt);
  80. Print_uchar(pTcb, tcb_pending);
  81. Print_uchar(pTcb, tcb_kacount);
  82. Print_ULONGhex(pTcb, tcb_error);
  83. Print_uint(pTcb, tcb_rtt);
  84. Print_ushort(pTcb, tcb_rexmittimer);
  85. Print_ushort(pTcb, tcb_delacktimer);
  86. Print_uint(pTcb, tcb_defaultwin);
  87. Print_uint(pTcb, tcb_alive);
  88. Print_ptr(pTcb, tcb_raq);
  89. Print_ptr(pTcb, tcb_rcvhead);
  90. Print_ptr(pTcb, tcb_rcvtail);
  91. Print_uint(pTcb, tcb_pendingcnt);
  92. Print_ptr(pTcb, tcb_pendhead);
  93. Print_ptr(pTcb, tcb_pendtail);
  94. Print_ptr(pTcb, tcb_connreq);
  95. Print_ptr(pTcb, tcb_conncontext);
  96. Print_uint(pTcb, tcb_bcountlow);
  97. Print_uint(pTcb, tcb_bcounthi);
  98. Print_uint(pTcb, tcb_totaltime);
  99. Print_ptr(pTcb, tcb_aonext);
  100. Print_ptr(pTcb, tcb_conn);
  101. Print_Queue(pTcb, tcb_delayq);
  102. Print_enum(pTcb, tcb_closereason, CloseReason);
  103. Print_uchar(pTcb, tcb_bhprobecnt);
  104. Print_ushort(pTcb, tcb_swstimer);
  105. Print_PtrSymbol(pTcb, tcb_rcvind);
  106. Print_ptr(pTcb, tcb_ricontext);
  107. Print_IPOptInfo(pTcb, tcb_opt, TCB, TcbAddr);
  108. Print_ptr(pTcb, tcb_rce);
  109. Print_ptr(pTcb, tcb_discwait);
  110. Print_ptr(pTcb, tcb_exprcv);
  111. Print_ptr(pTcb, tcb_urgpending);
  112. Print_uint(pTcb, tcb_urgcnt);
  113. Print_uint(pTcb, tcb_urgind);
  114. Print_SeqNum(pTcb, tcb_urgstart);
  115. Print_SeqNum(pTcb, tcb_urgend);
  116. Print_uint(pTcb, tcb_walkcount);
  117. Print_Queue(pTcb, tcb_TWQueue);
  118. Print_ushort(pTcb, tcb_dup);
  119. Print_ushort(pTcb, tcb_force);
  120. Print_ulong(pTcb, tcb_tcpopts);
  121. Print_ptr(pTcb, tcb_SackBlock);
  122. Print_ptr(pTcb, tcb_SackRcvd);
  123. Print_short(pTcb, tcb_sndwinscale);
  124. Print_short(pTcb, tcb_rcvwinscale);
  125. Print_int(pTcb, tcb_tsrecent);
  126. Print_SeqNum(pTcb, tcb_lastack);
  127. Print_int(pTcb, tcb_tsupdatetime);
  128. #if BUFFER_OWNERSHIP
  129. Print_ptr(pTcb, tcb_chainedrcvind);
  130. Print_ptr(pTcb, tcb_chainedrcvcontext);
  131. #endif
  132. Print_int(pTcb, tcb_ifDelAckTicks);
  133. #if GPC
  134. Print_ULONG(pTcb, tcb_GPCCachedIF);
  135. Print_ULONG(pTcb, tcb_GPCCachedLink);
  136. Print_ptr(pTcb, tcb_GPCCachedRTE);
  137. #endif
  138. Print_uint(pTcb, tcb_LargeSend);
  139. Print_uint(pTcb, tcb_more);
  140. Print_uint(pTcb, tcb_moreflag);
  141. Print_uint(pTcb, tcb_copied);
  142. Print_uint(pTcb, tcb_partition);
  143. Print_uinthex(pTcb, tcb_connid);
  144. PrintEndStruct();
  145. }
  146. else
  147. {
  148. printx("TCB %08lx ", TcbAddr);
  149. printx("sa: ");
  150. DumpIPAddr(pTcb->tcb_saddr);
  151. printx("da: ");
  152. DumpIPAddr(pTcb->tcb_daddr);
  153. printx("sp: %d ", htons(pTcb->tcb_sport));
  154. printx("dp: %d ", htons(pTcb->tcb_dport));
  155. printx("state: ");
  156. DumpEnum(pTcb->tcb_state, StateTcb);
  157. printx(ENDL);
  158. }
  159. return (status);
  160. }
  161. BOOL
  162. DumpTWTCB(
  163. TWTCB *pTwtcb,
  164. ULONG_PTR TwtcbAddr,
  165. VERB verb
  166. )
  167. /*++
  168. Routine Description:
  169. Dumps the TWTCB.
  170. Arguments:
  171. pTwtcb - Pointer to TWTCB.
  172. TwtcbAddr - Real address of TWTCB in tcpip.sys
  173. verb - Verbosity of dump. VERB_MIN and VERB_MAX supported.
  174. Return Value:
  175. ERROR_SUCCESS on success, else...
  176. --*/
  177. {
  178. BOOL status = TRUE;
  179. if (verb == VERB_MAX)
  180. {
  181. PrintStartNamedStruct(TWTCB, TwtcbAddr);
  182. #ifdef DEBUG
  183. Print_sig(pTwtcb, twtcb_sig);
  184. #endif
  185. Print_Queue(pTwtcb, twtcb_link);
  186. Print_IPAddr(pTwtcb, twtcb_daddr);
  187. Print_port(pTwtcb, twtcb_dport);
  188. Print_port(pTwtcb, twtcb_sport);
  189. Print_ushort(pTwtcb, twtcb_delta);
  190. Print_ushort(pTwtcb, twtcb_rexmittimer);
  191. Print_Queue(pTwtcb, twtcb_TWQueue);
  192. Print_IPAddr(pTwtcb, twtcb_saddr);
  193. Print_SeqNum(pTwtcb, twtcb_senduna);
  194. Print_SeqNum(pTwtcb, twtcb_rcvnext);
  195. PrintEndStruct();
  196. }
  197. else
  198. {
  199. printx("TWTCB %08lx ", TwtcbAddr);
  200. printx("sa: ");
  201. DumpIPAddr(pTwtcb->twtcb_saddr);
  202. printx("da: ");
  203. DumpIPAddr(pTwtcb->twtcb_daddr);
  204. printx("sp: %d ", htons(pTwtcb->twtcb_sport));
  205. printx("dp: %d ", htons(pTwtcb->twtcb_dport));
  206. printx("( ");
  207. printx(") ");
  208. printx(ENDL);
  209. }
  210. return (status);
  211. }
  212. BOOL
  213. DumpAddrObj(
  214. AddrObj *pAo,
  215. ULONG_PTR AddrObjAddr,
  216. VERB verb
  217. )
  218. {
  219. BOOL fStatus = TRUE;
  220. if (verb == VERB_MAX)
  221. {
  222. PrintStartNamedStruct(AddrObj, AddrObjAddr);
  223. #if DBG
  224. Print_sig(pAo, ao_sig);
  225. #endif
  226. Print_ptr(pAo, ao_next);
  227. Print_CTELock(pAo, ao_lock);
  228. Print_ptr(pAo, ao_request);
  229. Print_Queue(pAo, ao_sendq);
  230. Print_Queue(pAo, ao_pendq);
  231. Print_Queue(pAo, ao_rcvq);
  232. Print_IPOptInfo(pAo, ao_opt, AddrObj, AddrObjAddr);
  233. Print_IPAddr(pAo, ao_addr);
  234. Print_port(pAo, ao_port);
  235. Print_flags(pAo, ao_flags, FlagsAO);
  236. Print_enum(pAo, ao_prot, Prot);
  237. Print_uchar(pAo, ao_index);
  238. Print_uint(pAo, ao_listencnt);
  239. Print_ushort(pAo, ao_usecnt);
  240. Print_ushort(pAo, ao_inst);
  241. Print_ushort(pAo, ao_mcast_loop);
  242. Print_ushort(pAo, ao_rcvall);
  243. Print_ushort(pAo, ao_rcvall_mcast);
  244. Print_IPOptInfo(pAo, ao_mcastopt, AddrObj, AddrObjAddr);
  245. Print_IPAddr(pAo, ao_mcastaddr);
  246. Print_Queue(pAo, ao_activeq);
  247. Print_Queue(pAo, ao_idleq);
  248. Print_Queue(pAo, ao_listenq);
  249. Print_CTEEvent(pAo, ao_event);
  250. Print_PtrSymbol(pAo, ao_connect);
  251. Print_ptr(pAo, ao_conncontext);
  252. Print_PtrSymbol(pAo, ao_disconnect);
  253. Print_ptr(pAo, ao_disconncontext);
  254. Print_PtrSymbol(pAo, ao_error);
  255. Print_ptr(pAo, ao_errcontext);
  256. Print_PtrSymbol(pAo, ao_rcv);
  257. Print_ptr(pAo, ao_rcvcontext);
  258. Print_PtrSymbol(pAo, ao_rcvdg);
  259. Print_ptr(pAo, ao_rcvdgcontext);
  260. Print_PtrSymbol(pAo, ao_exprcv);
  261. Print_ptr(pAo, ao_exprcvcontext);
  262. Print_ptr(pAo, ao_mcastlist);
  263. Print_PtrSymbol(pAo, ao_dgsend);
  264. Print_ushort(pAo, ao_maxdgsize);
  265. Print_PtrSymbol(pAo, ao_errorex);
  266. Print_ptr(pAo, ao_errorexcontext);
  267. #ifdef SYN_ATTACK
  268. Print_BOOLEAN(pAo, ConnLimitReached);
  269. #endif
  270. #if BUFFER_OWNERSHIP
  271. Print_PtrSymbol(pAo, ao_chainedrcv);
  272. Print_ptr(pAo, ao_chainedrcvcontext);
  273. #if CONUDP
  274. Print_addr(pAo, ao_udpconn, AddrObj, AddrObjAddr);
  275. Print_ptr(pAo, ao_RemoteAddress);
  276. Print_ptr(pAo, ao_Options);
  277. Print_ptr(pAo, ao_rce);
  278. Print_ptr(pAo, ao_GPCHandle);
  279. Print_ULONG(pAo, ao_GPCCachedIF);
  280. Print_ULONG(pAo, ao_GPCCachedLink);
  281. Print_ptr(pAo, ao_GPCCachedRTE);
  282. Print_IPAddr(pAo, ao_rcesrc);
  283. Print_IPAddr(pAo, ao_destaddr);
  284. Print_port(pAo, ao_destport);
  285. Print_ushort(pAo, ao_SendInProgress);
  286. #endif // CONUDP
  287. Print_ulong(pAo, ao_promis_ifindex);
  288. #endif // BUFFER_OWNERSHIP
  289. Print_uchar(pAo, ao_absorb_rtralert);
  290. Print_ulong(pAo, ao_bindindex);
  291. PrintEndStruct();
  292. }
  293. else
  294. {
  295. printx("AO %08lx ", AddrObjAddr);
  296. DumpEnum(pAo->ao_prot, Prot);
  297. printx(" ipa: ");
  298. DumpIPAddr(pAo->ao_addr);
  299. printx("port: %d ", htons(pAo->ao_port));
  300. printx(ENDL);
  301. }
  302. return (fStatus);
  303. }
  304. BOOL
  305. DumpTCPReq(
  306. TCPReq *pTr,
  307. ULONG_PTR ReqAddr,
  308. VERB verb
  309. )
  310. {
  311. if (verb == VERB_MAX ||
  312. verb == VERB_MED)
  313. {
  314. PrintStartNamedStruct(TCPReq, ReqAddr);
  315. #if DBG
  316. Print_sig(pTr, tr_sig);
  317. #endif
  318. Print_Queue(pTr, tr_q);
  319. Print_PtrSymbol(pTr, tr_rtn);
  320. Print_ptr(pTr, tr_context);
  321. Print_int(pTr, tr_status);
  322. PrintEndStruct();
  323. }
  324. else
  325. {
  326. printx("TCPReq %08lx" ENDL, ReqAddr);
  327. }
  328. return (TRUE);
  329. }
  330. BOOL
  331. DumpTCPSendReq(
  332. TCPSendReq *pTsr,
  333. ULONG_PTR TsrAddr,
  334. VERB verb
  335. )
  336. {
  337. if (verb == VERB_MAX ||
  338. verb == VERB_MED)
  339. {
  340. PrintStartNamedStruct(TCPSendReq, TsrAddr);
  341. PrintFieldName("tsr_req");
  342. DumpTCPReq(
  343. &pTsr->tsr_req,
  344. TsrAddr + FIELD_OFFSET(TCPSendReq, tsr_req),
  345. verb);
  346. #if DBG
  347. Print_sig(pTsr, tsr_sig);
  348. #endif
  349. Print_uint(pTsr, tsr_size);
  350. Print_long(pTsr, tsr_refcnt);
  351. Print_flags(pTsr, tsr_flags, FlagsTsr);
  352. Print_uint(pTsr, tsr_unasize);
  353. Print_uint(pTsr, tsr_offset);
  354. Print_ptr(pTsr, tsr_buffer);
  355. Print_ptr(pTsr, tsr_lastbuf);
  356. Print_uint(pTsr, tsr_time);
  357. #ifdef SEND_DEBUG
  358. Print_ptr(pTsr, tsr_next);
  359. Print_uint(pTsr, tsr_timer);
  360. Print_uint(pTsr, tsr_cmplt);
  361. #endif
  362. PrintEndStruct();
  363. }
  364. else
  365. {
  366. printx("TCPSendReq %08lx" ENDL, TsrAddr);
  367. }
  368. return (TRUE);
  369. }
  370. BOOL
  371. DumpSendCmpltContext(
  372. SendCmpltContext *pScc,
  373. ULONG_PTR SccAddr,
  374. VERB verb
  375. )
  376. {
  377. if (verb == VERB_MAX ||
  378. verb == VERB_MED)
  379. {
  380. PrintStartNamedStruct(SendCmpltContext, SccAddr);
  381. #if DBG
  382. Print_sig(pScc, scc_sig);
  383. #endif
  384. Print_ulong(pScc, scc_SendSize);
  385. Print_ulong(pScc, scc_ByteSent);
  386. Print_ptr(pScc, scc_LargeSend);
  387. Print_ptr(pScc, scc_firstsend);
  388. Print_uint(pScc, scc_count);
  389. Print_ushort(pScc, scc_ubufcount);
  390. Print_ushort(pScc, scc_tbufcount);
  391. PrintEndStruct();
  392. }
  393. else
  394. {
  395. printx("SendCmpltContext %08lx" ENDL, SccAddr);
  396. }
  397. return (TRUE);
  398. }
  399. BOOL
  400. DumpTCPRcvReq(
  401. TCPRcvReq *pTrr,
  402. ULONG_PTR TrrAddr,
  403. VERB verb
  404. )
  405. {
  406. if (verb == VERB_MAX ||
  407. verb == VERB_MED)
  408. {
  409. PrintStartNamedStruct(TCPRcvReq, TrrAddr);
  410. #if DBG
  411. Print_sig(pTrr, trr_sig);
  412. #endif
  413. Print_ptr(pTrr, trr_next);
  414. Print_PtrSymbol(pTrr, trr_rtn);
  415. Print_ptr(pTrr, trr_context);
  416. Print_uint(pTrr, trr_amt);
  417. Print_uint(pTrr, trr_offset);
  418. Print_uint(pTrr, trr_flags);
  419. Print_ptr(pTrr, trr_uflags);
  420. Print_uint(pTrr, trr_size);
  421. Print_ptr(pTrr, trr_buffer);
  422. PrintEndStruct();
  423. }
  424. else
  425. {
  426. printx("TCPRcvReq %08lx" ENDL, TrrAddr);
  427. }
  428. return (TRUE);
  429. }
  430. BOOL
  431. DumpTCPRAHdr(
  432. TCPRAHdr *pTrh,
  433. ULONG_PTR TrhAddr,
  434. VERB verb
  435. )
  436. {
  437. if (verb == VERB_MAX ||
  438. verb == VERB_MED)
  439. {
  440. PrintStartNamedStruct(TCPRAHdr, TrhAddr);
  441. #if DBG
  442. Print_sig(pTrh, trh_sig);
  443. #endif
  444. Print_ptr(pTrh, trh_next);
  445. Print_SeqNum(pTrh, trh_start);
  446. Print_uint(pTrh, trh_size);
  447. Print_uint(pTrh, trh_flags);
  448. Print_uint(pTrh, trh_urg);
  449. Print_ptr(pTrh, trh_buffer);
  450. Print_ptr(pTrh, trh_end);
  451. PrintEndStruct();
  452. }
  453. else
  454. {
  455. printx("TCPRAHdr %08lx" ENDL, TrhAddr);
  456. }
  457. return (TRUE);
  458. }
  459. BOOL
  460. DumpDGSendReq(
  461. DGSendReq *pDsr,
  462. ULONG_PTR DsrAddr,
  463. VERB verb
  464. )
  465. {
  466. if (verb == VERB_MAX ||
  467. verb == VERB_MED)
  468. {
  469. PrintStartNamedStruct(DGSendReq, DsrAddr);
  470. #if DBG
  471. Print_sig(pDsr, dsr_sig);
  472. #endif
  473. Print_Queue(pDsr, dsr_q);
  474. Print_IPAddr(pDsr, dsr_addr);
  475. Print_ptr(pDsr, dsr_buffer);
  476. Print_ptr(pDsr, dsr_header);
  477. Print_PtrSymbol(pDsr, dsr_rtn);
  478. Print_ptr(pDsr, dsr_context);
  479. Print_ushort(pDsr, dsr_size);
  480. Print_port(pDsr, dsr_port);
  481. PrintEndStruct();
  482. }
  483. else
  484. {
  485. printx("DGSendReq %08lx" ENDL, DsrAddr);
  486. }
  487. return (TRUE);
  488. }
  489. BOOL
  490. DumpDGRcvReq(
  491. DGRcvReq *pDrr,
  492. ULONG_PTR DrrAddr,
  493. VERB verb
  494. )
  495. {
  496. if (verb == VERB_MAX ||
  497. verb == VERB_MED)
  498. {
  499. PrintStartNamedStruct(DGRcvReq, DrrAddr);
  500. #if DBG
  501. Print_sig(pDrr, drr_sig);
  502. #endif
  503. Print_Queue(pDrr, drr_q);
  504. Print_IPAddr(pDrr, drr_addr);
  505. Print_ptr(pDrr, drr_buffer);
  506. Print_ptr(pDrr, drr_conninfo);
  507. Print_PtrSymbol(pDrr, drr_rtn);
  508. Print_ptr(pDrr, drr_context);
  509. Print_ushort(pDrr, drr_size);
  510. Print_port(pDrr, drr_port);
  511. PrintEndStruct();
  512. }
  513. else
  514. {
  515. printx("DGRcvReq %08lx" ENDL, DrrAddr);
  516. }
  517. return (TRUE);
  518. }
  519. BOOL
  520. DumpTCPConn(
  521. TCPConn *pTc,
  522. ULONG_PTR TcAddr,
  523. VERB verb
  524. )
  525. {
  526. if (verb == VERB_MAX ||
  527. verb == VERB_MED)
  528. {
  529. PrintStartNamedStruct(TCPConn, TcAddr);
  530. #if DBG
  531. Print_sig(pTc, tc_sig);
  532. #endif
  533. Print_Queue(pTc, tc_q);
  534. Print_ptr(pTc, tc_tcb);
  535. Print_ptr(pTc, tc_ao);
  536. Print_uchar(pTc, tc_inst)
  537. Print_flags(pTc, tc_flags, FlagsTCPConn);
  538. Print_ushort(pTc, tc_refcnt);
  539. Print_ptr(pTc, tc_context);
  540. Print_PtrSymbol(pTc, tc_rtn);
  541. Print_ptr(pTc, tc_rtncontext);
  542. Print_PtrSymbol(pTc, tc_donertn);
  543. Print_flags(pTc, tc_tcbflags, FlagsTcb);
  544. #if TRACE_EVENT
  545. Print_ptr(pTc, tc_cpcontext);
  546. #endif
  547. Print_uint(pTc, tc_tcbkatime);
  548. Print_uint(pTc, tc_tcbkainterval);
  549. Print_uint(pTc, tc_window);
  550. Print_ptr(pTc, tc_LastTCB);
  551. Print_ptr(pTc, tc_ConnBlock);
  552. Print_uint(pTc, tc_connid);
  553. PrintEndStruct();
  554. }
  555. else
  556. {
  557. printx("TCPConn %08lx tcb %x ao %x", TcAddr, pTc->tc_tcb, pTc->tc_ao);
  558. printx(" flags (");
  559. DumpFlags(pTc->tc_flags, FlagsTCPConn);
  560. printx(") tcbflags (");
  561. DumpFlags(pTc->tc_tcbflags, FlagsTcb);
  562. printx(")" ENDL);
  563. }
  564. return (TRUE);
  565. }
  566. BOOL
  567. DumpTCPConnBlock(
  568. TCPConnBlock *pCb,
  569. ULONG_PTR CbAddr,
  570. VERB verb
  571. )
  572. {
  573. uint i;
  574. if (verb == VERB_MAX)
  575. {
  576. PrintStartNamedStruct(TCPConnBlock, CbAddr);
  577. Print_CTELock(pCb, cb_lock);
  578. Print_uint(pCb, cb_freecons);
  579. Print_uint(pCb, cb_nextfree);
  580. Print_uint(pCb, cb_blockid);
  581. Print_uint(pCb, cb_conninst);
  582. for (i = 0; i < MAX_CONN_PER_BLOCK; i++)
  583. {
  584. Print_ptr(pCb, cb_conn[i]);
  585. }
  586. PrintEndStruct();
  587. }
  588. else if (verb == VERB_MED)
  589. {
  590. PrintStartNamedStruct(TCPConnBlock, CbAddr);
  591. Print_CTELock(pCb, cb_lock);
  592. Print_uint(pCb, cb_freecons);
  593. Print_uint(pCb, cb_nextfree);
  594. Print_uint(pCb, cb_blockid);
  595. Print_uint(pCb, cb_conninst);
  596. PrintEndStruct();
  597. }
  598. else
  599. {
  600. printx("TCPConnBlock %08lx" ENDL, CbAddr);
  601. }
  602. return (TRUE);
  603. }
  604. BOOL
  605. DumpFILE_OBJECT(
  606. FILE_OBJECT *pFo,
  607. ULONG_PTR FoAddr,
  608. VERB verb
  609. )
  610. {
  611. if (verb == VERB_MAX)
  612. {
  613. PrintStartNamedStruct(FILE_OBJECT, FoAddr);
  614. Print_short(pFo, Type);
  615. Print_short(pFo, Size);
  616. Print_ptr(pFo, DeviceObject);
  617. Print_ptr(pFo, FsContext);
  618. Print_enum(pFo, FsContext2, FsContext2);
  619. Print_BOOLEAN(pFo, LockOperation);
  620. Print_BOOLEAN(pFo, DeletePending);
  621. Print_BOOLEAN(pFo, ReadAccess);
  622. Print_BOOLEAN(pFo, WriteAccess);
  623. Print_BOOLEAN(pFo, DeleteAccess);
  624. Print_BOOLEAN(pFo, SharedRead);
  625. Print_BOOLEAN(pFo, SharedWrite);
  626. Print_BOOLEAN(pFo, SharedDelete);
  627. Print_ULONGhex(pFo, Flags);
  628. Print_UNICODE_STRING(pFo, FileName);
  629. Print_ULONG(pFo, Waiters);
  630. Print_ULONG(pFo, Busy);
  631. PrintEndStruct();
  632. }
  633. else
  634. {
  635. printx("FILE_OBJECT %x FsContext %x FsContext2 ",
  636. FoAddr, pFo->FsContext);
  637. DumpEnum((ULONG_PTR) pFo->FsContext2, FsContext2);
  638. printx(ENDL);
  639. }
  640. return (TRUE);
  641. }
  642. BOOL
  643. DumpTCPHeader(
  644. TCPHeader *pTcp,
  645. ULONG_PTR TcpAddr,
  646. VERB verb
  647. )
  648. {
  649. PrintStartNamedStruct(TCPHeader, TcpAddr);
  650. Print_port(pTcp, tcp_src);
  651. Print_port(pTcp, tcp_dest);
  652. Print_SeqNum(pTcp, tcp_seq);
  653. Print_SeqNum(pTcp, tcp_ack);
  654. PrintFieldName("tcp_flags:size");
  655. printx("%-10lu" ENDL, TCP_HDR_SIZE(pTcp));
  656. Print_flags(pTcp, tcp_flags, FlagsTCPHeader);
  657. Print_ushorthton(pTcp, tcp_window);
  658. Print_ushorthton(pTcp, tcp_xsum);
  659. Print_ushorthton(pTcp, tcp_urgent);
  660. PrintEndStruct();
  661. return (TRUE);
  662. }
  663. BOOL
  664. DumpUDPHeader(
  665. UDPHeader *pUdp,
  666. ULONG_PTR UdpAddr,
  667. VERB verb
  668. )
  669. {
  670. PrintStartNamedStruct(UDPHeader, UdpAddr);
  671. Print_port(pUdp, uh_src);
  672. Print_port(pUdp, uh_dest);
  673. Print_ushorthton(pUdp, uh_length);
  674. Print_ushorthton(pUdp, uh_xsum);
  675. PrintEndStruct();
  676. return (TRUE);
  677. }
  678. BOOL
  679. DumpTCP_CONTEXT(
  680. TCP_CONTEXT *pTc,
  681. ULONG_PTR TcAddr,
  682. VERB verb
  683. )
  684. {
  685. PrintStartNamedStruct(TCP_CONTEXT, TcAddr);
  686. Print_ptr(pTc, Handle);
  687. Print_ULONG(pTc, ReferenceCount);
  688. Print_BOOLEAN(pTc, CancelIrps);
  689. Print_BOOLEAN(pTc, Cleanup);
  690. #if DBG
  691. Print_LL(pTc, PendingIrpList);
  692. Print_LL(pTc, CancelledIrpList);
  693. #endif
  694. Print_KEVENT(pTc, CleanupEvent);
  695. Print_UINT_PTR(pTc, Conn);
  696. Print_ptr(pTc, Irp);
  697. PrintEndStruct();
  698. return (TRUE);
  699. }
  700. BOOL
  701. DumpTCP_CONTEXT_typed(
  702. TCP_CONTEXT *pTc,
  703. ULONG_PTR TcAddr,
  704. VERB verb,
  705. ULONG FsContext2
  706. )
  707. {
  708. if (verb == VERB_MAX)
  709. {
  710. PrintStartNamedStruct(TCP_CONTEXT, TcAddr);
  711. switch (FsContext2)
  712. {
  713. case TDI_TRANSPORT_ADDRESS_FILE:
  714. dprintf("TDI_TRANSPORT_ADDRESS_FILE" ENDL);
  715. Print_ptr(pTc, Handle.AddressHandle);
  716. break;
  717. case TDI_CONNECTION_FILE:
  718. dprintf("TDI_CONNECTION_FILE" ENDL);
  719. Print_ptr(pTc, Handle.ConnectionContext);
  720. break;
  721. case TDI_CONTROL_CHANNEL_FILE:
  722. dprintf("TDI_CONTROL_CHANNEL_FILE" ENDL);
  723. Print_ptr(pTc, Handle.ControlChannel);
  724. break;
  725. default:
  726. dprintf("INVALID FsContex2" ENDL);
  727. break;
  728. }
  729. Print_ULONG(pTc, ReferenceCount);
  730. Print_BOOLEAN(pTc, CancelIrps);
  731. Print_BOOLEAN(pTc, Cleanup);
  732. #if DBG
  733. Print_LL(pTc, PendingIrpList);
  734. Print_LL(pTc, CancelledIrpList);
  735. #endif
  736. Print_KEVENT(pTc, CleanupEvent);
  737. Print_UINT_PTR(pTc, Conn);
  738. Print_ptr(pTc, Irp);
  739. PrintEndStruct();
  740. }
  741. else
  742. {
  743. printx("TCP_CONTEXT %x ", TcAddr);
  744. switch (FsContext2)
  745. {
  746. case TDI_TRANSPORT_ADDRESS_FILE:
  747. dprintf("TDI_TRANSPORT_ADDRESS_FILE ");
  748. Print_ptr(pTc, Handle.AddressHandle);
  749. break;
  750. case TDI_CONNECTION_FILE:
  751. dprintf("TDI_CONNECTION_FILE ");
  752. Print_ptr(pTc, Handle.ConnectionContext);
  753. break;
  754. case TDI_CONTROL_CHANNEL_FILE:
  755. dprintf("TDI_CONTROL_CHANNEL_FILE ");
  756. Print_ptr(pTc, Handle.ControlChannel);
  757. break;
  758. default:
  759. dprintf("INVALID FsContex2" ENDL);
  760. break;
  761. }
  762. printx(" RefCnt = %d" ENDL, pTc->ReferenceCount);
  763. }
  764. return (TRUE);
  765. }