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.

801 lines
22 KiB

  1. /*++
  2. Copyright (c) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. ipdump.c
  5. Abstract:
  6. Contains all IP structure dumping functions.
  7. Author:
  8. Scott Holden (sholden) 24-Apr-1999
  9. Revision History:
  10. --*/
  11. #include "tcpipxp.h"
  12. BOOL
  13. DumpARPInterface(
  14. ARPInterface *pAi,
  15. ULONG_PTR AiAddr,
  16. VERB verb
  17. )
  18. {
  19. BOOL fStatus = TRUE;
  20. if (verb == VERB_MAX)
  21. {
  22. PrintStartNamedStruct(ARPInterface, AiAddr);
  23. Print_LL(pAi, ai_linkage);
  24. Print_ptr(pAi, ai_context);
  25. #if FFP_SUPPORT
  26. Print_ptr(pAi, ai_driver);
  27. #endif
  28. Print_ptr(pAi, ai_handle);
  29. Print_enum(pAi, ai_media, NdisMediumsEnum);
  30. Print_ptr(pAi, ai_ppool);
  31. Print_CTELock(pAi, ai_lock);
  32. Print_CTELock(pAi, ai_ARPTblLock);
  33. Print_ptr(pAi, ai_ARPTbl);
  34. Print_addr(pAi, ai_ipaddr, ARPInterface, AiAddr);
  35. Print_ptr(pAi, ai_parpaddr);
  36. Print_IPAddr(pAi, ai_bcast);
  37. Print_uint(pAi, ai_inoctets);
  38. Print_uint(pAi, ai_inpcount[0]);
  39. Print_uint(pAi, ai_inpcount[1]);
  40. Print_uint(pAi, ai_inpcount[2]);
  41. Print_uint(pAi, ai_outoctets);
  42. Print_uint(pAi, ai_outpcount[0]);
  43. Print_uint(pAi, ai_outpcount[1]);
  44. Print_uint(pAi, ai_qlen);
  45. Print_hwaddr(pAi, ai_addr);
  46. Print_uchar(pAi, ai_state);
  47. Print_uchar(pAi, ai_addrlen);
  48. Print_ucharhex(pAi, ai_bcastmask);
  49. Print_ucharhex(pAi, ai_bcastval);
  50. Print_uchar(pAi, ai_bcastoff);
  51. Print_uchar(pAi, ai_hdrsize);
  52. Print_uchar(pAi, ai_snapsize);
  53. Print_uint(pAi, ai_pfilter);
  54. Print_uint(pAi, ai_count);
  55. Print_uint(pAi, ai_parpcount);
  56. Print_CTETimer(pAi, ai_timer);
  57. Print_BOOLEAN(pAi, ai_timerstarted);
  58. Print_BOOLEAN(pAi, ai_stoptimer);
  59. Print_addr(pAi, ai_timerblock, ARPInterface, AiAddr);
  60. Print_addr(pAi, ai_block, ARPInterface, AiAddr);
  61. Print_ushort(pAi, ai_mtu);
  62. Print_uchar(pAi, ai_adminstate);
  63. Print_uchar(pAi, ai_operstate);
  64. Print_uint(pAi, ai_speed);
  65. Print_uint(pAi, ai_lastchange);
  66. Print_uint(pAi, ai_indiscards);
  67. Print_uint(pAi, ai_inerrors);
  68. Print_uint(pAi, ai_uknprotos);
  69. Print_uint(pAi, ai_outdiscards);
  70. Print_uint(pAi, ai_outerrors);
  71. Print_uint(pAi, ai_desclen);
  72. Print_uint(pAi, ai_index);
  73. Print_uint(pAi, ai_atinst);
  74. Print_uint(pAi, ai_ifinst);
  75. Print_ptr(pAi, ai_desc);
  76. Print_ptr(pAi, ai_mcast);
  77. Print_uint(pAi, ai_mcastcnt);
  78. Print_uint(pAi, ai_ipaddrcnt);
  79. Print_uint(pAi, ai_telladdrchng);
  80. Print_ULONG(pAi, ai_mediatype);
  81. Print_uint(pAi, ai_promiscuous);
  82. #if FFP_SUPPORT
  83. Print_ulong(pAi, ai_ffpversion);
  84. Print_uint(pAi, ai_ffplastflush);
  85. #endif
  86. Print_uint(pAi, ai_OffloadFlags);
  87. Print_addr(pAi, ai_TcpLargeSend, ARPInterface, AiAddr);
  88. Print_ulong(pAi, ai_wakeupcap.Flags);
  89. Print_ulong(pAi, ai_wakeupcap.WakeUpCapabilities.MinMagicPacketWakeUp);
  90. Print_ulong(pAi, ai_wakeupcap.WakeUpCapabilities.MinPatternWakeUp);
  91. Print_ulong(pAi, ai_wakeupcap.WakeUpCapabilities.MinLinkChangeWakeUp);
  92. Print_NDIS_STRING(pAi, ai_devicename);
  93. PrintEndStruct();
  94. }
  95. else if (verb == VERB_MED) {
  96. PrintStartNamedStruct(ARPInterface, AiAddr);
  97. Print_ptr(pAi, ai_context);
  98. Print_ptr(pAi, ai_handle);
  99. Print_enum(pAi, ai_media, NdisMediumsEnum);
  100. Print_ptr(pAi, ai_ARPTbl);
  101. Print_uint(pAi, ai_qlen);
  102. Print_uchar(pAi, ai_state);
  103. Print_uchar(pAi, ai_hdrsize);
  104. Print_uchar(pAi, ai_snapsize);
  105. Print_ushort(pAi, ai_mtu);
  106. Print_uint(pAi, ai_speed);
  107. Print_ptr(pAi, ai_desc);
  108. Print_uint(pAi, ai_OffloadFlags);
  109. Print_addr(pAi, ai_TcpLargeSend, ARPInterface, AiAddr);
  110. PrintEndStruct();
  111. }
  112. else
  113. {
  114. printx("ARPInterface %08lx NDIS %x ai_context %x ARPTbl %x" ENDL,
  115. AiAddr, pAi->ai_handle, pAi->ai_context, pAi->ai_ARPTbl);
  116. }
  117. return (fStatus);
  118. }
  119. BOOL
  120. DumpNetTableEntry(
  121. NetTableEntry *pNte,
  122. ULONG_PTR NteAddr,
  123. VERB verb
  124. )
  125. {
  126. BOOL fStatus = TRUE;
  127. if (verb == VERB_MAX)
  128. {
  129. PrintStartNamedStruct(NetTableEntry, NteAddr);
  130. Print_ptr(pNte, nte_next);
  131. Print_IPAddr(pNte, nte_addr);
  132. Print_IPMask(pNte, nte_mask);
  133. Print_ptr(pNte, nte_if);
  134. Print_ptr(pNte, nte_ifnext);
  135. Print_flags(pNte, nte_flags, FlagsNTE);
  136. Print_ushort(pNte, nte_context);
  137. Print_ulong(pNte, nte_instance);
  138. Print_ptr(pNte, nte_pnpcontext);
  139. Print_CTELock(pNte, nte_lock);
  140. Print_ptr(pNte, nte_ralist);
  141. Print_ptr(pNte, nte_echolist);
  142. Print_CTETimer(pNte, nte_timer);
  143. Print_addr(pNte, nte_timerblock, NetTableEntry, NteAddr);
  144. Print_ushort(pNte, nte_mss);
  145. Print_ushort(pNte, nte_icmpseq);
  146. Print_ptr(pNte, nte_igmplist);
  147. Print_ptr(pNte, nte_addrhandle);
  148. Print_IPAddr(pNte, nte_rtrdiscaddr);
  149. Print_uchar(pNte, nte_rtrdiscstate);
  150. Print_uchar(pNte, nte_rtrdisccount);
  151. Print_uchar(pNte, nte_rtrdiscovery);
  152. Print_uchar(pNte, nte_deleting);
  153. Print_ptr(pNte, nte_rtrlist);
  154. Print_uint(pNte, nte_igmpcount);
  155. PrintEndStruct();
  156. }
  157. else if (verb == VERB_MED)
  158. {
  159. PrintStartNamedStruct(NetTableEntry, NteAddr);
  160. Print_ptr(pNte, nte_next);
  161. Print_IPAddr(pNte, nte_addr);
  162. Print_ptr(pNte, nte_if);
  163. Print_ptr(pNte, nte_ifnext);
  164. Print_flags(pNte, nte_flags, FlagsNTE);
  165. Print_ushort(pNte, nte_context);
  166. PrintEndStruct();
  167. }
  168. else
  169. {
  170. printx("NTE %08lx ", NteAddr);
  171. printx("ipaddr: ");
  172. DumpIPAddr(pNte->nte_addr);
  173. printx("context: %d ", pNte->nte_context);
  174. printx("(");
  175. DumpFlags(pNte->nte_flags, FlagsNTE);
  176. printx(")");
  177. printx(ENDL);
  178. }
  179. return (fStatus);
  180. }
  181. BOOL
  182. DumpPacketContext(
  183. PacketContext *pPc,
  184. ULONG_PTR PcAddr,
  185. VERB verb
  186. )
  187. {
  188. if (verb == VERB_MAX ||
  189. verb == VERB_MED)
  190. {
  191. PrintStartNamedStruct(PacketContext, PcAddr);
  192. Print_ptr(pPc, pc_common.pc_link);
  193. Print_uchar(pPc, pc_common.pc_owner);
  194. Print_uchar(pPc, pc_common.pc_flags);
  195. Print_ptr(pPc, pc_common.pc_IpsecCtx);
  196. Print_ptr(pPc, pc_br);
  197. Print_ptr(pPc, pc_pi);
  198. Print_ptr(pPc, pc_if);
  199. Print_ptr(pPc, pc_hdrincl);
  200. Print_ptr(pPc, pc_firewall);
  201. Print_ptr(pPc, pc_firewall2);
  202. Print_ptr(pPc, pc_iflink);
  203. Print_uchar(pPc, pc_ipsec_flags);
  204. PrintEndStruct();
  205. }
  206. else
  207. {
  208. printx("PacketContext %08lx" ENDL, PcAddr);
  209. }
  210. return (TRUE);
  211. }
  212. BOOL
  213. DumpIPInfo(
  214. IPInfo *pIpi,
  215. ULONG_PTR IpiAddr,
  216. VERB verb
  217. )
  218. {
  219. if (verb == VERB_MAX ||
  220. verb == VERB_MED)
  221. {
  222. PrintStartNamedStruct(IPInfo, IpiAddr);
  223. Print_uint(pIpi, ipi_version);
  224. Print_uint(pIpi, ipi_hsize);
  225. Print_PtrSymbol(pIpi, ipi_xmit);
  226. Print_PtrSymbol(pIpi, ipi_protreg);
  227. Print_PtrSymbol(pIpi, ipi_openrce);
  228. Print_PtrSymbol(pIpi, ipi_closerce);
  229. Print_PtrSymbol(pIpi, ipi_getaddrtype);
  230. Print_PtrSymbol(pIpi, ipi_getlocalmtu);
  231. Print_PtrSymbol(pIpi, ipi_getpinfo);
  232. Print_PtrSymbol(pIpi, ipi_checkroute);
  233. Print_PtrSymbol(pIpi, ipi_initopts);
  234. Print_PtrSymbol(pIpi, ipi_updateopts);
  235. Print_PtrSymbol(pIpi, ipi_copyopts);
  236. Print_PtrSymbol(pIpi, ipi_freeopts);
  237. Print_PtrSymbol(pIpi, ipi_qinfo);
  238. Print_PtrSymbol(pIpi, ipi_setinfo);
  239. Print_PtrSymbol(pIpi, ipi_getelist);
  240. Print_PtrSymbol(pIpi, ipi_setmcastaddr);
  241. Print_PtrSymbol(pIpi, ipi_invalidsrc);
  242. Print_PtrSymbol(pIpi, ipi_isdhcpinterface);
  243. Print_PtrSymbol(pIpi, ipi_setndisrequest);
  244. Print_PtrSymbol(pIpi, ipi_largexmit);
  245. Print_PtrSymbol(pIpi, ipi_absorbrtralert);
  246. Print_PtrSymbol(pIpi, ipi_isvalidindex);
  247. Print_PtrSymbol(pIpi, ipi_getifindexfromnte);
  248. Print_PtrSymbol(pIpi, ipi_isrtralertpacket);
  249. Print_PtrSymbol(pIpi, ipi_getifindexfromaddr);
  250. PrintEndStruct();
  251. }
  252. else
  253. {
  254. printx("IPInfo %08lx" ENDL, IpiAddr);
  255. }
  256. return (TRUE);
  257. }
  258. BOOL
  259. DumpRouteCacheEntry(
  260. RouteCacheEntry *pRce,
  261. ULONG_PTR RceAddr,
  262. VERB verb
  263. )
  264. {
  265. if (verb == VERB_MAX)
  266. {
  267. PrintStartNamedStruct(RouteCacheEntry, RceAddr);
  268. Print_ptr(pRce, rce_next);
  269. Print_ptr(pRce, rce_rte);
  270. Print_IPAddr(pRce, rce_dest);
  271. Print_IPAddr(pRce, rce_src);
  272. Print_flags(pRce, rce_flags, FlagsRCE);
  273. Print_uchar(pRce, rce_dtype);
  274. Print_ushort(pRce, rce_cnt1);
  275. Print_uint(pRce, rce_usecnt);
  276. Print_uchar(pRce, rce_context[0]);
  277. Print_uchar(pRce, rce_context[1]);
  278. Print_CTELock(pRce, rce_lock);
  279. Print_uint(pRce, rce_OffloadFlags);
  280. Print_addr(pRce, rce_TcpLargeSend, RouteCacheEntry, RceAddr);
  281. Print_uint(pRce, rce_TcpWindowSize);
  282. Print_uint(pRce, rce_TcpInitialRTT);
  283. Print_uint(pRce, rce_TcpDelAckTicks);
  284. Print_uint(pRce, rce_cnt);
  285. Print_uint(pRce, rce_mediatype);
  286. Print_uint(pRce, rce_mediaspeed);
  287. Print_uint(pRce, rce_newmtu);
  288. PrintEndStruct();
  289. }
  290. else
  291. {
  292. printx("RouteCacheEntry %08lx dest: ", RceAddr);
  293. DumpIPAddr(pRce->rce_dest);
  294. printx("src: ");
  295. DumpIPAddr(pRce->rce_src);
  296. printx("flags ");
  297. DumpFlags(pRce->rce_flags, FlagsRCE);
  298. printx(ENDL);
  299. }
  300. return (TRUE);
  301. }
  302. BOOL
  303. DumpARPTableEntry(
  304. ARPTableEntry *pAte,
  305. ULONG_PTR AteAddr,
  306. VERB verb
  307. )
  308. {
  309. if (verb == VERB_MAX)
  310. {
  311. PrintStartNamedStruct(ARPTableEntry, AteAddr);
  312. Print_ptr(pAte, ate_next);
  313. Print_ulong(pAte, ate_valid);
  314. Print_IPAddr(pAte, ate_dest);
  315. Print_ptr(pAte, ate_packet);
  316. Print_ptr(pAte, ate_rce);
  317. Print_CTELock(pAte, ate_lock);
  318. Print_uint(pAte, ate_useticks);
  319. Print_uchar(pAte, ate_addrlength);
  320. Print_enum(pAte, ate_state, AteState);
  321. Print_ulong(pAte, ate_userarp);
  322. Print_ptr(pAte, ate_resolveonly);
  323. Print_addr(pAte, ate_addr, ARPTableEntry, AteAddr);
  324. PrintEndStruct();
  325. }
  326. else
  327. {
  328. printx("ARPTableEntry %08lx ipaddr ", AteAddr);
  329. DumpIPAddr(pAte->ate_dest);
  330. printx("rce %x state: ", pAte->ate_rce);
  331. DumpEnum(pAte->ate_state, AteState);
  332. printx(ENDL);
  333. }
  334. return (TRUE);
  335. }
  336. BOOL
  337. DumpARPIPAddr(
  338. ARPIPAddr *pAia,
  339. ULONG_PTR AiaAddr,
  340. VERB verb
  341. )
  342. {
  343. if (verb == VERB_MAX)
  344. {
  345. PrintStartNamedStruct(ARPIPAddr, AiaAddr);
  346. Print_ptr(pAia, aia_next);
  347. Print_uint(pAia, aia_age);
  348. Print_IPAddr(pAia, aia_addr);
  349. Print_IPMask(pAia, aia_mask);
  350. Print_ptr(pAia, aia_context);
  351. PrintEndStruct();
  352. }
  353. else
  354. {
  355. printx("ARPIPAddr %08lx ", AiaAddr);
  356. DumpIPAddr(pAia->aia_addr);
  357. DumpIPAddr(pAia->aia_mask);
  358. printx(ENDL);
  359. }
  360. return (TRUE);
  361. }
  362. BOOL
  363. DumpRouteTableEntry(
  364. RouteTableEntry *pRte,
  365. ULONG_PTR RteAddr,
  366. VERB verb
  367. )
  368. {
  369. if (verb == VERB_MAX)
  370. {
  371. PrintStartNamedStruct(RouteTableEntry, RteAddr);
  372. Print_ptr(pRte, rte_next);
  373. Print_IPAddr(pRte, rte_dest);
  374. Print_IPMask(pRte, rte_mask);
  375. Print_IPAddr(pRte, rte_addr);
  376. Print_uint(pRte, rte_priority);
  377. Print_uint(pRte, rte_metric);
  378. Print_uint(pRte, rte_mtu);
  379. Print_ptr(pRte, rte_if);
  380. Print_ptr(pRte, rte_rcelist);
  381. Print_ushort(pRte, rte_type);
  382. Print_flags(pRte, rte_flags, FlagsRTE);
  383. Print_uint(pRte, rte_admintype);
  384. Print_uint(pRte, rte_proto);
  385. Print_uint(pRte, rte_valid);
  386. Print_uint(pRte, rte_mtuchange);
  387. Print_ptr(pRte, rte_context);
  388. Print_ptr(pRte, rte_arpcontext[0]);
  389. Print_ptr(pRte, rte_arpcontext[1]);
  390. Print_ptr(pRte, rte_todg);
  391. Print_ptr(pRte, rte_fromdg);
  392. Print_uint(pRte, rte_rces);
  393. Print_ptr(pRte, rte_link);
  394. Print_ptr(pRte, rte_nextlinkrte);
  395. Print_uint(pRte, rte_refcnt);
  396. PrintEndStruct();
  397. }
  398. else
  399. {
  400. printx("RouteTableEntry %08lx dest ", RteAddr);
  401. DumpIPAddr(pRte->rte_dest);
  402. printx("mask ");
  403. DumpIPAddr(pRte->rte_mask);
  404. printx("flags ");
  405. DumpFlags(pRte->rte_flags, FlagsRTE);
  406. printx(ENDL);
  407. }
  408. return (TRUE);
  409. }
  410. BOOL
  411. DumpLinkEntry(
  412. LinkEntry *pLink,
  413. ULONG_PTR LinkAddr,
  414. VERB verb
  415. )
  416. {
  417. if (verb == VERB_MAX ||
  418. verb == VERB_MED)
  419. {
  420. PrintStartNamedStruct(LinkEntry, LinkAddr);
  421. Print_ptr(pLink, link_next);
  422. Print_IPAddr(pLink, link_NextHop);
  423. Print_ptr(pLink, link_if);
  424. Print_ptr(pLink, link_arpctxt);
  425. Print_ptr(pLink, link_rte);
  426. Print_uint(pLink, link_Action);
  427. Print_uint(pLink, link_mtu);
  428. Print_long(pLink, link_refcount);
  429. PrintEndStruct();
  430. }
  431. else
  432. {
  433. printx("LinkEntry %08lx NextHop ", LinkAddr);
  434. DumpIPAddr(pLink->link_NextHop);
  435. printx("if %x rte %x" ENDL, pLink->link_if, pLink->link_rte);
  436. }
  437. return (TRUE);
  438. }
  439. BOOL
  440. DumpInterface(
  441. Interface *pIf,
  442. ULONG_PTR IfAddr,
  443. VERB verb
  444. )
  445. {
  446. uint i;
  447. if (verb == VERB_MAX)
  448. {
  449. PrintStartNamedStruct(Interface, IfAddr);
  450. Print_ptr(pIf, if_next);
  451. Print_ptr(pIf, if_lcontext);
  452. Print_PtrSymbol(pIf, if_xmit);
  453. Print_PtrSymbol(pIf, if_transfer);
  454. Print_PtrSymbol(pIf, if_returnpkt);
  455. Print_PtrSymbol(pIf, if_close);
  456. Print_PtrSymbol(pIf, if_addaddr);
  457. Print_PtrSymbol(pIf, if_deladdr);
  458. Print_PtrSymbol(pIf, if_invalidate);
  459. Print_PtrSymbol(pIf, if_open);
  460. Print_PtrSymbol(pIf, if_qinfo);
  461. Print_PtrSymbol(pIf, if_setinfo);
  462. Print_PtrSymbol(pIf, if_getelist);
  463. Print_PtrSymbol(pIf, if_dondisreq);
  464. Print_PtrSymbol(pIf, if_dowakeupptrn);
  465. Print_PtrSymbol(pIf, if_pnpcomplete);
  466. Print_PtrSymbol(pIf, if_setndisrequest);
  467. Print_PtrSymbol(pIf, if_arpresolveip);
  468. Print_PtrSymbol(pIf, if_arpflushate);
  469. Print_PtrSymbol(pIf, if_arpflushallate);
  470. Print_uint(pIf, if_numgws);
  471. for (i = 0; i < MAX_DEFAULT_GWS; i++)
  472. {
  473. Print_IPAddr(pIf, if_gw[i]);
  474. Print_uint(pIf, if_gwmetric[i]);
  475. }
  476. Print_uint(pIf, if_metric);
  477. Print_uint(pIf, if_rtrdiscovery);
  478. Print_ptr(pIf, if_tdpacket);
  479. Print_uint(pIf, if_index);
  480. Print_ULONG(pIf, if_mediatype);
  481. Print_uchar(pIf, if_accesstype);
  482. Print_uchar(pIf, if_conntype);
  483. Print_uchar(pIf, if_mcastttl);
  484. Print_uchar(pIf, if_mcastflags);
  485. Print_uint(pIf, if_ntecount);
  486. Print_ptr(pIf, if_nte);
  487. Print_IPAddr(pIf, if_bcast);
  488. Print_uint(pIf, if_mtu);
  489. Print_uint(pIf, if_speed);
  490. Print_flags(pIf, if_flags, FlagsIF);
  491. Print_uint(pIf, if_addrlen);
  492. Print_ptr(pIf, if_addr);
  493. Print_uint(pIf, IgmpVersion);
  494. Print_uint(pIf, IgmpVer1Timeout);
  495. Print_uint(pIf, if_refcount);
  496. Print_ptr(pIf, if_block);
  497. Print_ptr(pIf, if_pnpcontext);
  498. Print_ptr(pIf, if_tdibindhandle);
  499. Print_uinthex(pIf, if_llipflags);
  500. Print_NDIS_STRING(pIf, if_configname);
  501. Print_NDIS_STRING(pIf, if_name);
  502. Print_NDIS_STRING(pIf, if_devname);
  503. Print_ptr(pIf, if_ipsecsniffercontext);
  504. Print_CTELock(pIf, if_lock);
  505. #if FFP_SUPPORT
  506. Print_ulong(pIf, if_ffpversion);
  507. Print_ptr(pIf, if_ffpdriver);
  508. #endif
  509. Print_uinthex(pIf, if_OffloadFlags);
  510. Print_uint(pIf, if_MaxOffLoadSize);
  511. Print_uint(pIf, if_MaxSegments);
  512. Print_addr(pIf, if_TcpLargeSend, Interface, IfAddr);
  513. Print_uint(pIf, if_TcpWindowSize);
  514. Print_uint(pIf, if_TcpInitialRTT);
  515. Print_uint(pIf, if_TcpDelAckTicks);
  516. Print_uint(pIf, if_promiscuousmode);
  517. Print_uint(pIf, if_GetGPCHandle);
  518. Print_uint(pIf, if_GetTOS);
  519. Print_uint(pIf, if_InitInProgress);
  520. Print_ptr(pIf, if_link);
  521. Print_PtrSymbol(pIf, if_closelink);
  522. Print_uint(pIf, if_mediastatus);
  523. Print_uint(pIf, if_iftype);
  524. Print_uint(pIf, if_pnpcap);
  525. Print_ptr(pIf, if_dampnext);
  526. Print_int(pIf, if_damptimer)
  527. Print_uchar(pIf, if_absorbfwdpkts);
  528. Print_BOOLEAN(pIf, if_resetInProgress);
  529. PrintEndStruct();
  530. }
  531. else if (verb == VERB_MED)
  532. {
  533. PrintStartNamedStruct(Interface, IfAddr);
  534. Print_ptr(pIf, if_next);
  535. Print_ptr(pIf, if_lcontext);
  536. Print_uint(pIf, if_numgws);
  537. for (i = 0; i < MAX_DEFAULT_GWS; i++)
  538. {
  539. Print_IPAddr(pIf, if_gw[i]);
  540. Print_uint(pIf, if_gwmetric[i]);
  541. }
  542. Print_uint(pIf, if_metric);
  543. Print_uint(pIf, if_rtrdiscovery);
  544. Print_NDIS_STRING(pIf, if_devname);
  545. Print_flags(pIf, if_flags, FlagsIF);
  546. PrintEndStruct();
  547. }
  548. else
  549. {
  550. printx("Interface %08lx lcontext %x nte %x ",
  551. IfAddr, pIf->if_lcontext, pIf->if_nte);
  552. printx("(");
  553. DumpFlags(pIf->if_flags, FlagsIF);
  554. printx(")");
  555. printx(" %s", pIf->if_mediastatus ? "CONNECTED" : "DISCONNECTED");
  556. printx(ENDL);
  557. }
  558. return (TRUE);
  559. }
  560. BOOL
  561. DumpIPHeader(
  562. IPHeader *pIph,
  563. ULONG_PTR IphAddr,
  564. VERB verb
  565. )
  566. {
  567. PrintStartNamedStruct(IPHeader, IphAddr);
  568. Print_uchar(pIph, iph_verlen);
  569. Print_uchar(pIph, iph_tos);
  570. Print_ushorthton(pIph, iph_length);
  571. Print_ushorthton(pIph, iph_id);
  572. Print_ushorthton(pIph, iph_offset);
  573. Print_uchar(pIph, iph_ttl);
  574. Print_uchar(pIph, iph_protocol);
  575. Print_ushorthton(pIph, iph_xsum);
  576. Print_IPAddr(pIph, iph_src);
  577. Print_IPAddr(pIph, iph_dest);
  578. PrintEndStruct();
  579. return (TRUE);
  580. }
  581. BOOL
  582. DumpICMPHeader(
  583. ICMPHeader *pIch,
  584. ULONG_PTR IchAddr,
  585. VERB verb
  586. )
  587. {
  588. PrintStartNamedStruct(ICMPHeader, IchAddr);
  589. Print_uchar(pIch, ich_type);
  590. Print_uchar(pIch, ich_code);
  591. Print_ushort(pIch, ich_xsum);
  592. Print_ulong(pIch, ich_param);
  593. PrintEndStruct();
  594. return (TRUE);
  595. }
  596. BOOL
  597. DumpARPHeader(
  598. ARPHeader *pAh,
  599. ULONG_PTR AhAddr,
  600. VERB verb
  601. )
  602. {
  603. PrintStartNamedStruct(ARPHeader, AhAddr);
  604. Print_ushorthton(pAh, ah_hw);
  605. Print_ushorthton(pAh, ah_pro);
  606. Print_uchar(pAh, ah_hlen);
  607. Print_uchar(pAh, ah_plen);
  608. Print_ushorthton(pAh, ah_opcode);
  609. Print_hwaddr(pAh, ah_shaddr);
  610. Print_IPAddr(pAh, ah_spaddr);
  611. Print_hwaddr(pAh, ah_dhaddr);
  612. Print_IPAddr(pAh, ah_dpaddr);
  613. PrintEndStruct();
  614. return (TRUE);
  615. }
  616. BOOL
  617. DumpIPOptInfo(
  618. IPOptInfo *pIoi,
  619. ULONG_PTR pAddr,
  620. VERB verb
  621. )
  622. {
  623. // Only support one verbosity level: max. This is only used by other
  624. // dump routines.
  625. PrintStartNamedStruct(IPOptInfo, pAddr);
  626. Print_ptr(pIoi, ioi_options);
  627. Print_IPAddr(pIoi, ioi_addr);
  628. Print_uchar(pIoi, ioi_optlength);
  629. Print_uchar(pIoi, ioi_ttl);
  630. Print_uchar(pIoi, ioi_tos);
  631. Print_uchar(pIoi, ioi_flags);
  632. Print_uchar(pIoi, ioi_hdrincl);
  633. Print_int(pIoi, ioi_GPCHandle);
  634. Print_uint(pIoi, ioi_uni);
  635. Print_uint(pIoi, ioi_TcpChksum);
  636. Print_uint(pIoi, ioi_UdpChksum);
  637. Print_uchar(pIoi, ioi_limitbcasts);
  638. Print_uint(pIoi, ioi_ucastif);
  639. Print_uint(pIoi, ioi_mcastif);
  640. PrintEndStruct();
  641. return (TRUE);
  642. }
  643. BOOL
  644. DumpLLIPBindInfo(
  645. LLIPBindInfo *pLip,
  646. ULONG_PTR LipAddr,
  647. VERB verb
  648. )
  649. {
  650. uint i;
  651. if (verb == VERB_MAX)
  652. {
  653. PrintStartNamedStruct(LLIPBindInfo, LipAddr);
  654. Print_ptr(pLip, lip_context);
  655. Print_uint(pLip, lip_mss);
  656. Print_uint(pLip, lip_speed);
  657. Print_uint(pLip, lip_index);
  658. Print_uint(pLip, lip_txspace);
  659. Print_PtrSymbol(pLip, lip_transmit);
  660. Print_PtrSymbol(pLip, lip_transfer);
  661. Print_PtrSymbol(pLip, lip_returnPkt);
  662. Print_PtrSymbol(pLip, lip_close);
  663. Print_PtrSymbol(pLip, lip_addaddr);
  664. Print_PtrSymbol(pLip, lip_deladdr);
  665. Print_PtrSymbol(pLip, lip_invalidate);
  666. Print_PtrSymbol(pLip, lip_open);
  667. Print_PtrSymbol(pLip, lip_qinfo);
  668. Print_PtrSymbol(pLip, lip_setinfo);
  669. Print_PtrSymbol(pLip, lip_getelist);
  670. Print_PtrSymbol(pLip, lip_dondisreq);
  671. Print_flags(pLip, lip_flags, FlagsLLIPBindInfo);
  672. Print_uint(pLip, lip_OffloadFlags);
  673. Print_uint(pLip, lip_ffpversion);
  674. Print_ULONG_PTR(pLip, lip_ffpdriver);
  675. Print_PtrSymbol(pLip, lip_setndisrequest);
  676. Print_PtrSymbol(pLip, lip_dowakeupptrn);
  677. Print_PtrSymbol(pLip, lip_pnpcomplete);
  678. Print_PtrSymbol(pLip, lip_arpresolveip);
  679. Print_uint(pLip, lip_MaxOffLoadSize);
  680. Print_uint(pLip, lip_MaxSegments);
  681. Print_PtrSymbol(pLip, lip_arpflushate);
  682. Print_PtrSymbol(pLip, lip_arpflushallate);
  683. Print_PtrSymbol(pLip, lip_closelink);
  684. Print_uint(pLip, lip_pnpcap);
  685. PrintEndStruct();
  686. }
  687. else
  688. {
  689. printx("LLIPBindInfo %08lx context %x mss %d speed %d index %" ENDL,
  690. LipAddr, pLip->lip_context,
  691. pLip->lip_mss, pLip->lip_speed,
  692. pLip->lip_index);
  693. }
  694. return (TRUE);
  695. }
  696. BOOL
  697. DumpNDIS_PACKET(
  698. PNDIS_PACKET pPacket,
  699. ULONG_PTR PacketAddr,
  700. VERB Verb
  701. )
  702. {
  703. PrintStartNamedStruct(NDIS_PACKET, PacketAddr);
  704. Print_uint(pPacket, Private.PhysicalCount);
  705. Print_uint(pPacket, Private.TotalLength);
  706. Print_ptr(pPacket, Private.Head);
  707. Print_ptr(pPacket, Private.Tail);
  708. Print_ptr(pPacket, Private.Pool);
  709. Print_uint(pPacket, Private.Count);
  710. Print_ULONGhex(pPacket, Private.Flags);
  711. Print_BOOLEAN(pPacket, Private.ValidCounts);
  712. Print_ucharhex(pPacket, Private.NdisPacketFlags);
  713. Print_USHORT(pPacket, Private.NdisPacketOobOffset);
  714. PrintEndStruct();
  715. return (TRUE);
  716. }