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.

617 lines
36 KiB

  1. <html xmlns:v="urn:schemas-microsoft-com:vml"
  2. xmlns:o="urn:schemas-microsoft-com:office:office"
  3. xmlns:w="urn:schemas-microsoft-com:office:word"
  4. xmlns:st1="urn:schemas-microsoft-com:office:smarttags"
  5. xmlns="http://www.w3.org/TR/REC-html40">
  6. <head>
  7. <meta http-equiv=Content-Type content="text/html; charset=windows-1252">
  8. <meta name=ProgId content=Word.Document>
  9. <meta name=Generator content="Microsoft Word 10">
  10. <meta name=Originator content="Microsoft Word 10">
  11. <link rel=File-List href="mux_files/filelist.xml">
  12. <title>MUX Intermediate Miniport Driver Help</title>
  13. <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
  14. name="PlaceType"/>
  15. <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
  16. name="PlaceName"/>
  17. <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
  18. name="place"/>
  19. <!--[if gte mso 9]><xml>
  20. <w:WordDocument>
  21. <w:SpellingState>Clean</w:SpellingState>
  22. <w:GrammarState>Clean</w:GrammarState>
  23. <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
  24. </w:WordDocument>
  25. </xml><![endif]--><!--[if !mso]><object
  26. classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object>
  27. <style>
  28. st1\:*{behavior:url(#ieooui) }
  29. </style>
  30. <![endif]-->
  31. <style>
  32. <!--
  33. /* Font Definitions */
  34. @font-face
  35. {font-family:Verdana;
  36. panose-1:2 11 6 4 3 5 4 4 2 4;
  37. mso-font-charset:0;
  38. mso-generic-font-family:swiss;
  39. mso-font-pitch:variable;
  40. mso-font-signature:536871559 0 0 0 415 0;}
  41. @font-face
  42. {font-family:"MS Sans Serif";
  43. mso-font-alt:"Times New Roman";
  44. mso-font-charset:0;
  45. mso-generic-font-family:auto;
  46. mso-font-pitch:auto;
  47. mso-font-signature:3 0 0 0 1 0;}
  48. /* Style Definitions */
  49. p.MsoNormal, li.MsoNormal, div.MsoNormal
  50. {mso-style-parent:"";
  51. margin:0in;
  52. margin-bottom:.0001pt;
  53. mso-pagination:widow-orphan;
  54. font-size:12.0pt;
  55. font-family:"Times New Roman";
  56. mso-fareast-font-family:"Times New Roman";
  57. color:black;}
  58. h2
  59. {mso-margin-top-alt:auto;
  60. margin-right:0in;
  61. mso-margin-bottom-alt:auto;
  62. margin-left:0in;
  63. mso-pagination:widow-orphan;
  64. mso-outline-level:2;
  65. font-size:18.0pt;
  66. font-family:"Times New Roman";
  67. color:black;
  68. font-weight:bold;}
  69. h3
  70. {mso-margin-top-alt:auto;
  71. margin-right:0in;
  72. mso-margin-bottom-alt:auto;
  73. margin-left:0in;
  74. mso-pagination:widow-orphan;
  75. mso-outline-level:3;
  76. font-size:13.5pt;
  77. font-family:"Times New Roman";
  78. color:black;
  79. font-weight:bold;}
  80. h4
  81. {mso-margin-top-alt:auto;
  82. margin-right:0in;
  83. mso-margin-bottom-alt:auto;
  84. margin-left:0in;
  85. mso-pagination:widow-orphan;
  86. mso-outline-level:4;
  87. font-size:12.0pt;
  88. font-family:"Times New Roman";
  89. color:black;
  90. font-weight:bold;}
  91. a:link, span.MsoHyperlink
  92. {color:blue;
  93. text-decoration:underline;
  94. text-underline:single;}
  95. a:visited, span.MsoHyperlinkFollowed
  96. {color:purple;
  97. text-decoration:underline;
  98. text-underline:single;}
  99. p
  100. {mso-margin-top-alt:auto;
  101. margin-right:0in;
  102. mso-margin-bottom-alt:auto;
  103. margin-left:0in;
  104. mso-pagination:widow-orphan;
  105. font-size:12.0pt;
  106. font-family:"Times New Roman";
  107. mso-fareast-font-family:"Times New Roman";
  108. color:black;}
  109. pre
  110. {margin:0in;
  111. margin-bottom:.0001pt;
  112. mso-pagination:widow-orphan;
  113. tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
  114. font-size:10.0pt;
  115. font-family:"Courier New";
  116. mso-fareast-font-family:"Courier New";
  117. color:black;}
  118. span.SpellE
  119. {mso-style-name:"";
  120. mso-spl-e:yes;}
  121. span.GramE
  122. {mso-style-name:"";
  123. mso-gram-e:yes;}
  124. @page Section1
  125. {size:8.5in 11.0in;
  126. margin:1.0in 1.25in 1.0in 1.25in;
  127. mso-header-margin:.5in;
  128. mso-footer-margin:.5in;
  129. mso-paper-source:0;}
  130. div.Section1
  131. {page:Section1;}
  132. -->
  133. </style>
  134. <!--[if gte mso 10]>
  135. <style>
  136. /* Style Definitions */
  137. table.MsoNormalTable
  138. {mso-style-name:"Table Normal";
  139. mso-tstyle-rowband-size:0;
  140. mso-tstyle-colband-size:0;
  141. mso-style-noshow:yes;
  142. mso-style-parent:"";
  143. mso-padding-alt:0in 5.4pt 0in 5.4pt;
  144. mso-para-margin:0in;
  145. mso-para-margin-bottom:.0001pt;
  146. mso-pagination:widow-orphan;
  147. font-size:10.0pt;
  148. font-family:"Times New Roman";}
  149. </style>
  150. <![endif]-->
  151. <meta name=Template content="C:\Program Files\Microsoft Office\Office\html.dot">
  152. <!--[if gte mso 9]><xml>
  153. <o:shapedefaults v:ext="edit" spidmax="7170"/>
  154. </xml><![endif]--><!--[if gte mso 9]><xml>
  155. <o:shapelayout v:ext="edit">
  156. <o:idmap v:ext="edit" data="1"/>
  157. </o:shapelayout></xml><![endif]-->
  158. </head>
  159. <body bgcolor=white lang=EN-US link=blue vlink=purple style='tab-interval:.5in'>
  160. <div class=Section1>
  161. <h2><a name=MYSAMPLE><span style='font-family:Verdana'>
  162. <!doctype HTML>
  163. <! ---------------- Snip Snip ---------------- >MUX.SYS - Sample NDIS MUX
  164. Intermediate Driver</span></a><span style='font-family:Verdana'><o:p></o:p></span></h2>
  165. <h3><span style='font-family:Verdana'>SUMMARY<o:p></o:p></span></h3>
  166. <p><st1:place><st1:PlaceName><b><span style='font-family:Verdana'>MUX</span></b></st1:PlaceName><b><span
  167. style='font-family:Verdana'> </span></b><st1:PlaceName><b><span
  168. style='font-family:Verdana'>Intermediate</span></b></st1:PlaceName><b><span
  169. style='font-family:Verdana'> </span></b><st1:PlaceType><b><span
  170. style='font-family:Verdana'>Miniport</span></b></st1:PlaceType></st1:place><b><span
  171. style='font-family:Verdana'> Driver<o:p></o:p></span></b></p>
  172. <p><span style='font-size:10.0pt;font-family:Verdana'>The MUX Intermediate
  173. Miniport (IM) driver is an NDIS 5 driver that demonstrates the operation of an
  174. �N<span class=GramE>:1</span>� MUX driver, i.e. one which creates multiple
  175. virtual network devices on top of a single lower adapter. Protocols bind to
  176. these virtual adapters as if they are real adapters. Examples of </span><st1:place><st1:PlaceName><span
  177. style='font-size:10.0pt;font-family:Verdana'>Intermediate</span></st1:PlaceName><span
  178. style='font-size:10.0pt;font-family:Verdana'> </span><st1:PlaceType><span
  179. style='font-size:10.0pt;font-family:Verdana'>Miniport</span></st1:PlaceType></st1:place><span
  180. style='font-size:10.0pt;font-family:Verdana'> drivers that can use this
  181. framework are Virtual LAN (VLAN) drivers.<o:p></o:p></span></p>
  182. <p><span style='font-size:10.0pt;font-family:Verdana'>This sample implements
  183. IEEE 802.1Q VLAN tagging, which is enabled by changing the default VLAN ID to a
  184. non-zero valid value (see �Configuring VLANs� below).<o:p></o:p></span></p>
  185. <p><b><span style='mso-bidi-font-size:10.0pt;font-family:Verdana'>Operation<o:p></o:p></span></b></p>
  186. <p><span style='font-size:10.0pt;font-family:Verdana'>The driver binds to
  187. Ethernet (NdisMedium802_3) adapters as a protocol, and exposes one or more
  188. virtual Ethernet devices over each lower adapter, based on its configuration.
  189. The term �VELAN� is used to denote a Virtual Ethernet LAN adapter implemented
  190. by this driver.<o:p></o:p></span></p>
  191. <p><span style='font-size:10.0pt;font-family:Verdana'>When it binds to a lower
  192. adapter, MUX reads the standard �UpperBind� key to obtain a list of VELANs
  193. configured over this adapter. For each such VELAN, it calls <span class=GramE>NdisIMInitializeDeviceInstanceEx(</span>)
  194. to instantiate the NDIS miniport for the VELAN. NDIS then calls the driver�s
  195. MiniportInitialize (<i>MPInitialize</i>) routine to start the VELAN miniport.<o:p></o:p></span></p>
  196. <p><span style='font-size:10.0pt;font-family:Verdana'>The MUX driver supports
  197. configuring the MAC address for each VELAN miniport using the standard
  198. �NetworkAddress� key that it reads from its MiniportInitialize routine. If this
  199. is not configured, it computes a �locally significant� MAC address for the
  200. VELAN using the MAC address of the lower adapter. The MUX driver sets its lower
  201. adapter to promiscuous mode in order to be able to receive frames directed to
  202. any of the VELAN MAC addresses. <span class=GramE>However it does implement
  203. packet-filtering (and multicast address filtering) logic for all its VELAN
  204. miniports so that it only passes up relevant frames on each VELAN.</span> This
  205. aspect of the driver may be modified if, for example, your driver design uses
  206. the same MAC address as that of the lower adapter on all VELANs. With such a
  207. modification, it is not required to set the lower adapter to promiscuous mode
  208. and incur the costs of receiving all packets on the network.<o:p></o:p></span></p>
  209. <p><span style='font-size:10.0pt;font-family:Verdana'>It supports dynamic
  210. addition and deletion of VELANs in conjunction with <span class=GramE>its</span>
  211. notify object (related sample). If a VELAN is deleted, the virtual device
  212. corresponding to the VELAN is stopped and removed, which in turn results in
  213. NDIS halting the miniport instance for the VELAN (see <i>MPHalt</i>). If a
  214. VELAN is added, NDIS sends a global reconfiguration event to the protocol edge
  215. of this driver. The handler function for this event, PtPNPHandler, goes through
  216. all lower adapters to see if any new VELANs have been added, i.e. if any of the
  217. �UpperBind� keys have been modified.<o:p></o:p></span></p>
  218. <p><span style='font-size:10.0pt;font-family:Verdana'>Since the driver
  219. implements a virtual device, it does not simply pass through most NDIS
  220. queries/sets. It keeps its own device view that is reflected in its responses
  221. to queries/sets. However it does pass through queries/sets for certain OIDs
  222. that are best handled by the lower adapter driver. <o:p></o:p></span></p>
  223. <p><span style='font-size:10.0pt;font-family:Verdana'>The driver supports Power
  224. Management in the sense that it allows Wake-On-LAN and related functionality,
  225. if supported by the lower adapter, to continue to function. It does so by
  226. appropriately forwarding OID_PNP_XXX queries/sets to the lower adapter. <o:p></o:p></span></p>
  227. <p><b style='mso-bidi-font-weight:normal'><span style='font-family:Verdana'>IEEE
  228. 802.1Q VLAN Operation<o:p></o:p></span></b></p>
  229. <p><span style='font-size:10.0pt;font-family:Verdana'>The driver supports
  230. configuring a VLAN ID on each VELAN. It then inserts a tag header containing
  231. this VLAN ID on all outgoing frames. For incoming frames that contain a tag
  232. header, it verifies that a matching VLAN ID is present before indicating it up
  233. to protocols. It removes the tag header, if present, from all indicated frames.
  234. In all cases, received frames that do not contain tag headers are always handed
  235. up to protocols.<o:p></o:p></span></p>
  236. <p><span style='font-size:10.0pt;font-family:Verdana'>With the default
  237. configured VLAN ID of zero, the driver does not insert tag header information
  238. on sent packets, except for sent packets that contain non-zero Ieee8021QInfo
  239. per-packet information, for which the driver does insert corresponding tag
  240. headers. Receive-side filtering on VLAN ID is enabled only with a non-zero
  241. configured VLAN ID, in which case only received frames containing a matching
  242. VLAN ID are passed up. With the default configured VLAN ID of zero, the driver
  243. does not check the VLAN ID on received frames.<o:p></o:p></span></p>
  244. <h3><span style='font-family:Verdana'>BUILDING THE SAMPLE<o:p></o:p></span></h3>
  245. <p><span style='font-size:10.0pt;font-family:Verdana'>Run the <b>build</b>
  246. command from this directory to build the sample�it creates the binary mux.sys.
  247. To disable IEEE VLAN support, comment out the following line in the sources
  248. file before building:<o:p></o:p></span></p>
  249. <p><span style='font-size:10.0pt;font-family:Verdana'>C_DEFINES=$(C_DEFINES)
  250. �DIEEE_VLAN_SUPPORT=1<o:p></o:p></span></p>
  251. <p><span style='font-size:10.0pt;font-family:Verdana'>To install this driver on
  252. Windows� codename Whistler, use the MUX sample notification object and INFs,
  253. also found in this DDK.<o:p></o:p></span></p>
  254. <h3><span style='font-family:Verdana'>INSTALLING THE SAMPLE<o:p></o:p></span></h3>
  255. <p><span style='font-size:10.0pt;font-family:Verdana'>MUX is installed as a
  256. protocol (called �Sample <span class=SpellE>Mux</span>-IM Protocol Driver� in
  257. the supplied INFs/notification object). To install, follow the steps below.<o:p></o:p></span></p>
  258. <p><span style='font-size:10.0pt;font-family:Verdana'>Prepare a floppy disk (or
  259. installation directory) that contains these files: <span class=SpellE>muxp.inf</span>,
  260. <span class=SpellE>mux_mp.inf</span>, mux.sys and mux.dll (notification object
  261. DLL, built in this DDK at network\<span class=SpellE>ndis\mux\notifyob</span>).<o:p></o:p></span></p>
  262. <p><span style='font-size:10.0pt;font-family:Verdana'>On the desktop,
  263. right-click the <b>My Network Places</b> icon and choose <b>Properties</b>. <o:p></o:p></span></p>
  264. <p><span style='font-size:10.0pt;font-family:Verdana'>Right-click on the
  265. relevant Local Area Connection icon and choose <b>Properties</b>. <o:p></o:p></span></p>
  266. <p><span style='font-size:10.0pt;font-family:Verdana'>Click <b>Install</b>,
  267. then <b>Protocol</b>, then <b>Add</b>, <span class=GramE>then</span> <b>Have
  268. Disk</b>. <o:p></o:p></span></p>
  269. <p><span style='font-size:10.0pt;font-family:Verdana'>Browse to the
  270. drive/directory containing the files listed above. Click <b>OK</b>. This should
  271. show �Sample <span class=SpellE>Mux</span>-IM Protocol Driver� in a list of
  272. Network Protocols. Highlight this and click <b>OK</b>. This should install the
  273. MUX driver. <o:p></o:p></span></p>
  274. <p><span style='font-size:10.0pt;font-family:Verdana'>Click <b>OK</b> or <span
  275. class=GramE><b>Yes</b></span> each time the system prompts with a warning
  276. regarding installation of unsigned files. This is necessary because binaries
  277. generated via the DDK build environment are not signed.<o:p></o:p></span></p>
  278. <p><span style='font-size:10.0pt;font-family:Verdana'>Two .INF files are needed
  279. rather than one because MUX is installed both as a protocol and a miniport.<o:p></o:p></span></p>
  280. <p><b style='mso-bidi-font-weight:normal'><span style='font-family:Verdana'>Configuring
  281. VLANs<o:p></o:p></span></b></p>
  282. <p><span style='font-size:10.0pt;font-family:Verdana'>The VLAN ID for each
  283. VELAN (virtual miniport) can be configured as follows. Right-click on the
  284. virtual miniport Local Area Connection icon and choose <b style='mso-bidi-font-weight:
  285. normal'>Properties</b>. Click on the <b style='mso-bidi-font-weight:normal'>Configure</b>
  286. button to bring up the Device Manager UI for the virtual device. Select the <b
  287. style='mso-bidi-font-weight:normal'>Advanced</b> property sheet � this should
  288. contain a �VLAN ID� parameter that is configurable to the desired VLAN ID.
  289. Choosing a value of 0 (zero) disables receive-side filtering based on VLAN ID.<o:p></o:p></span></p>
  290. <h3><span style='font-family:Verdana'>CODE TOUR<o:p></o:p></span></h3>
  291. <h4><span style='font-family:Verdana'>File Manifest<o:p></o:p></span></h4>
  292. <pre><u>File<span style='mso-tab-count:2'>���������� </span>Description<o:p></o:p></u></pre><pre><o:p>&nbsp;</o:p></pre><pre><span
  293. class=SpellE>Makefile</span><span style='mso-tab-count:1'>������ </span>Used during compilation to create the object and sys files</pre><pre>Miniport.c<span
  294. style='mso-tab-count:1'>���� </span>Miniport related routines for the MUX driver</pre><pre><span
  295. class=SpellE>Mux.c</span><span style='mso-tab-count:2'>��������� </span>DriverEntry routine and any routines common to the MUX miniport and protocol </pre><pre><span
  296. class=SpellE>Mux.h</span><span style='mso-tab-count:2'>��������� </span>Prototypes of all functions and data structures used by the MUX driver</pre><pre>Mux.htm<span
  297. style='mso-tab-count:2'>������� </span>Documentation for the MUX driver (this file)</pre><pre><span
  298. class=SpellE>Mux.rc</span><span style='mso-tab-count:2'>�������� </span>Resource <span
  299. class=GramE>file</span> for the MUX driver</pre><pre><span class=SpellE>Muxp.inf</span><span
  300. style='mso-tab-count:1'>������ </span>Installation INF for the service (protocol side installation)</pre><pre><span
  301. class=SpellE>Mux_mp.inf</span><span style='mso-tab-count:1'>���� </span>Installation INF for the miniport (virtual device installation)</pre><pre><span
  302. class=SpellE>Precomp.h</span><span style='mso-tab-count:1'>����� </span><span
  303. class=SpellE>Precompile</span> header file</pre><pre><span class=SpellE>Protocol.c</span><span
  304. style='mso-tab-count:1'>���� </span>Protocol related routines for the MUX driver</pre><pre>Sources<span
  305. style='mso-tab-count:2'>������� </span>List of source files that are compiled and linked to create the MUX driver. This can be modified to create binaries that operate on previous Windows versions (e.g. Windows 2000).</pre>
  306. <h4 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  307. style='font-family:Verdana'>Programming Tour<o:p></o:p></span></h4>
  308. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  309. style='font-size:10.0pt;font-family:Verdana'>When it loads, i.e. from its <i>DriverEntry</i>
  310. function, the MUX driver registers as an Intermediate miniport driver and as a
  311. protocol, in that order.<o:p></o:p></span></p>
  312. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><b><span
  313. style='font-size:10.0pt;font-family:Verdana'>Binding and VELAN Creation<o:p></o:p></span></b></p>
  314. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  315. style='font-size:10.0pt;font-family:Verdana'>NDIS calls MUX�s BindAdapter
  316. function, <i>PtBindAdapter</i>, for each underlying NDIS adapter to which it is
  317. configured to bind. This function allocates an ADAPT structure to represent the
  318. lower adapter, and calls NdisOpenAdapter to set up a binding to it. In the
  319. context of BindAdapterHandler, after successfully opening a binding to the
  320. underlying adapter, the driver queries the reserved keyword
  321. &quot;UpperBindings&quot; to get a list of device names for the virtual
  322. adapters that this particular binding is to expose � see <i>PtBootStrapVElans</i>
  323. for more details. Note that the MUX driver does not create bindings (i.e. call
  324. NdisOpenAdapter) from any context other than its BindAdapter function � this is
  325. recommended behavior for all drivers of this type.<o:p></o:p></span></p>
  326. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  327. style='font-size:10.0pt;font-family:Verdana'>For each device name specified in
  328. the �UpperBindings� key, the MUX driver allocates a VELAN data structure to
  329. represent the virtual miniport, calls NdisIMInitializeDeviceInstanceEx. In
  330. response, NDIS eventually calls the MUX miniport�s MiniportInitialize entry
  331. point, <i>MPInitialize</i>, for each VELAN. After <i>MPInitialize</i>
  332. successfully returns, NDIS takes care of getting upper-layer protocols to bind
  333. to the newly created virtual adapter(s).<o:p></o:p></span></p>
  334. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><b><span
  335. style='font-size:10.0pt;font-family:Verdana'>Unbinding and Halting</span></b><span
  336. style='font-size:10.0pt;font-family:Verdana'><o:p></o:p></span></p>
  337. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  338. style='font-size:10.0pt;font-family:Verdana'>NDIS calls MUX�s UnbindAdapter
  339. handler, <i>PtUnbindAdapter</i>, to request it to unbind from a lower adapter.
  340. In processing this, MUX calls NdisIMDeInitializeDeviceInstance for each VELAN
  341. instantiated on the indicated adapter � see <i>PtStopVElan</i> for details.
  342. This call results in NDIS first unbinding any protocols bound to the indicated
  343. VELAN, and then calling the MiniportHalt routine, <i>MPHalt</i>, for that
  344. VELAN. <i>MPHalt</i> waits for any outstanding receives/sends on the VELAN to
  345. finish before unlinking the VELAN from the ADAPT.<o:p></o:p></span></p>
  346. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i><span
  347. style='font-size:10.0pt;font-family:Verdana'>PtUnbindAdapter</span></i><span
  348. style='font-size:10.0pt;font-family:Verdana'> itself blocks until all VELANs
  349. associated with the ADAPT structure have been unlinked from it. This is to make
  350. sure that no thread running in the context of a miniport-edge entry point for a
  351. VELAN will ever access an invalid lower binding handle. Once all VELANs have
  352. been unlinked, <i>PtUnbindAdapter</i> closes the lower binding by calling
  353. NdisCloseAdapter. Note that the MUX driver does not close its lower binding
  354. from any context other than its UnbindAdapter function � this is recommended
  355. behavior for all drivers of this type.<o:p></o:p></span></p>
  356. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i><span
  357. style='font-size:10.0pt;font-family:Verdana'>MPHalt</span></i><span
  358. style='font-size:10.0pt;font-family:Verdana'> may also be called if the VELAN
  359. device is disabled, e.g. from the Network Connections Folder. There is no
  360. special code within <i>MPHalt</i> to handle this condition. However, <i>PtUnbindAdapter</i>
  361. takes care to not attempt to deinitialize a VELAN miniport (via
  362. NdisIMDeInitializeDeviceInstance) that has already been halted.<o:p></o:p></span></p>
  363. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><b><span
  364. style='font-size:10.0pt;font-family:Verdana'>Handling Queries<o:p></o:p></span></b></p>
  365. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i><span
  366. style='font-size:10.0pt;font-family:Verdana'>MPQueryInformation</span></i><span
  367. style='font-size:10.0pt;font-family:Verdana'> is the MUX driver�s function that
  368. handles queries for OID values on VELAN miniports. Most of the �Ethernet� type
  369. information for the virtual miniport is stored in the VELAN structure itself,
  370. and the driver returns information from this structure. The queries that are
  371. forwarded are OID_GEN_MEDIA_CONNECT_STATUS, OID_PNP_CAPABILITIES and
  372. OID_PNP_WAKE_UP_PATTERN_LIST. See �Handling Power Management� below for more
  373. information about the latter two OIDs.<i><o:p></o:p></i></span></p>
  374. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><b><span
  375. style='font-size:10.0pt;font-family:Verdana'>Handling Sets</span></b><span
  376. style='font-size:10.0pt;font-family:Verdana'><o:p></o:p></span></p>
  377. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i><span
  378. style='font-size:10.0pt;font-family:Verdana'>MPSetInformation</span></i><span
  379. style='font-size:10.0pt;font-family:Verdana'> handles setting OID values on
  380. VELAN miniports. Data management OIDs handled by the MUX driver are
  381. OID_802_3_MULTICAST_LIST and OID_GEN_CURRENT_PACKET_FILTER. The multicast list
  382. is handled entirely within the MUX driver � it just stores the set of multicast
  383. addresses in the VELAN structure, for reference during receive-side data processing.
  384. The packet filter is handled in a different way � the MUX driver combines the
  385. packet filter settings (bitwise OR) of all VELANs associated with the same
  386. lower adapter. If the combined packet filter is non-zero, MUX sends a Set
  387. request with a value of NDIS_PACKET_TYPE_PROMISCUOUS for
  388. OID_GEN_CURRENT_PACKET_FILTER to start receives on the lower adapter. If the
  389. combined packet filter is zero, MUX sets the lower adapter�s packet filter to 0
  390. (turns off all receives if there aren�t any interested protocols).<o:p></o:p></span></p>
  391. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  392. style='font-size:10.0pt;font-family:Verdana'>Note that setting the lower
  393. adapter to promiscuous mode is only done here in order to be able to receive <span
  394. class=SpellE>unicast</span> frames directed to multiple MAC addresses. If, for
  395. example, all VELANs are assigned the same MAC address (which is identical to
  396. the address of the lower adapter), then the MUX driver should only pass down
  397. the combined (bitwise OR) setting of packet filter settings of all VELANs.<o:p></o:p></span></p>
  398. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  399. style='font-size:10.0pt;font-family:Verdana'>Some power management OIDs are
  400. forwarded to the lower miniport. See �Handling Power Management� below for details.
  401. <o:p></o:p></span></p>
  402. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><b><span
  403. style='font-size:10.0pt;font-family:Verdana'>Sending Data<o:p></o:p></span></b></p>
  404. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  405. style='font-size:10.0pt;font-family:Verdana'>Data sent down on a VELAN miniport
  406. is forwarded to the lower adapter. The MUX driver itself does not generate any
  407. data of its own. The MUX driver allocates a new NDIS_PACKET for each packet
  408. passed to its <i>MPSendPackets</i> function, and saves a pointer to the
  409. original NDIS_PACKET in the reserved area of the packet structure. When the
  410. lower adapter completes the send (<i>PtSendComplete</i>), MUX picks up the
  411. original packet and calls NdisMSendComplete to complete the original send
  412. request.<o:p></o:p></span></p>
  413. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  414. style='font-size:10.0pt;font-family:Verdana'>If a non-zero VLAN ID is
  415. configured for the VELAN, and/or the packet has non-zero Ieee8021QInfo
  416. per-packet information, then the MUX driver inserts an NDIS buffer containing a
  417. tag header to the front of the packet before sending it down � see function <i
  418. style='mso-bidi-font-style:normal'>MPHandleSendTagging</i> for details.<o:p></o:p></span></p>
  419. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><b><span
  420. style='font-size:10.0pt;font-family:Verdana'>Receiving Data<o:p></o:p></span></b></p>
  421. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  422. style='font-size:10.0pt;font-family:Verdana'>Data received from a lower adapter
  423. is indicated up on zero or more VELANs. The <i>PtReceivePacket</i> or <i>PtReceive</i>
  424. function is called for each packet received from the lower adapter. In both
  425. cases, the received data is checked for matches with the packet filter and
  426. multicast list for each VELAN associated with the adapter (see <i>PtMatchPacketToVElan</i>).
  427. Whenever a match is found, a new NDIS_PACKET is allocated and set to point to
  428. the received data. A pointer to the original received packet (if any) is also
  429. stored in the new packet�s reserved area. This packet is indicated up via
  430. NdisMIndicateReceivePacket to all interested protocols on that VELAN. <o:p></o:p></span></p>
  431. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  432. style='font-size:10.0pt;font-family:Verdana'>The driver�s <i>MPReturnPacket</i>
  433. function is called either by NDIS or by MUX itself when protocols are done with
  434. a received packet. This function returns the original packet indicated by the
  435. lower driver, if any, by calling NdisReturnPackets.<o:p></o:p></span></p>
  436. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  437. style='font-size:10.0pt;font-family:Verdana'>The driver indicates up received
  438. frames that do not have an IEEE 802.1Q tag header in them � see function <i
  439. style='mso-bidi-font-style:normal'>PtHandleRcvTagging</i>. It always strips off
  440. tag headers, if present, on received frames. If a non-zero VLAN ID is
  441. configured, then it checks received frames that contain tag headers for
  442. matching VLAN Ids � only matching frames are indicated up to protocols. Any
  443. VLAN/priority information present in incoming frames is copied to per-packet
  444. information fields of indicated NDIS_PACKET structures.<o:p></o:p></span></p>
  445. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><b><span
  446. style='font-size:10.0pt;font-family:Verdana'>Status Indications</span></b><span
  447. style='font-size:10.0pt;font-family:Verdana'><o:p></o:p></span></p>
  448. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  449. style='font-size:10.0pt;font-family:Verdana'>The only status indications that
  450. are forwarded up by MUX are media connect status indications. See <i>PtStatus</i>
  451. for more details.<o:p></o:p></span></p>
  452. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><b><span
  453. style='font-size:10.0pt;font-family:Verdana'>Handling Power Management</span></b><span
  454. style='font-size:10.0pt;font-family:Verdana'><o:p></o:p></span></p>
  455. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  456. style='font-size:10.0pt;font-family:Verdana'>During initialization (<i>MPInitialize</i>),
  457. the MUX miniport sets the attribute <i>NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND</i> in
  458. its call to NdisMSetAttributesEx. When the MUX miniport is requested to report
  459. its Plug and Play capabilities (OID_PNP_CAPABILITIES), the MUX miniport
  460. forwards the request to the underlying miniport. If this request succeeds, then
  461. the MUX miniport overwrites the following fields before successfully completing
  462. the original request: <o:p></o:p></span></p>
  463. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  464. style='font-size:10.0pt;font-family:Verdana'>NDIS_DEVICE_POWER_STATE<span
  465. style='mso-tab-count:1'>��������� </span>MinMagicPacketWakeUp =
  466. NdisDeviceStateUnspecified;<o:p></o:p></span></p>
  467. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  468. style='font-size:10.0pt;font-family:Verdana'>NDIS_DEVICE_POWER_STATE<span
  469. style='mso-tab-count:1'>��������� </span><span class=SpellE>MinPatternWakeUp</span>=
  470. NdisDeviceStateUnspecified;<o:p></o:p></span></p>
  471. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  472. style='font-size:10.0pt;font-family:Verdana'>NDIS_DEVICE_POWER_STATE<span
  473. style='mso-tab-count:1'>��������� </span>MinLinkChangeWakeUp=NdisDeviceStateUnspecified<o:p></o:p></span></p>
  474. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  475. style='font-size:10.0pt;font-family:Verdana'>See <i>PtPostProcessPnPCapabilities</i>
  476. for details. <o:p></o:p></span></p>
  477. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  478. style='font-size:10.0pt;font-family:Verdana'>OID_PNP_SET_POWER and
  479. OID_PNP_QUERY_POWER are not passed to the lower adapter, since the lower layer
  480. miniport will receive independent requests from NDIS.<o:p></o:p></span></p>
  481. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  482. style='font-size:10.0pt;font-family:Verdana'>NDIS calls the MUX driver�s
  483. ProtocolPnPEvent function (<i>PtPNPHandler</i>) whenever the underlying adapter
  484. is transitioned to a different power state. If the underlying adapter is
  485. transitioning to a low power state, the driver waits for all outstanding sends
  486. and requests to complete.<o:p></o:p></span></p>
  487. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  488. style='font-size:10.0pt;font-family:Verdana'>Queries/sets received on a VELAN
  489. miniport that are to be forwarded to the underlying adapter are queued on the
  490. VELAN if the underlying adapter is at a low power state. These are picked up
  491. for processing on receiving a notification that the underlying adapter is back
  492. to a powered-up state.<o:p></o:p></span></p>
  493. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><b><span
  494. style='font-size:10.0pt;font-family:Verdana'>Handling Global Reconfiguration</span></b><span
  495. style='font-size:10.0pt;font-family:Verdana'><o:p></o:p></span></p>
  496. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  497. style='font-size:10.0pt;font-family:Verdana'>All modifications to VELAN
  498. configuration are accompanied by PnP reconfigure notifications, i.e.
  499. NetEventReconfigure events passed to the MUX�s PnPEventHandler, <i>PtPNPHandler</i>.
  500. This driver takes a broad approach to handling reconfiguration, which is to
  501. simply re-examine all the �UpperBindings� keys for all currently bound
  502. adapters, and start off VELANs for any that do not exist � see <i>PtBootStrapVElans</i>
  503. for details.<o:p></o:p></span></p>
  504. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><b><span
  505. style='font-size:10.0pt;font-family:Verdana'>NDIS 5.1 Features</span></b><span
  506. style='font-size:10.0pt;font-family:Verdana'><o:p></o:p></span></p>
  507. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  508. style='font-size:10.0pt;font-family:Verdana'>The NDIS 5.1 features in MUX are
  509. identified by #ifdef NDIS51 compiler directives. The following feature is
  510. illustrated (refer to the DDK documentation for more information on these):<o:p></o:p></span></p>
  511. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><b><span
  512. style='font-size:10.0pt;font-family:Verdana'>Canceling Sends</span></b><span
  513. style='font-size:10.0pt;font-family:Verdana'>: MUX propagates send
  514. cancellations from protocols above it to lower miniports.<o:p></o:p></span></p>
  515. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  516. style='font-size:10.0pt;font-family:Verdana'><span
  517. style='mso-spacerun:yes'>�</span><o:p></o:p></span></p>
  518. <p align=center style='text-align:center;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><a
  519. href="#top"><span style='font-size:10.0pt;font-family:Verdana'>Top of page</span></a><span
  520. style='font-size:10.0pt;font-family:Verdana'> <o:p></o:p></span></p>
  521. <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=624
  522. style='width:6.5in;mso-cellspacing:0in;mso-padding-alt:0in 0in 0in 0in'>
  523. <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes;height:1.5pt'>
  524. <td style='background:aqua;padding:.75pt .75pt .75pt .75pt;height:1.5pt'>
  525. <p class=MsoNormal><o:p>&nbsp;</o:p></p>
  526. </td>
  527. </tr>
  528. </table>
  529. <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
  530. style='font-size:7.5pt;font-family:"MS Sans Serif"'>� 1999 Microsoft
  531. Corporation</span><span style='font-size:10.0pt;font-family:Verdana'> <o:p></o:p></span></p>
  532. </div>
  533. </body>
  534. </html>