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.

777 lines
20 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. cnpdef.h
  5. Abstract:
  6. Main private header file for the Cluster Network Protocol.
  7. Author:
  8. Mike Massa (mikemas) July 29, 1996
  9. Revision History:
  10. Who When What
  11. -------- -------- ----------------------------------------------
  12. mikemas 07-29-96 created
  13. Notes:
  14. --*/
  15. #ifndef _CNPDEF_INCLUDED_
  16. #define _CNPDEF_INCLUDED_
  17. #include <fipsapi.h>
  18. #include <sspi.h>
  19. //
  20. // Forward declarations
  21. //
  22. typedef struct _CNP_INTERFACE *PCNP_INTERFACE;
  23. //
  24. // Priority definitions
  25. //
  26. #define CnpIsHigherPriority(_p1, _p2) ((_p1) < (_p2))
  27. #define CnpIsLowerPriority(_p1, _p2) ((_p1) > (_p2))
  28. #define CnpIsEqualPriority(_p1, _p2) ((_p1) == (_p2))
  29. //
  30. // Multicast Group Object
  31. //
  32. // This structure contains the data needed to implement a multicast
  33. // endpoint on a network.
  34. //
  35. typedef struct _CNP_MULTICAST_GROUP {
  36. ULONG McastNetworkBrand;
  37. PTRANSPORT_ADDRESS McastTdiAddress;
  38. ULONG McastTdiAddressLength;
  39. PVOID Key;
  40. ULONG KeyLength;
  41. ULONG SignatureLength;
  42. ULONG RefCount;
  43. } CNP_MULTICAST_GROUP, *PCNP_MULTICAST_GROUP;
  44. //
  45. // Network Object
  46. //
  47. // This structure represents a communication link between the nodes of a
  48. // cluster. It references a particular transport protocol and interface
  49. // configured on the local system. It also links together all of the
  50. // interface objects for the nodes attached to the network.
  51. //
  52. // Networks are identified by a small integer assigned by the Cluster
  53. // Service. Network objects are stored in a global array indexed by
  54. // the network ID.
  55. //
  56. typedef struct {
  57. LIST_ENTRY Linkage;
  58. CN_SIGNATURE_FIELD
  59. CL_NETWORK_ID Id;
  60. CN_LOCK Lock;
  61. CN_IRQL Irql;
  62. ULONG RefCount;
  63. ULONG ActiveRefCount;
  64. CLUSNET_NETWORK_STATE State;
  65. ULONG Flags;
  66. ULONG Priority;
  67. HANDLE DatagramHandle;
  68. PFILE_OBJECT DatagramFileObject;
  69. PDEVICE_OBJECT DatagramDeviceObject;
  70. TDI_PROVIDER_INFO ProviderInfo;
  71. PIRP PendingDeleteIrp;
  72. PIRP PendingOfflineIrp;
  73. WORK_QUEUE_ITEM ExWorkItem;
  74. PCNP_MULTICAST_GROUP CurrentMcastGroup;
  75. PCNP_MULTICAST_GROUP PreviousMcastGroup;
  76. CX_CLUSTERSCREEN McastReachableNodes;
  77. ULONG McastReachableCount;
  78. } CNP_NETWORK, *PCNP_NETWORK;
  79. #define CNP_NETWORK_SIG 'kwtn'
  80. extern LIST_ENTRY CnpNetworkList;
  81. extern CN_LOCK CnpNetworkListLock;
  82. #define CNP_NET_FLAG_DELETING 0x00000001
  83. #define CNP_NET_FLAG_PARTITIONED 0x00000002
  84. #define CNP_NET_FLAG_RESTRICTED 0x00000004
  85. #define CNP_NET_FLAG_LOCALDISCONN 0x00000008
  86. #define CNP_NET_FLAG_MULTICAST 0x00000010
  87. #define CNP_NET_FLAG_MCASTSORTED 0x00000020
  88. #define CnpIsNetworkDeleting(_network) \
  89. (((_network)->Flags & CNP_NET_FLAG_DELETING) != 0)
  90. #define CnpIsValidNetworkId(_id) ( ((_id) != ClusterAnyNetworkId ) && \
  91. ((_id) != ClusterInvalidNetworkId))
  92. #define CnpIsNetworkRestricted(_network) \
  93. (((_network)->Flags & CNP_NET_FLAG_RESTRICTED) != 0)
  94. #define CnpIsNetworkLocalDisconn(_network) \
  95. (((_network)->Flags & CNP_NET_FLAG_LOCALDISCONN) != 0)
  96. #define CnpIsNetworkMulticastCapable(_network) \
  97. (((_network)->Flags & CNP_NET_FLAG_MULTICAST) != 0)
  98. #define CnpIsNetworkMulticastSorted(_network) \
  99. (((_network)->Flags & CNP_NET_FLAG_MCASTSORTED) != 0)
  100. #define CnpNetworkResetMcastReachableNodes(_network) \
  101. (RtlZeroMemory( \
  102. &((_network)->McastReachableNodes), \
  103. sizeof((_network)->McastReachableNodes) \
  104. ))
  105. /*
  106. (BYTE((_network)->McastReachableNodes, INT_NODE(CnLocalNodeId)) \
  107. = (1 << (BYTEL-1-BIT(INT_NODE(CnLocalNodeId)))))
  108. */
  109. //
  110. // Node Object
  111. //
  112. // This structure represents a cluster node. One exists for each
  113. // defined member of a cluster.
  114. //
  115. // Nodes are identified by a small integer assigned by the Cluster Service.
  116. // Node objects are stored in a global array indexed by node ID.
  117. //
  118. // Note that the order of the CLUSTER_NODE_COMM_STATE enumeration *is* important.
  119. //
  120. typedef struct {
  121. LIST_ENTRY Linkage;
  122. CN_SIGNATURE_FIELD
  123. CL_NODE_ID Id;
  124. CN_LOCK Lock;
  125. CN_IRQL Irql;
  126. ULONG RefCount;
  127. CLUSNET_NODE_COMM_STATE CommState;
  128. CLUSNET_NODE_STATE MMState;
  129. ULONG Flags;
  130. LIST_ENTRY InterfaceList;
  131. PCNP_INTERFACE CurrentInterface;
  132. PIRP PendingDeleteIrp;
  133. BOOLEAN HBWasMissed;
  134. BOOLEAN NodeDownIssued;
  135. ULONG MissedHBs;
  136. } CNP_NODE, *PCNP_NODE;
  137. #define CNP_NODE_SIG 'edon'
  138. extern PCNP_NODE * CnpNodeTable;
  139. extern CN_LOCK CnpNodeTableLock;
  140. extern PCNP_NODE CnpLocalNode;
  141. #define CNP_NODE_FLAG_DELETING 0x00000001
  142. #define CNP_NODE_FLAG_UNREACHABLE 0x00000002
  143. #define CNP_NODE_FLAG_LOCAL 0x00000010
  144. #define CnpIsNodeDeleting(_node) \
  145. ((_node)->Flags & CNP_NODE_FLAG_DELETING)
  146. #define CnpIsNodeLocal(_node) \
  147. ((_node)->Flags & CNP_NODE_FLAG_LOCAL)
  148. #define CnpIsNodeUnreachable(_node) \
  149. ((_node)->Flags & CNP_NODE_FLAG_UNREACHABLE)
  150. //++
  151. //
  152. // Routine Description:
  153. //
  154. // Callback routine for CnpWalkNodeTable. Performs an operation on
  155. // the specified node.
  156. //
  157. // Arguments:
  158. //
  159. // UpdateNode - A pointer to the node on which to operate.
  160. //
  161. // UpdateContext - Operation-specific context
  162. //
  163. // NodeTableIrql - The IRQL at which the CnpNodeTableLock was acquired.
  164. //
  165. // Return Value:
  166. //
  167. // Returns TRUE if the CnpNodeTable lock is still held.
  168. // Returns FALSE if the CnpNodeTable lock is released.
  169. //
  170. // Notes:
  171. //
  172. // Called with both the CnpNodeTable and node object locks held.
  173. // The node object lock is released upon return.
  174. //
  175. //--
  176. typedef
  177. BOOLEAN
  178. (*PCNP_NODE_UPDATE_ROUTINE)(
  179. IN PCNP_NODE UpdateNode,
  180. IN PVOID UpdateContext,
  181. IN CN_IRQL NodeTableIrql
  182. );
  183. //
  184. // Interface Object
  185. //
  186. // This structure represents a node's transport interface to a network.
  187. // It contains a transport address which may be used to communicate
  188. // with the specified node using the specified network.
  189. //
  190. // Interface objects are linked onto lists in the associated node objects.
  191. // They are identified by a {node, network} tuple.
  192. //
  193. // The interfaces on a node are ranked based on their state and priority.
  194. // Numerically higher state values are ranked ahead of lower values.
  195. // For interfaces with the same state, Numerically lower priority values
  196. // are ranked ahead of lower values. Priority values fall in the range
  197. // 0x1-0xFFFFFFFF. State values are defined by CLUSNET_INTERFACE_STATE
  198. // enumeration. By default, interfaces inherit their priority from the
  199. // associated network. In this case, the Priority field will contain the
  200. // network's priority value, and the CNP_IF_FLAG_USE_NETWORK_PRIORITY flag
  201. // will be set in the Flags field.
  202. //
  203. // Note that the order of the CLUSNET_INTERFACE_STATE enumeration
  204. // *is* important.
  205. //
  206. typedef struct _CNP_INTERFACE {
  207. LIST_ENTRY NodeLinkage;
  208. CN_SIGNATURE_FIELD
  209. PCNP_NODE Node;
  210. PCNP_NETWORK Network;
  211. CLUSNET_INTERFACE_STATE State;
  212. ULONG Priority;
  213. ULONG Flags;
  214. ULONG MissedHBs;
  215. ULONG SequenceToSend;
  216. ULONG LastSequenceReceived;
  217. ULONG McastDiscoverCount;
  218. ULONG McastRediscoveryCountdown;
  219. ULONG AdapterWMIProviderId;
  220. ULONG TdiAddressLength;
  221. TRANSPORT_ADDRESS TdiAddress;
  222. } CNP_INTERFACE;
  223. #define CNP_INTERFACE_SIG ' fi'
  224. #define CNP_INTERFACE_MCAST_DISCOVERY 0x5
  225. #define CNP_INTERFACE_MCAST_REDISCOVERY 3000 // 1 hr at 1.2 hbs/sec
  226. #define CNP_IF_FLAG_USE_NETWORK_PRIORITY 0x00000001
  227. #define CNP_IF_FLAG_RECVD_MULTICAST 0x00000002
  228. #define CnpIsInterfaceUsingNetworkPriority(_if) \
  229. ( (_if)->Flags & CNP_IF_FLAG_USE_NETWORK_PRIORITY )
  230. #define CnpInterfaceQueryReceivedMulticast(_if) \
  231. ( (_if)->Flags & CNP_IF_FLAG_RECVD_MULTICAST )
  232. #define CnpInterfaceSetReceivedMulticast(_if) \
  233. ( (_if)->Flags |= CNP_IF_FLAG_RECVD_MULTICAST )
  234. #define CnpInterfaceClearReceivedMulticast(_if) \
  235. ( (_if)->Flags &= ~CNP_IF_FLAG_RECVD_MULTICAST )
  236. //++
  237. //
  238. // Routine Description:
  239. //
  240. // Callback routine for CnpWalkInterfacesOnNetwork and
  241. // CnpWalkInterfacesOnNode routines. Performs a specified
  242. // operation on all interfaces.
  243. //
  244. // Arguments:
  245. //
  246. // UpdateInterface - A pointer to the interface on which to operate.
  247. //
  248. // Return Value:
  249. //
  250. // None.
  251. //
  252. // Notes:
  253. //
  254. // Called with the associated node and network object locks held.
  255. // Mut return with the network object lock released.
  256. // May not release node object lock at any time.
  257. //
  258. //--
  259. typedef
  260. VOID
  261. (*PCNP_INTERFACE_UPDATE_ROUTINE)(
  262. IN PCNP_INTERFACE UpdateInterface
  263. );
  264. //
  265. // Send Request Pool
  266. //
  267. typedef struct {
  268. USHORT UpperProtocolHeaderLength;
  269. ULONG UpperProtocolContextSize;
  270. UCHAR UpperProtocolNumber;
  271. UCHAR CnpVersionNumber;
  272. UCHAR Pad[2];
  273. } CNP_SEND_REQUEST_POOL_CONTEXT, *PCNP_SEND_REQUEST_POOL_CONTEXT;
  274. //
  275. // Forward Declaration
  276. //
  277. typedef struct _CNP_SEND_REQUEST *PCNP_SEND_REQUEST;
  278. typedef
  279. VOID
  280. (*PCNP_SEND_COMPLETE_ROUTINE)(
  281. IN NTSTATUS Status,
  282. IN OUT PULONG BytesSent,
  283. IN PCNP_SEND_REQUEST SendRequest,
  284. IN PMDL DataMdl
  285. );
  286. //
  287. // Send Request Structure
  288. //
  289. typedef struct _CNP_SEND_REQUEST {
  290. CN_RESOURCE CnResource;
  291. PMDL HeaderMdl;
  292. PVOID CnpHeader;
  293. PIRP UpperProtocolIrp;
  294. PVOID UpperProtocolHeader;
  295. USHORT UpperProtocolHeaderLength;
  296. KPROCESSOR_MODE UpperProtocolIrpMode;
  297. UCHAR Pad;
  298. PMDL UpperProtocolMdl;
  299. PVOID UpperProtocolContext;
  300. PCNP_SEND_COMPLETE_ROUTINE CompletionRoutine;
  301. PCNP_NETWORK Network;
  302. PCNP_MULTICAST_GROUP McastGroup;
  303. TDI_CONNECTION_INFORMATION TdiSendDatagramInfo;
  304. } CNP_SEND_REQUEST;
  305. //
  306. // Internal Init/Cleanup routines
  307. //
  308. //
  309. // Internal Node Routines
  310. //
  311. VOID
  312. CnpWalkNodeTable(
  313. PCNP_NODE_UPDATE_ROUTINE UpdateRoutine,
  314. PVOID UpdateContext
  315. );
  316. NTSTATUS
  317. CnpValidateAndFindNode(
  318. IN CL_NODE_ID NodeId,
  319. OUT PCNP_NODE * Node
  320. );
  321. PCNP_NODE
  322. CnpLockedFindNode(
  323. IN CL_NODE_ID NodeId,
  324. IN CN_IRQL NodeTableIrql
  325. );
  326. PCNP_NODE
  327. CnpFindNode(
  328. IN CL_NODE_ID NodeId
  329. );
  330. VOID
  331. CnpOfflineNode(
  332. PCNP_NODE Node
  333. );
  334. VOID
  335. CnpDeclareNodeUnreachable(
  336. PCNP_NODE Node
  337. );
  338. VOID
  339. CnpDeclareNodeReachable(
  340. PCNP_NODE Node
  341. );
  342. VOID
  343. CnpReferenceNode(
  344. PCNP_NODE Node
  345. );
  346. VOID
  347. CnpDereferenceNode(
  348. PCNP_NODE Node
  349. );
  350. //
  351. // Internal Network Routines
  352. //
  353. VOID
  354. CnpReferenceNetwork(
  355. PCNP_NETWORK Network
  356. );
  357. VOID
  358. CnpDereferenceNetwork(
  359. PCNP_NETWORK Network
  360. );
  361. ULONG
  362. CnpActiveReferenceNetwork(
  363. PCNP_NETWORK Network
  364. );
  365. VOID
  366. CnpActiveDereferenceNetwork(
  367. PCNP_NETWORK Network
  368. );
  369. PCNP_NETWORK
  370. CnpFindNetwork(
  371. IN CL_NETWORK_ID NetworkId
  372. );
  373. VOID
  374. CnpDeleteNetwork(
  375. PCNP_NETWORK Network,
  376. CN_IRQL NetworkListIrql
  377. );
  378. VOID
  379. CnpFreeMulticastGroup(
  380. IN PCNP_MULTICAST_GROUP Group
  381. );
  382. #define CnpReferenceMulticastGroup(_group) \
  383. (InterlockedIncrement(&((_group)->RefCount)))
  384. #define CnpDereferenceMulticastGroup(_group) \
  385. if (InterlockedDecrement(&((_group)->RefCount)) == 0) { \
  386. CnpFreeMulticastGroup(_group); \
  387. }
  388. BOOLEAN
  389. CnpSortMulticastNetwork(
  390. IN PCNP_NETWORK Network,
  391. IN BOOLEAN RaiseEvent,
  392. OUT CX_CLUSTERSCREEN * McastReachableNodes OPTIONAL
  393. );
  394. BOOLEAN
  395. CnpMulticastChangeNodeReachability(
  396. IN PCNP_NETWORK Network,
  397. IN PCNP_NODE Node,
  398. IN BOOLEAN Reachable,
  399. IN BOOLEAN RaiseEvent,
  400. OUT CX_CLUSTERSCREEN * NewMcastReachableNodes OPTIONAL
  401. );
  402. PCNP_NETWORK
  403. CnpGetBestMulticastNetwork(
  404. VOID
  405. );
  406. VOID
  407. CnpStartInterfaceMcastTransition(
  408. PCNP_INTERFACE Interface
  409. );
  410. //
  411. // Internal Interface Routines
  412. //
  413. VOID
  414. CnpWalkInterfacesOnNode(
  415. PCNP_NODE Node,
  416. PCNP_INTERFACE_UPDATE_ROUTINE UpdateRoutine
  417. );
  418. VOID
  419. CnpWalkInterfacesOnNetwork(
  420. PCNP_NETWORK Network,
  421. PCNP_INTERFACE_UPDATE_ROUTINE UpdateRoutine
  422. );
  423. NTSTATUS
  424. CnpOnlinePendingInterface(
  425. PCNP_INTERFACE Interface
  426. );
  427. VOID
  428. CnpOnlinePendingInterfaceWrapper(
  429. PCNP_INTERFACE Interface
  430. );
  431. NTSTATUS
  432. CnpOfflineInterface(
  433. PCNP_INTERFACE Interface
  434. );
  435. VOID
  436. CnpOfflineInterfaceWrapper(
  437. PCNP_INTERFACE Interface
  438. );
  439. NTSTATUS
  440. CnpOnlineInterface(
  441. PCNP_INTERFACE Interface
  442. );
  443. NTSTATUS
  444. CnpFailInterface(
  445. PCNP_INTERFACE Interface
  446. );
  447. VOID
  448. CnpDeleteInterface(
  449. IN PCNP_INTERFACE Interface
  450. );
  451. VOID
  452. CnpReevaluateInterfaceRole(
  453. IN PCNP_INTERFACE Interface
  454. );
  455. VOID
  456. CnpRecalculateInterfacePriority(
  457. IN PCNP_INTERFACE Interface
  458. );
  459. VOID
  460. CnpUpdateNodeCurrentInterface(
  461. PCNP_NODE Node
  462. );
  463. VOID
  464. CnpResetAndOnlinePendingInterface(
  465. IN PCNP_INTERFACE Interface
  466. );
  467. NTSTATUS
  468. CnpFindInterface(
  469. IN CL_NODE_ID NodeId,
  470. IN CL_NETWORK_ID NetworkId,
  471. OUT PCNP_INTERFACE * Interface
  472. );
  473. //
  474. // Send Routines.
  475. //
  476. PCN_RESOURCE_POOL
  477. CnpCreateSendRequestPool(
  478. IN UCHAR CnpVersionNumber,
  479. IN UCHAR UpperProtocolNumber,
  480. IN USHORT UpperProtocolHeaderSize,
  481. IN USHORT UpperProtocolContextSize,
  482. IN USHORT PoolDepth
  483. );
  484. #define CnpDeleteSendRequestPool(_pool) \
  485. { \
  486. CnDrainResourcePool(_pool); \
  487. CnFreePool(_pool); \
  488. }
  489. NTSTATUS
  490. CnpSendPacket(
  491. IN PCNP_SEND_REQUEST SendRequest,
  492. IN CL_NODE_ID DestNodeId,
  493. IN PMDL DataMdl,
  494. IN USHORT DataLength,
  495. IN BOOLEAN CheckDestState,
  496. IN CL_NETWORK_ID NetworkId OPTIONAL
  497. );
  498. VOID
  499. CcmpSendPoisonPacket(
  500. IN PCNP_NODE Node,
  501. IN PCX_SEND_COMPLETE_ROUTINE CompletionRoutine, OPTIONAL
  502. IN PVOID CompletionContext, OPTIONAL
  503. IN PCNP_NETWORK Network, OPTIONAL
  504. IN PIRP Irp OPTIONAL
  505. );
  506. //
  507. // Receive Routines
  508. //
  509. NTSTATUS
  510. CcmpReceivePacketHandler(
  511. IN PCNP_NETWORK Network,
  512. IN CL_NODE_ID SourceNodeId,
  513. IN ULONG CnpReceiveFlags,
  514. IN ULONG TdiReceiveDatagramFlags,
  515. IN ULONG BytesIndicated,
  516. IN ULONG BytesAvailable,
  517. OUT PULONG BytesTaken,
  518. IN PVOID Tsdu,
  519. OUT PIRP * Irp
  520. );
  521. VOID
  522. CnpReceiveHeartBeatMessage(
  523. IN PCNP_NETWORK Network,
  524. IN CL_NODE_ID SourceNodeId,
  525. IN ULONG SeqNumber,
  526. IN ULONG AckNumber,
  527. IN BOOLEAN Multicast,
  528. IN ULONG MulticastEpoch
  529. );
  530. VOID
  531. CnpReceivePoisonPacket(
  532. IN PCNP_NETWORK Network,
  533. IN CL_NODE_ID SourceNodeId,
  534. IN ULONG SeqNumber
  535. );
  536. //
  537. // TDI routines
  538. //
  539. NTSTATUS
  540. CnpTdiReceiveDatagramHandler(
  541. IN PVOID TdiEventContext,
  542. IN LONG SourceAddressLength,
  543. IN PVOID SourceAddress,
  544. IN LONG OptionsLength,
  545. IN PVOID Options,
  546. IN ULONG ReceiveDatagramFlags,
  547. IN ULONG BytesIndicated,
  548. IN ULONG BytesAvailable,
  549. OUT PULONG BytesTaken,
  550. IN PVOID Tsdu,
  551. OUT PIRP * IoRequestPacket
  552. );
  553. NTSTATUS
  554. CnpTdiErrorHandler(
  555. IN PVOID TdiEventContext,
  556. IN NTSTATUS Status
  557. );
  558. NTSTATUS
  559. CnpTdiSetEventHandler(
  560. IN PFILE_OBJECT FileObject,
  561. IN PDEVICE_OBJECT DeviceObject,
  562. IN ULONG EventType,
  563. IN PVOID EventHandler,
  564. IN PVOID EventContext,
  565. IN PIRP ClientIrp OPTIONAL
  566. );
  567. NTSTATUS
  568. CnpIssueDeviceControl (
  569. IN PFILE_OBJECT FileObject,
  570. IN PDEVICE_OBJECT DeviceObject,
  571. IN PVOID IrpParameters,
  572. IN ULONG IrpParametersLength,
  573. IN PVOID MdlBuffer,
  574. IN ULONG MdlBufferLength,
  575. IN UCHAR MinorFunction,
  576. IN PIRP ClientIrp OPTIONAL
  577. );
  578. VOID
  579. CnpAttachSystemProcess(
  580. VOID
  581. );
  582. VOID
  583. CnpDetachSystemProcess(
  584. VOID
  585. );
  586. NTSTATUS
  587. CnpOpenDevice(
  588. IN LPWSTR DeviceName,
  589. OUT HANDLE *Handle
  590. );
  591. NTSTATUS
  592. CnpZwDeviceControl(
  593. IN HANDLE Handle,
  594. IN ULONG IoControlCode,
  595. IN PVOID InputBuffer,
  596. IN ULONG InputBufferLength,
  597. IN PVOID OutputBuffer,
  598. IN ULONG OutputBufferLength
  599. );
  600. NTSTATUS
  601. CnpSetTcpInfoEx(
  602. IN HANDLE Handle,
  603. IN ULONG Entity,
  604. IN ULONG Class,
  605. IN ULONG Type,
  606. IN ULONG Id,
  607. IN PVOID Value,
  608. IN ULONG ValueLength
  609. );
  610. #define CnpIsIrpStackSufficient(_irp, _targetdevice) \
  611. ((_irp)->CurrentLocation - (_targetdevice)->StackSize >= 1)
  612. #define CnpIsIPv4McastTransportAddress(_ta) \
  613. ( (((PTA_IP_ADDRESS)(_ta))->Address[0].AddressType \
  614. == TDI_ADDRESS_TYPE_IP \
  615. ) \
  616. && ((((PTA_IP_ADDRESS)(_ta))->Address[0].Address[0].in_addr \
  617. & 0xf0) \
  618. == 0xe0 \
  619. ) \
  620. )
  621. #define CnpIsIPv4McastSameGroup(_ta1, _ta2) \
  622. ( ((PTA_IP_ADDRESS)(_ta1))->Address[0].Address[0].in_addr == \
  623. ((PTA_IP_ADDRESS)(_ta2))->Address[0].Address[0].in_addr \
  624. )
  625. //
  626. // Signature mechanisms.
  627. //
  628. extern FIPS_FUNCTION_TABLE CxFipsFunctionTable;
  629. // The signature length is the SHA digest length.
  630. #define CX_SIGNATURE_LENGTH A_SHA_DIGEST_LEN
  631. // The salt length is eight bytes.
  632. #define CX_SIGNATURE_SALT_LENGTH sizeof(ULONGLONG)
  633. // Combined signature and salt
  634. #define CX_SIGNATURE_DATA_LENGTH \
  635. (CX_SIGNATURE_LENGTH + CX_SIGNATURE_SALT_LENGTH)
  636. NTSTATUS
  637. CnpSignMulticastMessage(
  638. IN PCNP_SEND_REQUEST SendRequest,
  639. IN PMDL DataMdl,
  640. IN OUT CL_NETWORK_ID * NetworkId,
  641. OUT ULONG * SigLen OPTIONAL
  642. );
  643. NTSTATUS
  644. CnpVerifyMulticastMessage(
  645. IN PCNP_NETWORK Network,
  646. IN PVOID Tsdu,
  647. IN ULONG TsduLength,
  648. IN ULONG ExpectedPayload,
  649. OUT ULONG * BytesTaken,
  650. OUT BOOLEAN * CurrentGroup
  651. );
  652. NTSTATUS
  653. CnpInitializeSaltGenerator(
  654. VOID
  655. );
  656. #endif // ifndef _CNPDEF_INCLUDED_