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.

50 lines
1.3 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. net\ip\rtrmgr\defs.c
  5. Abstract:
  6. IP Router Manager defines
  7. Revision History:
  8. Gurdeep Singh Pall 6/16/95 Created
  9. --*/
  10. #ifndef __IPUTILS_H__
  11. #define __IPUTILS_H__
  12. //
  13. // LONG
  14. // Cmp(DWORD dwFirst, DWORD dwSecond, LONG lResult)
  15. //
  16. #define Cmp(dwFirst,dwSecond,lResult) ((LONG)((lResult) = ((dwFirst) - (dwSecond))))
  17. //
  18. // LONG
  19. // PortCmp(WORD wPort1, WORD wPort2, LONG lResult)
  20. //
  21. #define PortCmp(dwPort1, dwPort2,lResult) ((LONG)((lResult) = ((ntohs((WORD)dwPort1)) - (ntohs((WORD)dwPort2)))))
  22. // The addresses are in Network order
  23. //
  24. // LONG
  25. // InetCmp(DWORD IpAddr1, DWORD IpAddr2, LONG lResult)
  26. //
  27. #define InetCmp(dwIpAddr1,dwIpAddr2,res) \
  28. ((LONG)(((res) = (((dwIpAddr1) & 0x000000ff) - ((dwIpAddr2) & 0x000000ff))) ? (res) : \
  29. (((res) = (((dwIpAddr1) & 0x0000ff00) - ((dwIpAddr2) & 0x0000ff00))) ? (res) : \
  30. (((res) = (((dwIpAddr1) & 0x00ff0000) - ((dwIpAddr2) & 0x00ff0000))) ? (res) : \
  31. ((res) = ((((dwIpAddr1) & 0xff000000)>>8) - (((dwIpAddr2) & 0xff000000)>>8)))))))
  32. #endif // __IPUTILS_H__