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.

118 lines
3.6 KiB

  1. /* Copyright (C) Microsoft Corporation, 1991 - 1999 , all rights reserved
  2. ipaddr.h - TCP/IP Address custom control, global definitions
  3. November 10, 1992 - Greg Strange
  4. December 13, 1993 - Ronald Meijer - Added wildcard & readonly styles
  5. April 28, 1994 - Ronald Meijer - Added IP_SETFIELD
  6. */
  7. #if !defined(_IPADDR_H_)
  8. #define _IPADDR_H_
  9. #if _MSC_VER >= 1000 // VC 5.0 or later
  10. #pragma once
  11. #endif
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #ifndef _WINSOCKAPI_
  16. #include "winsock.h"
  17. #endif
  18. // Messages sent to IPAddress controls
  19. #define IP_CLEARADDRESS WM_USER+100 // No parameters
  20. #define IP_SETADDRESS WM_USER+101 // lparam = TCP/IP address
  21. #define IP_GETADDRESS WM_USER+102 // lresult = TCP/IP address
  22. #define IP_SETRANGE WM_USER+103 // wparam = field, lparam = range
  23. #define IP_SETFOCUS WM_USER+104 // wparam = field
  24. #define IP_SETMODIFY WM_USER+105 // wparam = TRUE/FALSE
  25. #define IP_GETMODIFY WM_USER+106 // return TRUE/FALSE
  26. #define IP_GETMASK WM_USER+107 // Return bitfield indicating which fields are masks
  27. #define IP_SETMASK WM_USER+108 // Set the mask bitfield and address
  28. #define IP_SETFIELD WM_USER+109 // wparam = field, lparam = value or -1
  29. #define IP_SETREADONLY WM_USER+110 // if wparam = 1, set read-only flag, re-set it otherwise
  30. #define IP_ISBLANK WM_USER+111 // no parameters
  31. //
  32. // IP Styles:
  33. //
  34. #define IPS_ALLOWWILDCARDS 0x00000001L // Allow the use of wildcard characters.
  35. #define IPS_READONLY 0x00000800L // Do not allow editing. Same as ES_READONLY
  36. // Extended style bit causes the ip address control to
  37. // correct the ip address so that it is contiguous (for submasks)
  38. #define IPADDR_EX_STYLE_CONTIGUOUS 0x1
  39. // The following is a useful macro for passing the range values in the
  40. // IP_SETRANGE message.
  41. #define MAKERANGE(low, high) ((LPARAM)(WORD)(((BYTE)(high) << 8) + (BYTE)(low)))
  42. // And this is a useful macro for making the IP Address to be passed
  43. // as a LPARAM.
  44. // #define MAKEIPADDRESS(b1,b2,b3,b4) ((DWORD)(((DWORD)(b1)<<24)+((DWORD)(b2)<<16)+((DWORD)(b3)<<8)+((DWORD)(b4))))
  45. // Get individual number
  46. #define FIRST_IPADDRESS(x) ((x>>24) & 0xff)
  47. #define SECOND_IPADDRESS(x) ((x>>16) & 0xff)
  48. #define THIRD_IPADDRESS(x) ((x>>8) & 0xff)
  49. #define FOURTH_IPADDRESS(x) (x & 0xff)
  50. // If you statically link ipaddr.obj, then call this function during
  51. // initialization. If you use the DLL, then it is called automatically
  52. // when you load the DLL.
  53. #define DLL_BASED
  54. DLL_BASED int FAR WINAPI IPAddrInit(HINSTANCE hInstance);
  55. // Some utility functions (used for unicode mainly)
  56. #ifndef UNICODE
  57. #define INET_NTOA(a) inet_ntoa(*(struct in_addr *)&(a))
  58. #define INET_ADDR inet_addr
  59. #else
  60. #define INET_NTOA(a) inet_ntoaw(*(struct in_addr *)&(a))
  61. #define INET_ADDR inet_addrw
  62. #endif
  63. //----------------------------------------------------------------------------
  64. // Functions: inet_ntoaw
  65. // inet_addrw
  66. //
  67. // Unicode versions of IP-address conversion functions.
  68. //----------------------------------------------------------------------------
  69. __declspec(dllexport) WCHAR* WINAPI
  70. inet_ntoaw(
  71. struct in_addr dwAddress );
  72. __declspec(dllexport) DWORD WINAPI
  73. inet_addrw(
  74. LPCWSTR szAddress );
  75. // Use this function to force the ip address entered to
  76. // be contiguous (series of 1's followed by a series of 0's).
  77. // This is useful for entering valid submasks
  78. //
  79. // Returns NO_ERROR if successful, error code otherwise
  80. //
  81. __declspec(dllexport) DWORD APIENTRY
  82. IpAddr_ForceContiguous(
  83. HWND hwndIpAddr );
  84. #ifdef __cplusplus
  85. };
  86. #endif
  87. #endif