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.

769 lines
22 KiB

  1. #include "precomp.h"
  2. DEBUG_FILEZONE(ZONE_T120_UTILITY);
  3. /*
  4. * objkey.cpp
  5. *
  6. * Copyright (c) 1995 by DataBeam Corporation, Lexington, KY
  7. *
  8. * Abstract:
  9. * This is the implementation file for the class CObjectKeyContainer. This class
  10. * manages the data associated with an Object Key. Object Key's are used
  11. * to identify a particular application protocol, whether it is standard or
  12. * non-standard. When used to identify a standard protocol, the Object Key
  13. * takes the form of an Object ID which is a series of non-negative
  14. * integers. This type of Object Key is maintained internally through the
  15. * use of a Memory object. When used to identify a non-standard
  16. * protocol, the Object Key takes the form of an H221 non-standard ID which
  17. * is an octet string of no fewer than four octets and no more than 255
  18. * octets. In this case the Object Key is maintained internally by using a
  19. * Rogue Wave string object.
  20. *
  21. * Protected Instance Variables:
  22. * m_InternalObjectKey
  23. * Structure used to hold the object key data internally.
  24. * m_ObjectKeyPDU
  25. * Storage for the "PDU" form of the object key.
  26. * m_fValidObjectKeyPDU
  27. * Flag indicating that memory has been allocated to hold the internal
  28. * "PDU" object key.
  29. * m_cbDataSize
  30. * Variable holding the size of the memory which will be required to
  31. * hold any data referenced by the "API" GCCObjectKey structure.
  32. *
  33. * Caveats:
  34. * None.
  35. *
  36. * Author:
  37. * jbo
  38. */
  39. #include "objkey.h"
  40. /*
  41. * CObjectKeyContainer()
  42. *
  43. * Public Function Description:
  44. * This constructor is used to create an CObjectKeyContainer object from
  45. * an "API" GCCObjectKey.
  46. */
  47. CObjectKeyContainer::CObjectKeyContainer(PGCCObjectKey object_key,
  48. PGCCError pRetCode)
  49. :
  50. CRefCount(MAKE_STAMP_ID('O','b','j','K')),
  51. m_fValidObjectKeyPDU(FALSE),
  52. m_cbDataSize(0)
  53. {
  54. GCCError rc = GCC_NO_ERROR;
  55. BOOL object_key_is_valid = TRUE;
  56. UINT object_id_size;
  57. m_InternalObjectKey.object_id_key = NULL;
  58. m_InternalObjectKey.poszNonStandardIDKey = NULL;
  59. /*
  60. * Check to see what type of key is contained in the object key.
  61. * Object ID keys will be stored internally in a Memory object and
  62. * non-standard ID keys will be stored internally as Octet Strings.
  63. */
  64. if (object_key->key_type == GCC_OBJECT_KEY)
  65. {
  66. /*
  67. * The key is of type object ID. Perform a parameter check for a legal
  68. * object ID by examining the first two arcs in the object ID.
  69. */
  70. if (object_key->object_id.long_string_length >= MINIMUM_OBJECT_ID_ARCS)
  71. {
  72. object_key_is_valid = ValidateObjectIdValues(
  73. object_key->object_id.long_string[0],
  74. object_key->object_id.long_string[1]);
  75. }
  76. else
  77. {
  78. object_key_is_valid = FALSE;
  79. }
  80. if (object_key_is_valid)
  81. {
  82. /*
  83. * The key is of type Object ID. Determine the amount of memory
  84. * required to hold the Object ID and allocate it. Copy the Object
  85. * ID values from the object key passed in into the internal
  86. * structure.
  87. */
  88. m_InternalObjectKey.object_id_length = object_key->object_id.long_string_length;
  89. object_id_size = m_InternalObjectKey.object_id_length * sizeof(UINT);
  90. DBG_SAVE_FILE_LINE
  91. m_InternalObjectKey.object_id_key = new BYTE[object_id_size];
  92. if (m_InternalObjectKey.object_id_key != NULL)
  93. {
  94. ::CopyMemory(m_InternalObjectKey.object_id_key,
  95. object_key->object_id.long_string,
  96. object_id_size);
  97. }
  98. else
  99. {
  100. ERROR_OUT(("CObjectKeyContainer::CObjectKeyContainer: Error allocating memory"));
  101. rc = GCC_ALLOCATION_FAILURE;
  102. }
  103. }
  104. else
  105. {
  106. ERROR_OUT(("CObjectKeyContainer::CObjectKeyContainer: Object ID has illegal values."));
  107. rc = GCC_BAD_OBJECT_KEY;
  108. }
  109. }
  110. else
  111. {
  112. /*
  113. * The key is non-standard. Check to make sure the length of the
  114. * non-standard ID is within the allowable limits.
  115. */
  116. if ((object_key->h221_non_standard_id.length >=
  117. MINIMUM_NON_STANDARD_ID_LENGTH) &&
  118. (object_key->h221_non_standard_id.length <=
  119. MAXIMUM_NON_STANDARD_ID_LENGTH))
  120. {
  121. /*
  122. * The key is of type H221 non-standard ID. Create a new Rogue
  123. * Wave string container to hold the non-standard data.
  124. */
  125. if (NULL == (m_InternalObjectKey.poszNonStandardIDKey = ::My_strdupO2(
  126. object_key->h221_non_standard_id.value,
  127. object_key->h221_non_standard_id.length)))
  128. {
  129. ERROR_OUT(("CObjectKeyContainer::CObjectKeyContainer: Error creating non standard id key"));
  130. rc = GCC_ALLOCATION_FAILURE;
  131. }
  132. }
  133. else
  134. {
  135. ERROR_OUT(("CObjectKeyContainer::CObjectKeyContainer: Non standard ID is outside legal range"));
  136. rc = GCC_BAD_OBJECT_KEY;
  137. }
  138. }
  139. *pRetCode = rc;
  140. }
  141. /*
  142. * CObjectKeyContainer()
  143. *
  144. * Public Function Description:
  145. * This constructor is used to create an CObjectKeyContainer object from
  146. * a "PDU" Key.
  147. */
  148. CObjectKeyContainer::CObjectKeyContainer(PKey object_key,
  149. PGCCError pRetCode)
  150. :
  151. CRefCount(MAKE_STAMP_ID('O','b','j','K')),
  152. m_fValidObjectKeyPDU(FALSE),
  153. m_cbDataSize(0)
  154. {
  155. GCCError rc = GCC_NO_ERROR;
  156. PSetOfObjectID object_id_set_ptr;
  157. UINT *object_id_ptr;
  158. UINT object_id_size = 0;
  159. Int i = 0;
  160. m_InternalObjectKey.object_id_key = NULL;
  161. m_InternalObjectKey.object_id_length = 0;
  162. m_InternalObjectKey.poszNonStandardIDKey = NULL;
  163. /*
  164. * Check to see what type of key is contained in the object key.
  165. * Object ID keys will be stored internally in a Memory object and
  166. * non-standard ID keys will be stored internally in Rogue Wave string
  167. * containers.
  168. */
  169. if (object_key->choice == OBJECT_CHOSEN)
  170. {
  171. /*
  172. * Retrieve the first object ID pointer from the "PDU" structure in
  173. * preparation for determining how much memory will be needed to hold
  174. * the object ID values.
  175. */
  176. object_id_set_ptr = object_key->u.object;
  177. /*
  178. * Loop through the ObjectID structure, adding up the size of the
  179. * string.
  180. */
  181. while (object_id_set_ptr != NULL)
  182. {
  183. m_InternalObjectKey.object_id_length++;
  184. object_id_set_ptr = object_id_set_ptr->next;
  185. }
  186. object_id_size = m_InternalObjectKey.object_id_length * sizeof(UINT);
  187. /*
  188. * Allocate the memory to be used to hold the object ID values.
  189. */
  190. DBG_SAVE_FILE_LINE
  191. m_InternalObjectKey.object_id_key = new BYTE[object_id_size];
  192. if (m_InternalObjectKey.object_id_key != NULL)
  193. {
  194. object_id_ptr = (UINT *) m_InternalObjectKey.object_id_key;
  195. /*
  196. * Again retrieve the first object ID pointer from the "PDU"
  197. * structure in order to get the values out for saving.
  198. */
  199. object_id_set_ptr = object_key->u.object;
  200. /*
  201. * Loop through the ObjectID structure, getting each object ID
  202. * value and saving it in the allocated memory.
  203. */
  204. while (object_id_set_ptr != NULL)
  205. {
  206. object_id_ptr[i++] = object_id_set_ptr->value;
  207. object_id_set_ptr = object_id_set_ptr->next;
  208. }
  209. }
  210. else
  211. {
  212. ERROR_OUT(("CObjectKeyContainer::CObjectKeyContainer: Error allocating memory."));
  213. rc = GCC_ALLOCATION_FAILURE;
  214. }
  215. }
  216. else
  217. {
  218. /*
  219. * The key is of type H221 non-standard ID so create a new Rogue Wave
  220. * string container to hold the data.
  221. */
  222. if (NULL == (m_InternalObjectKey.poszNonStandardIDKey = ::My_strdupO2(
  223. object_key->u.h221_non_standard.value,
  224. object_key->u.h221_non_standard.length)))
  225. {
  226. ERROR_OUT(("CObjectKeyContainer::CObjectKeyContainer: Error creating non standard id key"));
  227. rc = GCC_ALLOCATION_FAILURE;
  228. }
  229. }
  230. *pRetCode = rc;
  231. }
  232. /*
  233. * CObjectKeyContainer()
  234. *
  235. * Public Function Description:
  236. * This copy constructor is used to create a new CObjectKeyContainer object from
  237. * another CObjectKeyContainer object.
  238. */
  239. CObjectKeyContainer::CObjectKeyContainer(CObjectKeyContainer *object_key,
  240. PGCCError pRetCode)
  241. :
  242. CRefCount(MAKE_STAMP_ID('O','b','j','K')),
  243. m_fValidObjectKeyPDU(FALSE),
  244. m_cbDataSize(0)
  245. {
  246. GCCError rc = GCC_NO_ERROR;
  247. UINT object_id_size;
  248. m_InternalObjectKey.object_id_key = NULL;
  249. m_InternalObjectKey.poszNonStandardIDKey = NULL;
  250. /*
  251. * If an object ID "key" exists for the CObjectKeyContainer to be copied,
  252. * allocate memory to hold the object ID "key" information internally.
  253. * Check to make sure construction of the object is successful.
  254. */
  255. if (object_key->m_InternalObjectKey.object_id_key != NULL)
  256. {
  257. /*
  258. * The key is of type Object ID.
  259. */
  260. m_InternalObjectKey.object_id_length = object_key->m_InternalObjectKey.object_id_length;
  261. object_id_size = m_InternalObjectKey.object_id_length * sizeof(UINT);
  262. DBG_SAVE_FILE_LINE
  263. m_InternalObjectKey.object_id_key = new BYTE[object_id_size];
  264. if (m_InternalObjectKey.object_id_key != NULL)
  265. {
  266. ::CopyMemory(m_InternalObjectKey.object_id_key,
  267. object_key->m_InternalObjectKey.object_id_key,
  268. object_id_size);
  269. }
  270. else
  271. {
  272. ERROR_OUT(("CObjectKeyContainer::CObjectKeyContainer: Error allocating memory"));
  273. rc = GCC_ALLOCATION_FAILURE;
  274. }
  275. }
  276. else if (object_key->m_InternalObjectKey.poszNonStandardIDKey != NULL)
  277. {
  278. /*
  279. * If a non-standard ID "key" exists for the CObjectKeyContainer to be copied,
  280. * create a new Rogue Wave string to hold the non-standard "key"
  281. * information internally. Check to make sure construction of the
  282. * object is successful.
  283. */
  284. if (NULL == (m_InternalObjectKey.poszNonStandardIDKey = ::My_strdupO(
  285. object_key->m_InternalObjectKey.poszNonStandardIDKey)))
  286. {
  287. ERROR_OUT(("CObjectKeyContainer::CObjectKeyContainer: Error creating new non standard id key"));
  288. rc = GCC_ALLOCATION_FAILURE;
  289. }
  290. }
  291. else
  292. {
  293. /*
  294. * At least one of the internal pointers for the passed in object key
  295. * must be valid.
  296. */
  297. ERROR_OUT(("CObjectKeyContainer::CObjectKeyContainer: Bad input parameters"));
  298. rc = GCC_BAD_OBJECT_KEY;
  299. }
  300. *pRetCode = rc;
  301. }
  302. /*
  303. * ~CObjectKeyContainer()
  304. *
  305. * Public Function Description
  306. * The CObjectKeyContainer destructor is responsible for freeing any memory
  307. * allocated to hold the object key data.
  308. *
  309. */
  310. CObjectKeyContainer::~CObjectKeyContainer(void)
  311. {
  312. /*
  313. * If "PDU" data has been allocated for this object, free it now.
  314. */
  315. if (m_fValidObjectKeyPDU)
  316. {
  317. FreeObjectKeyDataPDU();
  318. }
  319. /*
  320. * Delete any object key data held internally.
  321. */
  322. delete m_InternalObjectKey.object_id_key;
  323. delete m_InternalObjectKey.poszNonStandardIDKey;
  324. }
  325. /*
  326. * LockObjectKeyData ()
  327. *
  328. * Public Function Description:
  329. * This routine locks the object key data and determines the amount of
  330. * memory referenced by the "API" object key data structure.
  331. */
  332. UINT CObjectKeyContainer::LockObjectKeyData(void)
  333. {
  334. /*
  335. * If this is the first time this routine is called, determine the size of
  336. * the memory required to hold the data referenced by the object key
  337. * structure. Otherwise, just increment the lock count.
  338. */
  339. if (Lock() == 1)
  340. {
  341. /*
  342. * Determine the amount of space required to hold the data referenced
  343. * by the "API" Object Key structure.
  344. */
  345. if (m_InternalObjectKey.object_id_key != NULL)
  346. {
  347. /*
  348. * Since the object ID is just a series of "longs" without a NULL
  349. * terminator, we do not want to include a NULL terminator when
  350. * determining the length.
  351. */
  352. m_cbDataSize = m_InternalObjectKey.object_id_length * sizeof(UINT);
  353. }
  354. else
  355. {
  356. /*
  357. * The data referenced by the non-standard object key is just the
  358. * length of the octet string.
  359. */
  360. m_cbDataSize = m_InternalObjectKey.poszNonStandardIDKey->length;
  361. }
  362. /*
  363. * Force the size to be on a four-byte boundary.
  364. */
  365. m_cbDataSize = ROUNDTOBOUNDARY(m_cbDataSize);
  366. }
  367. return m_cbDataSize;
  368. }
  369. /*
  370. * GetGCCObjectKeyData ()
  371. *
  372. * Public Function Description:
  373. * This routine retrieves object key data in the form of an "API"
  374. * GCCObjectKey. This routine is called after "locking" the object
  375. * key data.
  376. */
  377. UINT CObjectKeyContainer::GetGCCObjectKeyData(
  378. PGCCObjectKey object_key,
  379. LPBYTE memory)
  380. {
  381. UINT cbDataSizeToRet = 0;
  382. UINT *object_id_ptr;
  383. /*
  384. * If the object key data has been locked, fill in the output structure and
  385. * the data referenced by the structure. Otherwise, report that the object
  386. * key has yet to be locked into the "API" form.
  387. */
  388. if (GetLockCount() > 0)
  389. {
  390. /*
  391. * Fill in the output length parameter which indicates how much data
  392. * referenced outside the structure will be written.
  393. */
  394. cbDataSizeToRet = m_cbDataSize;
  395. if (m_InternalObjectKey.object_id_key != NULL)
  396. {
  397. /*
  398. * The object key is a standard type. Set the object key type
  399. * and the length of the long string. The length set here does
  400. * not include a NULL terminator.
  401. */
  402. object_key->key_type = GCC_OBJECT_KEY;
  403. object_key->object_id.long_string_length = (USHORT) m_InternalObjectKey.object_id_length;
  404. /*
  405. * Set the offset for the long string equal to the memory pointer
  406. * passed in since it will be the first data referenced by the
  407. * object key structure.
  408. */
  409. object_key->object_id.long_string = (ULONG *) memory;
  410. /*
  411. * Now retrieve the memory pointer and copy the long string data
  412. * from the internal memory object.
  413. */
  414. object_id_ptr = (UINT *) m_InternalObjectKey.object_id_key;
  415. ::CopyMemory(memory, object_id_ptr,
  416. m_InternalObjectKey.object_id_length * sizeof (UINT));
  417. }
  418. else if (m_InternalObjectKey.poszNonStandardIDKey != NULL)
  419. {
  420. /*
  421. * The object key is a non-standard type. Set the object key
  422. * type and the length of the octet string.
  423. */
  424. object_key->key_type = GCC_H221_NONSTANDARD_KEY;
  425. object_key->h221_non_standard_id.length =
  426. m_InternalObjectKey.poszNonStandardIDKey->length;
  427. /*
  428. * Set the offset for the octet string equal to the memory pointer
  429. * passed in since it will be the first data referenced by the
  430. * object key structure.
  431. */
  432. object_key->h221_non_standard_id.value = memory;
  433. /*
  434. * Now copy the octet string data from the internal Rogue Wave
  435. * string into the object key structure held in memory.
  436. */
  437. ::CopyMemory(memory, m_InternalObjectKey.poszNonStandardIDKey->value,
  438. m_InternalObjectKey.poszNonStandardIDKey->length);
  439. }
  440. else
  441. {
  442. ERROR_OUT(("CObjectKeyContainer::LockObjectKeyData: Error, no valid internal data"));
  443. }
  444. }
  445. else
  446. {
  447. object_key = NULL;
  448. ERROR_OUT(("CObjectKeyContainer::GetGCCObjectKeyData: Error Data Not Locked"));
  449. }
  450. return cbDataSizeToRet;
  451. }
  452. /*
  453. * UnLockObjectKeyData ()
  454. *
  455. * Public Function Description:
  456. * This routine decrements the lock count and frees the memory associated
  457. * with the "API" object key once the lock count reaches zero.
  458. */
  459. void CObjectKeyContainer::UnLockObjectKeyData(void)
  460. {
  461. Unlock();
  462. }
  463. /*
  464. * GetObjectKeyDataPDU ()
  465. *
  466. * Public Function Description:
  467. * This routine converts the object key from it's internal form of an
  468. * OBJECT_KEY structure into the "PDU" form which can be passed in
  469. * to the ASN.1 encoder. A pointer to a "PDU" "Key" structure is
  470. * returned.
  471. */
  472. GCCError CObjectKeyContainer::GetObjectKeyDataPDU(PKey object_key)
  473. {
  474. PSetOfObjectID new_object_id_ptr;
  475. PSetOfObjectID old_object_id_ptr;
  476. UINT *object_id_string;
  477. GCCError rc = GCC_NO_ERROR;
  478. UINT i;
  479. /*
  480. * Set the loop pointer to NULL to avoid a compiler warning.
  481. */
  482. old_object_id_ptr = NULL;
  483. /*
  484. * If this is the first time that PDU data has been requested then we must
  485. * fill in the internal PDU structure and copy it into the structure pointed
  486. * to by the output parameter. On subsequent calls to "GetPDU" we can just
  487. * copy the internal PDU structure into the structure pointed to by the
  488. * output parameter.
  489. */
  490. if (m_fValidObjectKeyPDU == FALSE)
  491. {
  492. m_fValidObjectKeyPDU = TRUE;
  493. /*
  494. * Fill in the "PDU" object key after checking to see what form of
  495. * key exists in the internal structure.
  496. */
  497. if (m_InternalObjectKey.object_id_key != NULL)
  498. {
  499. /*
  500. * The key is an object ID so set the choice accordingly and
  501. * initialize the PDU object pointer to NULL. Get the pointer to
  502. * the internal list of object key values stored in the memory
  503. * object.
  504. */
  505. m_ObjectKeyPDU.choice = OBJECT_CHOSEN;
  506. m_ObjectKeyPDU.u.object = NULL;
  507. object_id_string = (UINT *) m_InternalObjectKey.object_id_key;
  508. /*
  509. * The "PDU" structure "ObjectID" is a linked list of unsigned
  510. * longs. Retrieve the Object ID values from the internal memory
  511. * object and fill in the "ObjectID" structure.
  512. */
  513. for (i=0; i<m_InternalObjectKey.object_id_length; i++)
  514. {
  515. DBG_SAVE_FILE_LINE
  516. new_object_id_ptr = new SetOfObjectID;
  517. if (new_object_id_ptr != NULL)
  518. {
  519. /*
  520. * The first time through the new pointer is saved in the
  521. * PDU structure. On subsequent iterations, the previous
  522. * "next" pointer is set equal to the new pointer.
  523. */
  524. if (m_ObjectKeyPDU.u.object == NULL)
  525. {
  526. m_ObjectKeyPDU.u.object = new_object_id_ptr;
  527. }
  528. else
  529. {
  530. old_object_id_ptr->next = new_object_id_ptr;
  531. }
  532. old_object_id_ptr = new_object_id_ptr;
  533. /*
  534. * Save the actual Object ID value.
  535. */
  536. new_object_id_ptr->value = object_id_string[i];
  537. new_object_id_ptr->next = NULL;
  538. }
  539. else
  540. {
  541. ERROR_OUT(("CObjectKeyContainer::GetObjectKeyDataPDU: creating new ObjectID"));
  542. rc = GCC_ALLOCATION_FAILURE;
  543. break;
  544. }
  545. }
  546. }
  547. else if (m_InternalObjectKey.poszNonStandardIDKey != NULL)
  548. {
  549. /*
  550. * The key is a non-standard ID so convert the internal Rogue Wave
  551. * string into the "PDU" non-standard ID.
  552. */
  553. m_ObjectKeyPDU.choice = H221_NON_STANDARD_CHOSEN;
  554. m_ObjectKeyPDU.u.h221_non_standard.length =
  555. m_InternalObjectKey.poszNonStandardIDKey->length;
  556. ::CopyMemory(m_ObjectKeyPDU.u.h221_non_standard.value,
  557. m_InternalObjectKey.poszNonStandardIDKey->value,
  558. m_InternalObjectKey.poszNonStandardIDKey->length);
  559. }
  560. else
  561. {
  562. /*
  563. * The constructors make sure that at least one of the internal
  564. * pointers is valid so this should never be encountered.
  565. */
  566. ERROR_OUT(("CObjectKeyContainer::GetObjectKeyDataPDU: No valid m_InternalObjectKey"));
  567. rc = GCC_ALLOCATION_FAILURE;
  568. }
  569. }
  570. /*
  571. * Copy the internal PDU structure into the structure pointed to by the
  572. * output parameter.
  573. */
  574. *object_key = m_ObjectKeyPDU;
  575. return rc;
  576. }
  577. /*
  578. * FreeObjectKeyDataPDU ()
  579. *
  580. * Public Function Description:
  581. * This routine is used to free the object key data held internally in
  582. * the "PDU" form of a "Key".
  583. */
  584. void CObjectKeyContainer::FreeObjectKeyDataPDU(void)
  585. {
  586. PSetOfObjectID set_of_object_id;
  587. PSetOfObjectID next_set_of_object_id;
  588. if (m_fValidObjectKeyPDU)
  589. {
  590. /*
  591. * Set the flag indicating that PDU object key data is no longer
  592. * allocated.
  593. */
  594. m_fValidObjectKeyPDU = FALSE;
  595. if (m_ObjectKeyPDU.choice == OBJECT_CHOSEN)
  596. {
  597. for (set_of_object_id = m_ObjectKeyPDU.u.object;
  598. set_of_object_id != NULL;
  599. set_of_object_id = next_set_of_object_id)
  600. {
  601. next_set_of_object_id = set_of_object_id->next;
  602. delete set_of_object_id;
  603. }
  604. }
  605. }
  606. }
  607. /*
  608. * operator== ()
  609. *
  610. * Public Function Description:
  611. * This routine is used to compare two CObjectKeyContainer objects to determine
  612. * if they are equal in value.
  613. */
  614. BOOL operator==(const CObjectKeyContainer& object_key_1, const CObjectKeyContainer& object_key_2)
  615. {
  616. UINT *object_id_1, *object_id_2;
  617. UINT i;
  618. BOOL rc = FALSE;
  619. /*
  620. * Check to make sure that both the object ID key and the non-standard
  621. * ID key are equal.
  622. */
  623. if ((object_key_1.m_InternalObjectKey.object_id_key != NULL) &&
  624. (object_key_2.m_InternalObjectKey.object_id_key != NULL))
  625. {
  626. if (object_key_1.m_InternalObjectKey.object_id_length ==
  627. object_key_2.m_InternalObjectKey.object_id_length)
  628. {
  629. object_id_1 = (UINT *) object_key_1.m_InternalObjectKey.object_id_key;
  630. object_id_2 = (UINT *) object_key_2.m_InternalObjectKey.object_id_key;
  631. /*
  632. * Compare each Object ID value to make sure they are equal.
  633. */
  634. rc = TRUE;
  635. for (i=0; i<object_key_1.m_InternalObjectKey.object_id_length; i++)
  636. {
  637. if (object_id_1[i] != object_id_2[i])
  638. {
  639. rc = FALSE;
  640. break;
  641. }
  642. }
  643. }
  644. }
  645. else
  646. if (0 == My_strcmpO(object_key_1.m_InternalObjectKey.poszNonStandardIDKey,
  647. object_key_2.m_InternalObjectKey.poszNonStandardIDKey))
  648. {
  649. rc = TRUE;
  650. }
  651. return rc;
  652. }
  653. /*
  654. * BOOL ValidateObjectIdValues ( UINT first_arc,
  655. * UINT second_arc);
  656. *
  657. * Private member function of CObjectKeyContainer.
  658. *
  659. * Function Description:
  660. * This routine is used to determine whether or not the values for the
  661. * object ID component of the object key are valid.
  662. *
  663. * Formal Parameters:
  664. * first_arc (i) The first integer value of the Object ID.
  665. * second_arc (i) The second integer value of the Object ID.
  666. *
  667. * Return Value:
  668. * TRUE - The first two arcs of the Object ID are valid.
  669. * FALSE - The first two arcs of the Object ID are not
  670. * valid.
  671. *
  672. * Side Effects:
  673. * None.
  674. *
  675. * Caveats:
  676. * None.
  677. */
  678. BOOL CObjectKeyContainer::ValidateObjectIdValues(UINT first_arc, UINT second_arc)
  679. {
  680. BOOL rc = FALSE;
  681. if (first_arc == ITUT_IDENTIFIER)
  682. {
  683. if (second_arc <= 4)
  684. {
  685. rc = TRUE;
  686. }
  687. }
  688. else if (first_arc == ISO_IDENTIFIER)
  689. {
  690. if ((second_arc == 0L) ||
  691. (second_arc == 2L) ||
  692. (second_arc == 3L))
  693. {
  694. rc = TRUE;
  695. }
  696. }
  697. else if (first_arc == JOINT_ISO_ITUT_IDENTIFIER)
  698. {
  699. /*
  700. * Referring to ISO/IEC 8824-1 : 1994 (E) Annex B:
  701. * Join assignment of OBJECT IDENTIFIER component values are assigned
  702. * and agreed from time to time by ISO and ITU-T to identify areas of
  703. * joint ISO/ITU-T standardization activity, in accordance with the
  704. * procedures of .... ANSI. So we just let them all through for now.
  705. */
  706. rc = TRUE;
  707. }
  708. else
  709. {
  710. ERROR_OUT(("ObjectKeyData::ValidateObjectIdValues: ObjectID is invalid"));
  711. }
  712. return rc;
  713. }