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.

371 lines
10 KiB

  1. /*
  2. * capid.h
  3. *
  4. * Copyright (c) 1995 by DataBeam Corporation, Lexington, KY
  5. *
  6. * Abstract:
  7. * This is the interface file for the class CCapIDContainer. A
  8. * CCapIDContainer object is used to maintain information about
  9. * a particular capability of an application. A capability identifier can
  10. * be either a standard type or a non-standard type. When the type is
  11. * standard, the identifier is stored internally as an integer value. When
  12. * the type is non-standard, an CObjectKeyContainer container object is used
  13. * internally to buffer the necessary data. In this case the identifier
  14. * data may exist as an Object ID which is a series of non-negative
  15. * integers or an H221 non-standard ID which is an octet string of no fewer
  16. * than four octets and no more than 255 octets.
  17. *
  18. * Caveats:
  19. * None.
  20. *
  21. * Author:
  22. * jbo
  23. */
  24. #ifndef _CAPABILITY_IDENTIFIER_DATA_
  25. #define _CAPABILITY_IDENTIFIER_DATA_
  26. #include "objkey.h"
  27. /*
  28. * This is the typedef for the structure used to hold the capability identifier
  29. * data internally.
  30. */
  31. typedef struct
  32. {
  33. GCCCapabilityIDType capability_id_type;
  34. union
  35. {
  36. USHORT standard_capability;
  37. CObjectKeyContainer *non_standard_capability;
  38. } u;
  39. }
  40. CAP_ID_STRUCT;
  41. /*
  42. * Class definition:
  43. */
  44. class CCapIDContainer : public CRefCount
  45. {
  46. public:
  47. CCapIDContainer(PGCCCapabilityID, PGCCError);
  48. CCapIDContainer(PCapabilityID, PGCCError);
  49. CCapIDContainer(CCapIDContainer *, PGCCError);
  50. ~CCapIDContainer(void);
  51. UINT LockCapabilityIdentifierData(void);
  52. void UnLockCapabilityIdentifierData(void);
  53. UINT GetGCCCapabilityIDData(PGCCCapabilityID, LPBYTE memory);
  54. GCCError GetCapabilityIdentifierDataPDU(PCapabilityID);
  55. void FreeCapabilityIdentifierDataPDU(void);
  56. friend BOOL operator== (const CCapIDContainer&, const CCapIDContainer&);
  57. protected:
  58. CAP_ID_STRUCT m_InternalCapID;
  59. UINT m_cbDataSize;
  60. CapabilityID m_CapIDPDU;
  61. BOOL m_fValidCapIDPDU;
  62. };
  63. /*
  64. * Comments explaining the public and protected class member functions
  65. */
  66. /*
  67. * CCapIDContainer ( PGCCCapabilityID capability_id,
  68. * PGCCError return_value);
  69. *
  70. * Public member function of CCapIDContainer.
  71. *
  72. * Function Description:
  73. * This is the constructor for the CCapIDContainer class which
  74. * takes as input the "API" version of capability ID data, GCCCapabilityID.
  75. *
  76. * Formal Parameters:
  77. * capability_id (i) The capability ID data to store.
  78. * return_value (o) The output parameter used to indicate errors.
  79. *
  80. * Return Value:
  81. * GCC_NO_ERROR - No error.
  82. * GCC_ALLOCATION_FAILURE - Error creating an object using the
  83. * "new" operator.
  84. * GCC_BAD_CAPABILITY_ID - An invalid capability ID passed in.
  85. *
  86. * Side Effects:
  87. * None.
  88. *
  89. * Caveats:
  90. * None.
  91. */
  92. /*
  93. * CCapIDContainer ( PCapabilityID capability_id,
  94. * PGCCError return_value);
  95. *
  96. * Public member function of CCapIDContainer.
  97. *
  98. * Function Description:
  99. * This is the constructor for the CCapIDContainer class which
  100. * takes as input the "PDU" version of capability ID data, CapabilityID.
  101. *
  102. * Formal Parameters:
  103. * capability_id (i) The capability ID data to store.
  104. * return_value (o) The output parameter used to indicate errors.
  105. *
  106. * Return Value:
  107. * GCC_NO_ERROR - No error.
  108. * GCC_ALLOCATION_FAILURE - Error creating an object using the
  109. * "new" operator.
  110. * GCC_BAD_CAPABILITY_ID - An invalid capability ID passed in.
  111. *
  112. * Side Effects:
  113. * None.
  114. *
  115. * Caveats:
  116. * None.
  117. */
  118. /*
  119. * CCapIDContainer(CCapIDContainer *capability_id,
  120. * PGCCError return_value);
  121. *
  122. * Public member function of CCapIDContainer.
  123. *
  124. * Function Description:
  125. * This is the copy constructor for the CCapIDContainer class
  126. * which takes as input another CCapIDContainer object.
  127. *
  128. * Formal Parameters:
  129. * capability_id (i) The CCapIDContainer object to copy.
  130. * return_value (o) The output parameter used to indicate errors.
  131. *
  132. * Return Value:
  133. * GCC_NO_ERROR - No error.
  134. * GCC_ALLOCATION_FAILURE - Error creating an object using the
  135. * "new" operator.
  136. * GCC_BAD_CAPABILITY_ID - An invalid CCapIDContainer
  137. * passed in.
  138. *
  139. * Side Effects:
  140. * None.
  141. *
  142. * Caveats:
  143. * None.
  144. */
  145. /*
  146. * ~CapabilityIdentifierData();
  147. *
  148. * Public member function of CCapIDContainer.
  149. *
  150. * Function Description:
  151. * This is the destructor for the CCapIDContainer class. It is
  152. * used to clean up any memory allocated during the life of this object.
  153. *
  154. * Formal Parameters:
  155. * None.
  156. *
  157. * Return Value:
  158. * None.
  159. *
  160. * Side Effects:
  161. * None.
  162. *
  163. * Caveats:
  164. * None.
  165. */
  166. /*
  167. * UINT LockCapabilityIdentifierData ();
  168. *
  169. * Public member function of CCapIDContainer.
  170. *
  171. * Function Description:
  172. * This routine is used to "lock" the "API" data for this object. This
  173. * results in the lock count for this object being incremented. When the
  174. * lock count transitions from 0 to 1, a calculation is made to determine
  175. * how much memory will be needed to hold any "API" data which will
  176. * be referenced by, but not held in, the GCCCapabilityID structure
  177. * which is filled in on a call to GetGCCCapabilityIDData. This is the
  178. * value returned by this routine in order to allow the calling object to
  179. * allocate that amount of memory in preparation for the call to
  180. * GetGCCCapabilityIDData.
  181. *
  182. * Formal Parameters:
  183. * None.
  184. *
  185. * Return Value:
  186. * The amount of memory, if any, which will be needed to hold "API" data
  187. * which is referenced by, but not held in, the GCCCapabilityID structure
  188. * provided as an output parameter to the GetGCCCapabilityIDData call.
  189. *
  190. * Side Effects:
  191. * The internal lock count is incremented.
  192. *
  193. * Caveats:
  194. * The internal lock count is used in conjuction with an internal "free"
  195. * flag as a mechanism for ensuring that this object remains in existance
  196. * until all interested parties are through with it. The object remains
  197. * valid (unless explicity deleted) until the lock count is zero and the
  198. * "free" flag is set through a call to FreeCapabilityIdentifierData. This
  199. * allows other objects to lock this object and be sure that it remains
  200. * valid until they call UnLock which will decrement the internal lock
  201. * count. A typical usage scenerio for this object would be: A
  202. * CCapIDContainer object is constructed and then passed off to
  203. * any interested parties through a function call. On return from the
  204. * function call, the FreeCapabilityIdentifierData call is made which will
  205. * set the internal "free" flag. If no other parties have locked the
  206. * object with a Lock call, then the CCapIDContainer object will
  207. * automatically delete itself when the FreeCapabilityIdentifierData call
  208. * is made. If, however, any number of other parties has locked the
  209. * object, it will remain in existence until each of them has unlocked the
  210. * object through a call to UnLock.
  211. */
  212. /*
  213. * UINT GetGCCCapabilityIdentifierData (
  214. * PGCCCapabilityID capability_id,
  215. * LPSTR memory);
  216. *
  217. * Public member function of CCapIDContainer.
  218. *
  219. * Function Description:
  220. * This routine is used to retrieve the capability ID data from the
  221. * CCapIDContainer object in the "API" form of a GCCCapabilityID.
  222. *
  223. * Formal Parameters:
  224. * capability_id (o) The GCCCapabilityID structure to fill in.
  225. * memory (o) The memory used to hold any data referenced by,
  226. * but not held in, the output structure.
  227. *
  228. * Return Value:
  229. * The amount of data, if any, written into the bulk memory block provided.
  230. *
  231. * Side Effects:
  232. * None.
  233. *
  234. * Caveats:
  235. * None.
  236. */
  237. /*
  238. * void UnLockCapabilityIdentifierData ();
  239. *
  240. * Public member function of CCapIDContainer.
  241. *
  242. * Function Description:
  243. * This routine is used to "unlock" the "API" data for this object. This
  244. * results in the lock count for this object being decremented. When the
  245. * lock count transitions from 1 to 0, a check is made to determine
  246. * whether the object has been freed through a call to
  247. * FreeCapabilityIdentifierData. If so, the object will automatically
  248. * delete itself.
  249. *
  250. * Formal Parameters:
  251. * None.
  252. *
  253. * Return Value:
  254. * None.
  255. *
  256. * Side Effects:
  257. * The internal lock count is decremented.
  258. *
  259. * Caveats:
  260. * It is the responsibility of any party which locks a
  261. * CCapIDContainer object by calling Lock to also unlock the
  262. * object with a call to UnLock. If the party calling UnLock did not
  263. * construct the CCapIDContainer object, it should assume the
  264. * object to be invalid thereafter.
  265. */
  266. /*
  267. * GCCError GetCapabilityIdentifierDataPDU (
  268. * PCapabilityID capability_id);
  269. *
  270. * Public member function of CCapIDContainer.
  271. *
  272. * Function Description:
  273. * This routine is used to retrieve the capability ID data from the
  274. * CCapIDContainer object in the "PDU" form of a CapabilityID.
  275. *
  276. * Formal Parameters:
  277. * capability_id (o) The CapabilityID structure to fill in.
  278. *
  279. * Return Value:
  280. * GCC_NO_ERROR - No error.
  281. * GCC_ALLOCATION_FAILURE - Error creating an object using the
  282. * "new" operator.
  283. * GCC_BAD_OBJECT_KEY - One of the internal pointers has
  284. * been corrupted.
  285. *
  286. * Side Effects:
  287. * None.
  288. *
  289. * Caveats:
  290. * None.
  291. */
  292. /*
  293. * void FreeCapabilityIdentifierDataPDU ();
  294. *
  295. * Public member function of CCapIDContainer.
  296. *
  297. * Function Description:
  298. * This routine is used to "free" the "PDU" data allocated for this object
  299. * which is held internally in a CapabilityID structure.
  300. *
  301. * Formal Parameters:
  302. * None.
  303. *
  304. * Return Value:
  305. * None.
  306. *
  307. * Side Effects:
  308. * The internal "free" flag is set.
  309. *
  310. * Caveats:
  311. * This object should be assumed invalid after a call to
  312. * FreeCapabilityIdentifierDataPDU has been made.
  313. */
  314. /*
  315. * friend BOOL operator== (
  316. * const CCapIDContainer& capability_id_1,
  317. * const CCapIDContainer& capability_id_2);
  318. *
  319. * Public member function of CCapIDContainer.
  320. *
  321. * Function Description:
  322. * This routine is used to compare two CCapIDContainer objects
  323. * to determine whether or not they are equal in value.
  324. *
  325. * Formal Parameters:
  326. * capability_id_1 (i) The first CCapIDContainer object
  327. * to compare.
  328. * capability_id_2 (i) The other CCapIDContainer object
  329. * to compare.
  330. *
  331. * Return Value:
  332. * TRUE - The two objects are equal in value.
  333. * FALSE - The two objects are not equal in value.
  334. *
  335. * Side Effects:
  336. * None.
  337. *
  338. * Caveats:
  339. * None.
  340. */
  341. #endif