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.

100 lines
3.3 KiB

  1. //========================================================================
  2. // Copyright (C) 1997 Microsoft Corporation
  3. // Author: RameshV
  4. // Description: This file has been generated. Pl look at the .c file
  5. //========================================================================
  6. #define IS_SWITCHED(X) (((X) & 0x00000002)?TRUE:FALSE)
  7. #define IS_DISABLED(X) (((X) & 0x00000001)?TRUE:FALSE)
  8. #define SWITCHED(X) ((X) |= 0x00000002 )
  9. #define DISABLED(X) ((X) |= 0x00000001 )
  10. BOOL
  11. MemSubnetRequestAddress(
  12. IN OUT PM_SUBNET Subnet, // the subnet to start the search in
  13. IN DWORD Address, // init. addr: 0 => search in SuperScope, SubnetAddr = try subnet first
  14. IN BOOL fAcquire, // also acquire the address? or just test for availability?
  15. IN BOOL fBootp, // acquire BOOTP address?
  16. OUT DWORD *RetAddress, // OPTIONAL if Address is not 0 or SubnetAddr -- address obtained
  17. OUT PM_SUBNET *RetSubnet // OPTIONAL if Address is not 0 - which subnet is the address from
  18. ) ;
  19. DWORD
  20. MemServerReleaseAddress(
  21. IN OUT PM_SERVER Server,
  22. IN DWORD Address,
  23. IN BOOL fBootp
  24. ) ;
  25. DWORD _inline
  26. MemSubnetReleaseAddress(
  27. IN OUT PM_SUBNET Subnet,
  28. IN DWORD Address,
  29. IN BOOL fBootp
  30. )
  31. {
  32. DWORD Error;
  33. DWORD OldState;
  34. PM_RANGE Range;
  35. PM_EXCL Excl;
  36. PM_RESERVATION Reservation;
  37. AssertRet(Subnet, ERROR_INVALID_PARAMETER);
  38. if( Subnet->fSubnet && Subnet->Address != (Address & Subnet->Mask ) )
  39. return MemServerReleaseAddress(
  40. Subnet->ServerPtr,
  41. Address,
  42. fBootp
  43. );
  44. Error = MemSubnetGetAddressInfo(
  45. Subnet,
  46. Address,
  47. &Range,
  48. NULL,
  49. &Reservation
  50. );
  51. if( ERROR_SUCCESS != Error ) return Error;
  52. Require(Range);
  53. if( NULL != Reservation ) {
  54. Require(FALSE);
  55. return ERROR_INVALID_PARAMETER;
  56. }
  57. if( 0 == (Range->State & (fBootp? MM_FLAG_ALLOW_BOOTP: MM_FLAG_ALLOW_DHCP))) {
  58. return ERROR_INVALID_PARAMETER;
  59. }
  60. Error = MemBitSetOrClear(
  61. Range->BitMask,
  62. Address - Range->Start,
  63. FALSE /* Release */,
  64. &OldState
  65. );
  66. if( ERROR_SUCCESS != Error ) return Error;
  67. if( OldState == FALSE ) return ERROR_FILE_NOT_FOUND;
  68. InterlockedIncrement(&Range->DirtyOps);
  69. if( fBootp && 0 != Range->BootpAllocated ) {
  70. InterlockedDecrement( &Range->BootpAllocated );
  71. }
  72. return ERROR_SUCCESS;
  73. }
  74. BOOL // TRUE ==> allowed, FALSE ==> not allowed
  75. MemSubnetCheckBootpDhcp(
  76. IN PM_SUBNET Subnet,
  77. IN BOOL fBootp,
  78. IN BOOL fCheckSuperScope
  79. ) ;
  80. //========================================================================
  81. // end of file
  82. //========================================================================