home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Telephone Manager / Stiletto Sources / ModuleSources / ListCAs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-03  |  2.9 KB  |  99 lines  |  [TEXT/MPS ]

  1. /************************************************************************************************/
  2. /*                                                                                                */
  3. /*    Module Name:    ListCAs                                                                        */
  4. /*                                                                                                */
  5. /*    File Name:        ListCAs.c                                                                    */
  6. /*                                                                                                */
  7. /*    © Apple Computer, Inc. 1991-1995                                                            */
  8. /*    All Rights Reserved                                                                            */
  9. /*                                                                                                */
  10. /*    Revision History:                                                                            */
  11. /*                                                                                                */
  12. /*        Date        Who                    Modification                                            */
  13. /*                                                                                                */
  14. /*        1991-07-16    Chris Halim            Original version                                        */
  15. /*        1995-06-26    Jaakko Railo        Version 2.0                                                */
  16. /*                                                                                                */
  17. /************************************************************************************************/
  18.  
  19. /****************************************** DESCRIPTION ******************************************
  20.  
  21.     This module calls TELCALookup to retrieve CAs allocated on the primary DN
  22.     and list the current state of the CA.
  23.  
  24. *************************************************************************************************/
  25.  
  26. /******************************************** HEADERS *******************************************/
  27.  
  28. #include "TestModule.h"
  29.  
  30. /****************************************** DEFINITIONS *****************************************/
  31.  
  32. /****************************************** PROTOTYPES ******************************************/
  33.  
  34. short        GetCAState (TELCAHandle caHand);
  35. void         DoTest (CHRSPtr paramPtr);
  36.  
  37. /************************************************************************************************/
  38. /************************************************************************************************/
  39.  
  40.  
  41. pascal short TestModule (CHRSPtr paramPtr)
  42. {
  43.     short    returnValue = noErr;
  44.     
  45.     if (paramPtr->version <= kTestModuleVersion) {
  46.         
  47.         DoTest (paramPtr);
  48.         
  49.     }
  50.     else
  51.         returnValue = kWrongVersion;
  52.         
  53.     return (returnValue);
  54. }
  55.  
  56.  
  57. short    GetCAState (TELCAHandle caHand)
  58. {
  59.     OSErr    errCode;
  60.     short    state;
  61.     
  62.     if ((errCode = TELGetCAState (caHand, &state)) != noErr)
  63.         state = errCode;
  64.     
  65.     return (state);
  66. }
  67.  
  68.  
  69. void DoTest (CHRSPtr paramPtr)
  70. {
  71.     TELHandle    termHand = GetCurrentTELHandle (paramPtr);
  72.     TELDNHandle    dnHand;
  73.     TELCAHandle    caHand;
  74.     OSErr        errCode;
  75.     short        numOfCAs, index;
  76.         
  77.     if ((dnHand = GetDNHandle (paramPtr)) != nil) {
  78.         numOfCAs = TELCountCAs (dnHand, telAllCallOrigins);
  79.         Print (paramPtr, "Number of CAs found = %d", numOfCAs);
  80.         
  81.         for (index = 1; index <= numOfCAs; ++index) {
  82.             if ((errCode = TELCALookup (dnHand, telAllCallOrigins, index, &caHand)) == noErr) {
  83.                 
  84.                 Print (paramPtr, "CA #%d = %08x, state = %d", index,
  85.                                 caHand, GetCAState (caHand));
  86.                                 
  87.                 if ((errCode = TELCADispose (caHand)) != noErr)
  88.                     Print (paramPtr, "### TELCADispose fails : %d", errCode);
  89.             }
  90.             else
  91.                 Print (paramPtr, "### TELCALookup fails : %d", errCode);
  92.         }
  93.     }
  94.     else
  95.         Print (paramPtr, "### Unable to retrieve the DN handle");
  96. }
  97.  
  98.  
  99.