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.

58 lines
978 B

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. network.c
  5. Abstract:
  6. This module contains network specific utility routines used by the
  7. DHCP components.
  8. Author:
  9. Manny Weiser (mannyw) 12-Aug-1992
  10. Revision History:
  11. --*/
  12. #include "dhcpl.h"
  13. DHCP_IP_ADDRESS
  14. DhcpDefaultSubnetMask(
  15. DHCP_IP_ADDRESS IpAddress
  16. )
  17. /*++
  18. Routine Description:
  19. This function calculates the default subnet mask for a given IP
  20. address.
  21. Arguments:
  22. IpAddress - The address for which a subnet mask is needed.
  23. Return Value:
  24. The default subnet mask.
  25. -1, if the supplied IP address is invalid.
  26. --*/
  27. {
  28. if ( IN_CLASSA( IpAddress ) ) {
  29. return( IN_CLASSA_NET );
  30. } else if ( IN_CLASSB( IpAddress ) ) {
  31. return( IN_CLASSB_NET );
  32. } else if ( IN_CLASSC( IpAddress ) ) {
  33. return( IN_CLASSC_NET );
  34. } else {
  35. return( (DHCP_IP_ADDRESS)-1 );
  36. }
  37. }