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.

432 lines
14 KiB

  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // INTEL Corporation Proprietary Information
  4. // Copyright (c) 1995 Intel Corporation
  5. //
  6. // This software is supplied under the terms of a license agreement with INTEL
  7. // Corporation and may not be used, copied, nor disclosed except in accordance
  8. // with the terms of that agreement.
  9. //
  10. ////////////////////////////////////////////////////////////////////////////////
  11. ////////////////////////////////////////////////////////////////////////////////
  12. //
  13. // $Workfile: arscli.h $
  14. // $Revision: 1.6 $
  15. // $Modtime: 19 Sep 1996 19:20:44 $
  16. //
  17. // DESCRIPTION:
  18. //
  19. // This header file defines the Address Resolution Service's client
  20. // side interface. This interface is meant to be used by applications
  21. // who have a need to map to dynamically assigned address information
  22. // for a given user (i.e. if the user is connected to the internet via
  23. // a ISP who uses DHCP to hand out IP addresses.
  24. //
  25. // The following exported functions are declared in this file:
  26. //
  27. // ARCreateRegistration()
  28. // ARDestroyRegistration()
  29. // ARCreateCallTargetInfo()
  30. // ARQueryCallTargetInfo()
  31. // ARDestroyCallTargetInfo()
  32. // ARGetConfigVal()
  33. // ARSetConfigVal()
  34. // ARReleaseStringResult()
  35. // ARGetHostByAddr()
  36. //
  37. ////////////////////////////////////////////////////////////////////////////////
  38. /****************************************************************************
  39. *
  40. * ARS Client Interface 0.005
  41. *
  42. ***************************************************************************/
  43. #ifndef ARSCLIENT_H
  44. #define ARSCLIENT_H
  45. #ifndef DllImport
  46. #define DllImport __declspec( dllimport )
  47. #endif // DllImport
  48. #ifndef DllExport
  49. #define DllExport __declspec( dllexport )
  50. #endif // DllExport
  51. //
  52. // Error Handling Information
  53. //
  54. #include <winerror.h>
  55. #include "apierror.h"
  56. typedef enum AR_TAGS
  57. {
  58. AR_TAG_BADTAG = 0,
  59. AR_TAG_IPADDR,
  60. AR_TAG_PORTNUM,
  61. AR_TAG_APPGUID,
  62. AR_TAG_USERNAME,
  63. AR_TAG_NAPPS,
  64. AR_TAG_QUERYURL,
  65. AR_TAG_USERID,
  66. AR_NUM_TAGS
  67. } ARTag;
  68. typedef enum AR_CONFIGTAGS
  69. {
  70. AR_CONFIG_BADTAG = 0,
  71. AR_CONFIG_PROXY,
  72. AR_CONFIG_PROXYPORT,
  73. AR_CONFIG_SERVERURL,
  74. AR_NUM_CONFIGTAGS
  75. } ARConfigTag;
  76. //This is the base of the server errors,
  77. //All HTTP return codes are added to this
  78. //base error to create the actual return
  79. //value.
  80. #define ERROR_SERVER_ERROR_BASE (ERROR_LOCAL_BASE_ID + 0x200)
  81. #define AR_OLE_FAIL(x) ((HRESULT)MAKE_HRESULT(SEVERITY_ERROR, \
  82. FACILITY_ARSCLIENT, (x)))
  83. #define AR_OLE_SUCCESS(x) ((HRESULT)MAKE_HRESULT(SEVERITY_SUCCESS, \
  84. FACILITY_ARSCLIENT, (x)))
  85. #define AR_OK AR_OLE_SUCCESS(ERROR_SUCCESS)
  86. #define AR_WINSOCK_STARTUP AR_OLE_FAIL(ERROR_DLL_INIT_FAILED)
  87. #define AR_WINSOCK_VERSION AR_OLE_FAIL(ERROR_OLD_WIN_VERSION)
  88. #define AR_ADDRLEN AR_OLE_FAIL(ERROR_BAD_LENGTH)
  89. #define AR_STRING_INVALID AR_OLE_FAIL(ERROR_INTERNAL_ERROR)
  90. #define AR_SOCKERROR AR_OLE_FAIL(ERROR_WRITE_FAULT)
  91. #define AR_INVALID_RESPONSE AR_OLE_FAIL(ERROR_INVALID_DATA)
  92. #define AR_SERVER_ERROR AR_OLE_FAIL(ERROR_SERVER_ERROR_BASE)
  93. #define AR_PEER_UNREACHABLE AR_OLE_FAIL(ERROR_HOST_UNREACHABLE)
  94. #define AR_OUTOFMEMORY AR_OLE_FAIL(ERROR_OUTOFMEMORY)
  95. #define AR_INVALID_PARAMETER AR_OLE_FAIL(ERROR_INVALID_PARAMETER)
  96. #define AR_NOT_IMPLEMENTED AR_OLE_FAIL(ERROR_INVALID_FUNCTION)
  97. #define AR_BAD_TARGET AR_OLE_FAIL(ERROR_OPEN_FAILED)
  98. #define AR_BADCONTEXT AR_OLE_FAIL(ERROR_INVALID_ADDRESS)
  99. //
  100. // Local data types
  101. //
  102. typedef void* ARRegContext;
  103. typedef void* ARCallTargetInfoContext;
  104. typedef char* ARString;
  105. //
  106. // Function prototypes
  107. //
  108. #ifdef __cplusplus
  109. extern "C" { // Assume C declarations for C++.
  110. #endif // __cplusplus
  111. /*----------------------------------------------------------------------------
  112. * ARCreateRegistration
  113. * DLL entry point
  114. *
  115. * Takes server information and registers with that server, creating
  116. * a context which must be used to unregister.
  117. *
  118. * Returns error code indicating success or failure.
  119. *
  120. * Parameters:
  121. *
  122. * regContext Pointer to a registration
  123. * context to be filled (ARRegContext)
  124. * appGUID GUID of application to register
  125. * appName Displayable name of application to register
  126. * appMIME MIME type for the application
  127. * port The application port to register
  128. * ipAddress IP address to register
  129. * if NULL, will be gathered from registry
  130. * userGUID GUID of user to register
  131. * if NULL, will be gathered from registry
  132. * userName Displayable name of user to register
  133. * if NULL, will be gathered from registry
  134. * flags ULS-compatible flags
  135. * ttl Time to live (time between keep-alives)
  136. *
  137. * Returns:
  138. * AR_OK Success
  139. * AR_INVALID_PARAMETER
  140. * AR_NOT_IMPLEMENTED This call has not been implemented.
  141. * AR_OUTOFMEMORY Could not allocate memory for context
  142. * AR_WINSOCK_STARTUP Error initializing WinSock
  143. * AR_WINSOCK_VERSION Invalid WinSock version
  144. * AR_STRING_INVALID Could not parse URL to find address and port
  145. * AR_PEER_UNREACHABLE Could not open TCP socket to server
  146. * AR_SOCKERROR Could not send request over socket
  147. * AR_INVALID_RESPONSE Server's response was not of the proper form
  148. * AR_SERVER_ERROR Server returned an error code
  149. * AR_ADDRLEN The IP address exceeds the maximum length
  150. *-------------------------------------------------------------------------*/
  151. HRESULT DllExport
  152. ARCreateRegistration( const char *appID, // IN
  153. const char *appName, // IN
  154. const char *appMIME, // IN
  155. const LONG port, // IN
  156. const char *ipAddress, // IN
  157. const char *userID, // IN
  158. const char *userName, // IN
  159. const LONG flags, // IN
  160. const LONG ttl, // IN
  161. ARRegContext *regContext); // OUT
  162. /*---------------------------------------------------------------------------
  163. * ARDestroyRegistration
  164. * DLL entry point
  165. *
  166. * Removes the registration associated with the given context and
  167. * destroys the context.
  168. *
  169. * Returns error code indicating success or failure.
  170. *
  171. * Parameters:
  172. *
  173. * regContext Pointer to the ARRegContext to destroy
  174. *
  175. * Returns:
  176. * AR_OK Success
  177. * AR_INVALID_PARAMETER regContext == NULL
  178. * AR_NOT_IMPLEMENTED This call has not been implemented.
  179. * AR_OUTOFMEMORY Could not allocate memory for context
  180. * AR_WINSOCK_STARTUP Error initializing WinSock
  181. * AR_WINSOCK_VERSION Invalid WinSock version
  182. * AR_STRING_INVALID Could not parse URL to find address and port
  183. * AR_PEER_UNREACHABLE Could not open TCP socket to server
  184. * AR_SOCKERROR Could not send request over socket
  185. * AR_INVALID_RESPONSE Server's response was not of the proper form
  186. * AR_SERVER_ERROR Server returned an error code
  187. * AR_ADDRLEN The IP address exceeds the maximum length
  188. *-------------------------------------------------------------------------*/
  189. HRESULT DllExport ARDestroyRegistration(ARRegContext regContext); // IN
  190. /*-------------------------------------------------------------------------
  191. * ARCreateCallTargetInfo
  192. * DLL entry point
  193. *
  194. * Given a string, creates a context object which can be used to
  195. * query fields within a call target delivered by that string
  196. * NOTE: The intention is that a command line be passed, which
  197. * can then be interpreted freely by the DLL in an application-
  198. * independent manner to indicate the call target.
  199. *
  200. * Returns error code indicating success or failure.
  201. *
  202. * Parameters:
  203. *
  204. * rawTarget String to be used to derive call target information
  205. * ctiContext Pointer to a call target information context
  206. * to be filled
  207. *
  208. * Returns:
  209. * AR_OK Success
  210. * AR_INVALID_PARAMETER (ctiContext || rawTarget) == NULL
  211. * AR_BAD_TARGET We could not create the call target info with
  212. * the raw target passed in.
  213. * AR_NOT_IMPLEMENTED This call has not been implemented.
  214. *-------------------------------------------------------------------------*/
  215. HRESULT DllExport
  216. ARCreateCallTargetInfo(const char* rawTarget, // IN
  217. ARCallTargetInfoContext* ctiContext); // OUT
  218. /*---------------------------------------------------------------------------
  219. * ARQueryCallTargetInfo
  220. * DLL entry point
  221. *
  222. * Given a call target information context, will return the value of a
  223. * given tag. Tag names are case insensitive.
  224. *
  225. * Returns error code indicating success or failure.
  226. *
  227. * Parameters:
  228. *
  229. * ctiContext A call target information context to query
  230. * tagField A tag to get the value for.
  231. *
  232. * Valid tags:
  233. *
  234. * AR_TAG_BADTAG = 0 (Place keep for illegal tag value)
  235. * AR_TAG_IPADDR
  236. * AR_TAG_PORTNUM
  237. * AR_TAG_APPGUID
  238. * AR_TAG_USERNAME
  239. * AR_TAG_NAPPS
  240. * AR_TAG_QUERYURL
  241. *
  242. * value Pointer to location to store value.
  243. * Stored as a null-terminated string.
  244. *
  245. * Returns:
  246. * AR_OK Success
  247. * AR_INVALID_PARAMETER (ctiContext || value) == NULL
  248. * tagField == AR_TAG_BADTAG
  249. * AR_INVALID_RESPONSE The call target information is invalid
  250. * for the specified tag.
  251. * AR_NOT_IMPLEMENTED This call has not been implemented.
  252. *-------------------------------------------------------------------------*/
  253. HRESULT DllExport
  254. ARQueryCallTargetInfo(ARCallTargetInfoContext ctiContext, // IN
  255. ARTag tagField, // IN
  256. ARString* value); // OUT
  257. /*---------------------------------------------------------------------------
  258. * ARDestroyCallTargetInfo
  259. * DLL entry point
  260. *
  261. * Destroys a call target information context
  262. *
  263. * Returns error code indicating success or failure.
  264. *
  265. * Parameters:
  266. *
  267. * ctiContext The call target information context to destroy
  268. *
  269. * Returns:
  270. * AR_OK Success
  271. * AR_INVALID_PARAMETER ctiContext == NULL
  272. * AR_NOT_IMPLEMENTED This call has not been implemented.
  273. *-------------------------------------------------------------------------*/
  274. HRESULT DllExport
  275. ARDestroyCallTargetInfo(ARCallTargetInfoContext ctiContext); // IN
  276. /*---------------------------------------------------------------------------
  277. * ARGetConfigVal
  278. * DLL entry point
  279. *
  280. * Obtain specified ARS configuration value
  281. *
  282. * Returns error code indicating success or failure.
  283. *
  284. * Parameters:
  285. *
  286. * tagField A tag to get the value for.
  287. *
  288. * Valid tags:
  289. *
  290. * AR_CONFIG_BADTAG = 0 (Place keep for illegal tag value)
  291. * AR_CONFIG_PROXY
  292. * AR_CONFIG_PROXYPORT
  293. * AR_CONFIG_SERVERURL
  294. *
  295. * value Pointer to location to store pointer to value.
  296. * Stored as a null-terminated string;
  297. * allocated by DLL
  298. *
  299. * Returns:
  300. * AR_OK Success
  301. * AR_INVALID_PARAMETER tagField == AR_TAG_BADTAG
  302. * AR_BAD_TARGET Could not open registry for reading
  303. * AR_NOT_IMPLEMENTED This call has not been implemented.
  304. *-------------------------------------------------------------------------*/
  305. HRESULT DllExport
  306. ARGetConfigVal( ARConfigTag tagField, // IN
  307. ARString* value); // OUT
  308. /*---------------------------------------------------------------------------
  309. * ARSetConfigVal
  310. * DLL entry point
  311. *
  312. * Set specified ARS configuration value
  313. *
  314. * Returns error code indicating success or failure.
  315. *
  316. * Parameters:
  317. *
  318. * tagField A tag to get the value for.
  319. * Valid tags are those valid for ARGetConfigVal
  320. * value Pointer to location to store pointer to value.
  321. * Stored as a null-terminated string;
  322. * allocated by DLL
  323. *
  324. * Returns:
  325. * AR_OK Success
  326. * AR_INVALID_PARAMETER tagField == AR_TAG_BADTAG
  327. * AR_BAD_TARGET Could not open registry for writing
  328. * AR_NOT_IMPLEMENTED This call has not been implemented.
  329. *-------------------------------------------------------------------------*/
  330. HRESULT DllExport
  331. ARSetConfigVal( ARConfigTag tagField, // IN
  332. const char *value); // IN
  333. /*---------------------------------------------------------------------------
  334. * ARReleaseStringResult
  335. * DLL entry point
  336. *
  337. * Destroys a string allocated by ARGetConfigVal or ARQueryCallTargetInfo
  338. *
  339. * Returns error code indicating success or failure.
  340. *
  341. * Parameters:
  342. *
  343. * value The string to destroy
  344. *
  345. * Returns:
  346. * AR_OK Success
  347. * AR_INVALID_PARAMETER value == NULL
  348. *-------------------------------------------------------------------------*/
  349. HRESULT DllExport ARReleaseStringResult(ARString value); // IN
  350. /*---------------------------------------------------------------------------
  351. * ARGetHostByAddr
  352. * DLL entry point
  353. *
  354. * Converts IP addr in dot notation to a host name.
  355. *
  356. * Returns error code indicating success or failure.
  357. *
  358. * Parameters:
  359. *
  360. * lpszAddr ptr to string containing IP addr in dot notation
  361. * pphostName address of ptr to store the host name
  362. *
  363. * Returns:
  364. * AR_OK Success
  365. * AR_INVALID_PARAMETER value == NULL
  366. *-------------------------------------------------------------------------*/
  367. HRESULT DllExport ARGetHostByAddr(const char* lpszAddr, // IN
  368. char** pphostName); // OUT
  369. #ifdef __cplusplus
  370. } // End of extern "C" {
  371. #endif // __cplusplus
  372. /****************************************************************************
  373. *
  374. * $Log: S:\sturgeon\src\include\vcs\arscli.h_v $
  375. *
  376. * Rev 1.6 23 Sep 1996 08:45:14 ENBUSHX
  377. * No change.
  378. *
  379. * Rev 1.5 19 Sep 1996 19:29:52 ENBUSHX
  380. * Fubction to translate from IP DOT to domain name.
  381. *
  382. * Rev 1.4 19 Sep 1996 18:58:34 ENBUSHX
  383. * Added a define for user id field in iii file.
  384. *
  385. * Rev 1.3 11 Jul 1996 18:42:12 rodellx
  386. *
  387. * Fixed bug where HRESULT ids were in violation of Facility and/or Code
  388. * value rules.
  389. *
  390. * Rev 1.2 10 Jul 1996 18:40:52 rodellx
  391. *
  392. * Moved definition of arscli facility to apierror.h.
  393. *
  394. * Rev 1.1 08 Jul 1996 14:50:48 GEHOFFMA
  395. * Don't think any changes were made... just to be sure
  396. *
  397. ***************************************************************************/
  398. #endif // ARSCLIENT_H