Leaked source code of windows server 2003
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.

877 lines
22 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_rcvnext);
  194. PrintEndStruct();
  195. }
  196. else
  197. {
  198. printx("TWTCB %08lx ", TwtcbAddr);
  199. printx("sa: ");
  200. DumpIPAddr(pTwtcb->twtcb_saddr);
  201. printx("da: ");
  202. DumpIPAddr(pTwtcb->twtcb_daddr);
  203. printx("sp: %d ", htons(pTwtcb->twtcb_sport));
  204. printx("dp: %d ", htons(pTwtcb->twtcb_dport));
  205. printx("( ");
  206. printx(") ");
  207. printx(ENDL);
  208. }
  209. return (status);
  210. }
  211. BOOL
  212. DumpAddrObj(
  213. AddrObj *pAo,
  214. ULONG_PTR AddrObjAddr,
  215. VERB verb
  216. )
  217. {
  218. BOOL fStatus = TRUE;
  219. if (verb == VERB_MAX)
  220. {
  221. PrintStartNamedStruct(AddrObj, AddrObjAddr);
  222. #if DBG
  223. Print_sig(pAo, ao_sig);
  224. #endif
  225. Print_ptr(pAo, ao_next);
  226. Print_CTELock(pAo, ao_lock);
  227. Print_ptr(pAo, ao_request);
  228. Print_Queue(pAo, ao_sendq);
  229. Print_Queue(pAo, ao_pendq);
  230. Print_Queue(pAo, ao_rcvq);
  231. Print_IPOptInfo(pAo, ao_opt, AddrObj, AddrObjAddr);
  232. Print_IPAddr(pAo, ao_addr);
  233. Print_port(pAo, ao_port);
  234. Print_flags(pAo, ao_flags, FlagsAO);
  235. Print_enum(pAo, ao_prot, Prot);
  236. Print_uchar(pAo, ao_index);
  237. Print_uint(pAo, ao_listencnt);
  238. Print_ushort(pAo, ao_usecnt);
  239. Print_ushort(pAo, ao_inst);
  240. Print_ushort(pAo, ao_mcast_loop);
  241. Print_ushort(pAo, ao_rcvall);
  242. Print_ushort(pAo, ao_rcvall_mcast);
  243. Print_IPOptInfo(pAo, ao_mcastopt, AddrObj, AddrObjAddr);
  244. Print_Queue(pAo, ao_activeq);
  245. Print_Queue(pAo, ao_idleq);
  246. Print_Queue(pAo, ao_listenq);
  247. Print_CTEEvent(pAo, ao_event);
  248. Print_PtrSymbol(pAo, ao_connect);
  249. Print_ptr(pAo, ao_conncontext);
  250. Print_PtrSymbol(pAo, ao_disconnect);
  251. Print_ptr(pAo, ao_disconncontext);
  252. Print_PtrSymbol(pAo, ao_error);
  253. Print_ptr(pAo, ao_errcontext);
  254. Print_PtrSymbol(pAo, ao_rcv);
  255. Print_ptr(pAo, ao_rcvcontext);
  256. Print_PtrSymbol(pAo, ao_rcvdg);
  257. Print_ptr(pAo, ao_rcvdgcontext);
  258. Print_PtrSymbol(pAo, ao_exprcv);
  259. Print_ptr(pAo, ao_exprcvcontext);
  260. Print_ptr(pAo, ao_mcastlist);
  261. Print_PtrSymbol(pAo, ao_dgsend);
  262. Print_ushort(pAo, ao_maxdgsize);
  263. Print_PtrSymbol(pAo, ao_errorex);
  264. Print_ptr(pAo, ao_errorexcontext);
  265. #ifdef SYN_ATTACK
  266. Print_BOOLEAN(pAo, ConnLimitReached);
  267. #endif
  268. #if BUFFER_OWNERSHIP
  269. Print_PtrSymbol(pAo, ao_chainedrcv);
  270. Print_ptr(pAo, ao_chainedrcvcontext);
  271. #if CONUDP
  272. Print_addr(pAo, ao_udpconn, AddrObj, AddrObjAddr);
  273. Print_ptr(pAo, ao_RemoteAddress);
  274. Print_ptr(pAo, ao_Options);
  275. Print_ptr(pAo, ao_rce);
  276. Print_ptr(pAo, ao_GPCHandle);
  277. Print_ULONG(pAo, ao_GPCCachedIF);
  278. Print_ULONG(pAo, ao_GPCCachedLink);
  279. Print_ptr(pAo, ao_GPCCachedRTE);
  280. Print_IPAddr(pAo, ao_rcesrc);
  281. Print_IPAddr(pAo, ao_destaddr);
  282. Print_port(pAo, ao_destport);
  283. Print_ushort(pAo, ao_SendInProgress);
  284. #endif // CONUDP
  285. Print_ulong(pAo, ao_promis_ifindex);
  286. #endif // BUFFER_OWNERSHIP
  287. Print_uchar(pAo, ao_absorb_rtralert);
  288. Print_ulong(pAo, ao_bindindex);
  289. PrintEndStruct();
  290. }
  291. else
  292. {
  293. printx("AO %08lx ", AddrObjAddr);
  294. DumpEnum(pAo->ao_prot, Prot);
  295. printx(" ipa: ");
  296. DumpIPAddr(pAo->ao_addr);
  297. printx("port: %d ", htons(pAo->ao_port));
  298. printx(ENDL);
  299. }
  300. return (fStatus);
  301. }
  302. BOOL
  303. DumpTCPReq(
  304. TCPReq *pTr,
  305. ULONG_PTR ReqAddr,
  306. VERB verb
  307. )
  308. {
  309. if (verb == VERB_MAX ||
  310. verb == VERB_MED)
  311. {
  312. PrintStartNamedStruct(TCPReq, ReqAddr);
  313. #if DBG
  314. Print_sig(pTr, tr_sig);
  315. #endif
  316. Print_Queue(pTr, tr_q);
  317. Print_PtrSymbol(pTr, tr_rtn);
  318. Print_ptr(pTr, tr_context);
  319. Print_int(pTr, tr_status);
  320. PrintEndStruct();
  321. }
  322. else
  323. {
  324. printx("TCPReq %08lx" ENDL, ReqAddr);
  325. }
  326. return (TRUE);
  327. }
  328. BOOL
  329. DumpTCPSendReq(
  330. TCPSendReq *pTsr,
  331. ULONG_PTR TsrAddr,
  332. VERB verb
  333. )
  334. {
  335. if (verb == VERB_MAX ||
  336. verb == VERB_MED)
  337. {
  338. PrintStartNamedStruct(TCPSendReq, TsrAddr);
  339. PrintFieldName("tsr_req");
  340. DumpTCPReq(
  341. &pTsr->tsr_req,
  342. TsrAddr + FIELD_OFFSET(TCPSendReq, tsr_req),
  343. verb);
  344. #if DBG
  345. Print_sig(pTsr, tsr_sig);
  346. #endif
  347. Print_uint(pTsr, tsr_size);
  348. Print_long(pTsr, tsr_refcnt);
  349. Print_flags(pTsr, tsr_flags, FlagsTsr);
  350. Print_uint(pTsr, tsr_unasize);
  351. Print_uint(pTsr, tsr_offset);
  352. Print_ptr(pTsr, tsr_buffer);
  353. Print_ptr(pTsr, tsr_lastbuf);
  354. Print_uint(pTsr, tsr_time);
  355. #ifdef SEND_DEBUG
  356. Print_ptr(pTsr, tsr_next);
  357. Print_uint(pTsr, tsr_timer);
  358. Print_uint(pTsr, tsr_cmplt);
  359. #endif
  360. PrintEndStruct();
  361. }
  362. else
  363. {
  364. printx("TCPSendReq %08lx" ENDL, TsrAddr);
  365. }
  366. return (TRUE);
  367. }
  368. BOOL
  369. DumpSendCmpltContext(
  370. SendCmpltContext *pScc,
  371. ULONG_PTR SccAddr,
  372. VERB verb
  373. )
  374. {
  375. if (verb == VERB_MAX ||
  376. verb == VERB_MED)
  377. {
  378. PrintStartNamedStruct(SendCmpltContext, SccAddr);
  379. #if DBG
  380. Print_sig(pScc, scc_sig);
  381. #endif
  382. Print_ulong(pScc, scc_SendSize);
  383. Print_ulong(pScc, scc_ByteSent);
  384. Print_ptr(pScc, scc_LargeSend);
  385. Print_ptr(pScc, scc_firstsend);
  386. Print_uint(pScc, scc_count);
  387. Print_ushort(pScc, scc_ubufcount);
  388. Print_ushort(pScc, scc_tbufcount);
  389. PrintEndStruct();
  390. }
  391. else
  392. {
  393. printx("SendCmpltContext %08lx" ENDL, SccAddr);
  394. }
  395. return (TRUE);
  396. }
  397. BOOL
  398. DumpTCPRcvReq(
  399. TCPRcvReq *pTrr,
  400. ULONG_PTR TrrAddr,
  401. VERB verb
  402. )
  403. {
  404. if (verb == VERB_MAX ||
  405. verb == VERB_MED)
  406. {
  407. PrintStartNamedStruct(TCPRcvReq, TrrAddr);
  408. #if DBG
  409. Print_sig(pTrr, trr_sig);
  410. #endif
  411. Print_ptr(pTrr, trr_next);
  412. Print_PtrSymbol(pTrr, trr_rtn);
  413. Print_ptr(pTrr, trr_context);
  414. Print_uint(pTrr, trr_amt);
  415. Print_uint(pTrr, trr_offset);
  416. Print_uint(pTrr, trr_flags);
  417. Print_ptr(pTrr, trr_uflags);
  418. Print_uint(pTrr, trr_size);
  419. Print_ptr(pTrr, trr_buffer);
  420. PrintEndStruct();
  421. }
  422. else
  423. {
  424. printx("TCPRcvReq %08lx" ENDL, TrrAddr);
  425. }
  426. return (TRUE);
  427. }
  428. BOOL
  429. DumpTCPRAHdr(
  430. TCPRAHdr *pTrh,
  431. ULONG_PTR TrhAddr,
  432. VERB verb
  433. )
  434. {
  435. if (verb == VERB_MAX ||
  436. verb == VERB_MED)
  437. {
  438. PrintStartNamedStruct(TCPRAHdr, TrhAddr);
  439. #if DBG
  440. Print_sig(pTrh, trh_sig);
  441. #endif
  442. Print_ptr(pTrh, trh_next);
  443. Print_SeqNum(pTrh, trh_start);
  444. Print_uint(pTrh, trh_size);
  445. Print_uint(pTrh, trh_flags);
  446. Print_uint(pTrh, trh_urg);
  447. Print_ptr(pTrh, trh_buffer);
  448. Print_ptr(pTrh, trh_end);
  449. PrintEndStruct();
  450. }
  451. else
  452. {
  453. printx("TCPRAHdr %08lx" ENDL, TrhAddr);
  454. }
  455. return (TRUE);
  456. }
  457. BOOL
  458. DumpDGSendReq(
  459. DGSendReq *pDsr,
  460. ULONG_PTR DsrAddr,
  461. VERB verb
  462. )
  463. {
  464. if (verb == VERB_MAX ||
  465. verb == VERB_MED)
  466. {
  467. PrintStartNamedStruct(DGSendReq, DsrAddr);
  468. #if DBG
  469. Print_sig(pDsr, dsr_sig);
  470. #endif
  471. Print_Queue(pDsr, dsr_q);
  472. Print_IPAddr(pDsr, dsr_addr);
  473. Print_ptr(pDsr, dsr_buffer);
  474. Print_ptr(pDsr, dsr_header);
  475. Print_PtrSymbol(pDsr, dsr_rtn);
  476. Print_ptr(pDsr, dsr_context);
  477. Print_ushort(pDsr, dsr_size);
  478. Print_port(pDsr, dsr_port);
  479. PrintEndStruct();
  480. }
  481. else
  482. {
  483. printx("DGSendReq %08lx" ENDL, DsrAddr);
  484. }
  485. return (TRUE);
  486. }
  487. BOOL
  488. DumpDGRcvReq(
  489. DGRcvReq *pDrr,
  490. ULONG_PTR DrrAddr,
  491. VERB verb
  492. )
  493. {
  494. if (verb == VERB_MAX ||
  495. verb == VERB_MED)
  496. {
  497. PrintStartNamedStruct(DGRcvReq, DrrAddr);
  498. #if DBG
  499. Print_sig(pDrr, drr_sig);
  500. #endif
  501. Print_Queue(pDrr, drr_q);
  502. Print_IPAddr(pDrr, drr_addr);
  503. Print_ptr(pDrr, drr_buffer);
  504. Print_ptr(pDrr, drr_conninfo);
  505. Print_PtrSymbol(pDrr, drr_rtn);
  506. Print_ptr(pDrr, drr_context);
  507. Print_ushort(pDrr, drr_size);
  508. Print_port(pDrr, drr_port);
  509. PrintEndStruct();
  510. }
  511. else
  512. {
  513. printx("DGRcvReq %08lx" ENDL, DrrAddr);
  514. }
  515. return (TRUE);
  516. }
  517. BOOL
  518. DumpTCPConn(
  519. TCPConn *pTc,
  520. ULONG_PTR TcAddr,
  521. VERB verb
  522. )
  523. {
  524. if (verb == VERB_MAX ||
  525. verb == VERB_MED)
  526. {
  527. PrintStartNamedStruct(TCPConn, TcAddr);
  528. #if DBG
  529. Print_sig(pTc, tc_sig);
  530. #endif
  531. Print_Queue(pTc, tc_q);
  532. Print_ptr(pTc, tc_tcb);
  533. Print_ptr(pTc, tc_ao);
  534. Print_uchar(pTc, tc_inst)
  535. Print_flags(pTc, tc_flags, FlagsTCPConn);
  536. Print_ushort(pTc, tc_refcnt);
  537. Print_ptr(pTc, tc_context);
  538. Print_PtrSymbol(pTc, tc_rtn);
  539. Print_ptr(pTc, tc_rtncontext);
  540. Print_PtrSymbol(pTc, tc_donertn);
  541. Print_flags(pTc, tc_tcbflags, FlagsTcb);
  542. #if TRACE_EVENT
  543. Print_ptr(pTc, tc_cpcontext);
  544. #endif
  545. Print_uint(pTc, tc_tcbkatime);
  546. Print_uint(pTc, tc_tcbkainterval);
  547. Print_uint(pTc, tc_window);
  548. Print_ptr(pTc, tc_LastTCB);
  549. Print_ptr(pTc, tc_ConnBlock);
  550. Print_uint(pTc, tc_connid);
  551. PrintEndStruct();
  552. }
  553. else
  554. {
  555. printx("TCPConn %08lx tcb %x ao %x", TcAddr, pTc->tc_tcb, pTc->tc_ao);
  556. printx(" flags (");
  557. DumpFlags(pTc->tc_flags, FlagsTCPConn);
  558. printx(") tcbflags (");
  559. DumpFlags(pTc->tc_tcbflags, FlagsTcb);
  560. printx(")" ENDL);
  561. }
  562. return (TRUE);
  563. }
  564. BOOL
  565. DumpTCPConnBlock(
  566. TCPConnBlock *pCb,
  567. ULONG_PTR CbAddr,
  568. VERB verb
  569. )
  570. {
  571. uint i;
  572. if (verb == VERB_MAX)
  573. {
  574. PrintStartNamedStruct(TCPConnBlock, CbAddr);
  575. Print_CTELock(pCb, cb_lock);
  576. Print_uint(pCb, cb_freecons);
  577. Print_uint(pCb, cb_nextfree);
  578. Print_uint(pCb, cb_blockid);
  579. Print_uint(pCb, cb_conninst);
  580. for (i = 0; i < MAX_CONN_PER_BLOCK; i++)
  581. {
  582. Print_ptr(pCb, cb_conn[i]);
  583. }
  584. PrintEndStruct();
  585. }
  586. else if (verb == VERB_MED)
  587. {
  588. PrintStartNamedStruct(TCPConnBlock, CbAddr);
  589. Print_CTELock(pCb, cb_lock);
  590. Print_uint(pCb, cb_freecons);
  591. Print_uint(pCb, cb_nextfree);
  592. Print_uint(pCb, cb_blockid);
  593. Print_uint(pCb, cb_conninst);
  594. PrintEndStruct();
  595. }
  596. else
  597. {
  598. printx("TCPConnBlock %08lx" ENDL, CbAddr);
  599. }
  600. return (TRUE);
  601. }
  602. BOOL
  603. DumpFILE_OBJECT(
  604. FILE_OBJECT *pFo,
  605. ULONG_PTR FoAddr,
  606. VERB verb
  607. )
  608. {
  609. if (verb == VERB_MAX)
  610. {
  611. PrintStartNamedStruct(FILE_OBJECT, FoAddr);
  612. Print_short(pFo, Type);
  613. Print_short(pFo, Size);
  614. Print_ptr(pFo, DeviceObject);
  615. Print_ptr(pFo, FsContext);
  616. Print_enum(pFo, FsContext2, FsContext2);
  617. Print_BOOLEAN(pFo, LockOperation);
  618. Print_BOOLEAN(pFo, DeletePending);
  619. Print_BOOLEAN(pFo, ReadAccess);
  620. Print_BOOLEAN(pFo, WriteAccess);
  621. Print_BOOLEAN(pFo, DeleteAccess);
  622. Print_BOOLEAN(pFo, SharedRead);
  623. Print_BOOLEAN(pFo, SharedWrite);
  624. Print_BOOLEAN(pFo, SharedDelete);
  625. Print_ULONGhex(pFo, Flags);
  626. Print_UNICODE_STRING(pFo, FileName);
  627. Print_ULONG(pFo, Waiters);
  628. Print_ULONG(pFo, Busy);
  629. PrintEndStruct();
  630. }
  631. else
  632. {
  633. printx("FILE_OBJECT %x FsContext %x FsContext2 ",
  634. FoAddr, pFo->FsContext);
  635. DumpEnum((ULONG_PTR) pFo->FsContext2, FsContext2);
  636. printx(ENDL);
  637. }
  638. return (TRUE);
  639. }
  640. BOOL
  641. DumpTCPHeader(
  642. TCPHeader *pTcp,
  643. ULONG_PTR TcpAddr,
  644. VERB verb
  645. )
  646. {
  647. PrintStartNamedStruct(TCPHeader, TcpAddr);
  648. Print_port(pTcp, tcp_src);
  649. Print_port(pTcp, tcp_dest);
  650. Print_SeqNum(pTcp, tcp_seq);
  651. Print_SeqNum(pTcp, tcp_ack);
  652. PrintFieldName("tcp_flags:size");
  653. printx("%-10lu" ENDL, TCP_HDR_SIZE(pTcp));
  654. Print_flags(pTcp, tcp_flags, FlagsTCPHeader);
  655. Print_ushorthton(pTcp, tcp_window);
  656. Print_ushorthton(pTcp, tcp_xsum);
  657. Print_ushorthton(pTcp, tcp_urgent);
  658. PrintEndStruct();
  659. return (TRUE);
  660. }
  661. BOOL
  662. DumpUDPHeader(
  663. UDPHeader *pUdp,
  664. ULONG_PTR UdpAddr,
  665. VERB verb
  666. )
  667. {
  668. PrintStartNamedStruct(UDPHeader, UdpAddr);
  669. Print_port(pUdp, uh_src);
  670. Print_port(pUdp, uh_dest);
  671. Print_ushorthton(pUdp, uh_length);
  672. Print_ushorthton(pUdp, uh_xsum);
  673. PrintEndStruct();
  674. return (TRUE);
  675. }
  676. BOOL
  677. DumpTCP_CONTEXT(
  678. TCP_CONTEXT *pTc,
  679. ULONG_PTR TcAddr,
  680. VERB verb
  681. )
  682. {
  683. PrintStartNamedStruct(TCP_CONTEXT, TcAddr);
  684. Print_ptr(pTc, Handle);
  685. Print_ULONG(pTc, ReferenceCount);
  686. Print_BOOLEAN(pTc, CancelIrps);
  687. Print_BOOLEAN(pTc, Cleanup);
  688. #if DBG
  689. Print_LL(pTc, PendingIrpList);
  690. Print_LL(pTc, CancelledIrpList);
  691. #endif
  692. Print_KEVENT(pTc, CleanupEvent);
  693. Print_UINT_PTR(pTc, Conn);
  694. Print_ptr(pTc, Irp);
  695. PrintEndStruct();
  696. return (TRUE);
  697. }
  698. BOOL
  699. DumpTCP_CONTEXT_typed(
  700. TCP_CONTEXT *pTc,
  701. ULONG_PTR TcAddr,
  702. VERB verb,
  703. ULONG FsContext2
  704. )
  705. {
  706. if (verb == VERB_MAX)
  707. {
  708. PrintStartNamedStruct(TCP_CONTEXT, TcAddr);
  709. switch (FsContext2)
  710. {
  711. case TDI_TRANSPORT_ADDRESS_FILE:
  712. dprintf("TDI_TRANSPORT_ADDRESS_FILE" ENDL);
  713. Print_ptr(pTc, Handle.AddressHandle);
  714. break;
  715. case TDI_CONNECTION_FILE:
  716. dprintf("TDI_CONNECTION_FILE" ENDL);
  717. Print_ptr(pTc, Handle.ConnectionContext);
  718. break;
  719. case TDI_CONTROL_CHANNEL_FILE:
  720. dprintf("TDI_CONTROL_CHANNEL_FILE" ENDL);
  721. Print_ptr(pTc, Handle.ControlChannel);
  722. break;
  723. default:
  724. dprintf("INVALID FsContex2" ENDL);
  725. break;
  726. }
  727. Print_ULONG(pTc, ReferenceCount);
  728. Print_BOOLEAN(pTc, CancelIrps);
  729. Print_BOOLEAN(pTc, Cleanup);
  730. #if DBG
  731. Print_LL(pTc, PendingIrpList);
  732. Print_LL(pTc, CancelledIrpList);
  733. #endif
  734. Print_KEVENT(pTc, CleanupEvent);
  735. Print_UINT_PTR(pTc, Conn);
  736. Print_ptr(pTc, Irp);
  737. PrintEndStruct();
  738. }
  739. else
  740. {
  741. printx("TCP_CONTEXT %x ", TcAddr);
  742. switch (FsContext2)
  743. {
  744. case TDI_TRANSPORT_ADDRESS_FILE:
  745. dprintf("TDI_TRANSPORT_ADDRESS_FILE ");
  746. Print_ptr(pTc, Handle.AddressHandle);
  747. break;
  748. case TDI_CONNECTION_FILE:
  749. dprintf("TDI_CONNECTION_FILE ");
  750. Print_ptr(pTc, Handle.ConnectionContext);
  751. break;
  752. case TDI_CONTROL_CHANNEL_FILE:
  753. dprintf("TDI_CONTROL_CHANNEL_FILE ");
  754. Print_ptr(pTc, Handle.ControlChannel);
  755. break;
  756. default:
  757. dprintf("INVALID FsContex2" ENDL);
  758. break;
  759. }
  760. printx(" RefCnt = %d" ENDL, pTc->ReferenceCount);
  761. }
  762. return (TRUE);
  763. }