home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / cnnlst.exe / CONNLIST.C < prev    next >
C/C++ Source or Header  |  1995-06-02  |  6KB  |  168 lines

  1.  
  2. /****************************************************************************
  3. ** DISCLAIMER
  4. **
  5. ** Novell, Inc. makes no representations or warranties with respect to
  6. ** any NetWare software, and specifically disclaims any express or
  7. ** implied warranties of merchantability, title, or fitness for a
  8. ** particular purpose.
  9. **
  10. ** Distribution of any NetWare software is forbidden without the
  11. ** express written consent of Novell, Inc.  Further, Novell reserves
  12. ** the right to discontinue distribution of any NetWare software.
  13. **
  14. ** Novell is not responsible for lost profits or revenue, loss of use
  15. ** of the software, loss of data, costs of re-creating lost data, the
  16. ** cost of any substitute equipment or program, or claims by any party
  17. ** other than you.  Novell strongly recommends a backup be made before
  18. ** any software is installed.   Technical support for this software
  19. ** may be provided at the discretion of Novell.
  20. ****************************************************************************
  21. **
  22. ** File:   CONNLIST.C
  23. **
  24. ** Desc:   Gets the connection list from the workstation.
  25. **         
  26. **         
  27. ** Programmers:
  28. ** Ini   Who                Firm
  29. ** ------------------------------------------------------------------
  30. ** ARM   A. Ray Maxwell     Novell Developer Support.
  31. **
  32. ** History:
  33. **
  34. ** ------------------------------------------------------------------
  35. ** 02-16-95   ARM   First code.    
  36. */
  37.  
  38. /****************************************************************************
  39. **   Include headers, macros, function prototypes, etc.
  40. */
  41.    
  42.  
  43.    /*------------------------------------------------------------------
  44.    **   ANSI
  45.     */
  46.     #include <conio.h>       /* clrscr(), getch() */
  47.     #include <stdio.h>       /* printf()          */
  48.     #include <stdlib.h>      /* exit()            */
  49.     #include <string.h>      /* strcpy() strupr() */
  50.    #include <mem.h>             /* setmem()             */
  51.    /*------------------------------------------------------------------
  52.    **   NetWare
  53.    */
  54.     #include <nwcalls.h>
  55.    
  56.    
  57.    /*------------------------------------------------------------------
  58.    **   Defines
  59.    */
  60.    #define NWDOS
  61.    
  62.    
  63.     /*------------------------------------------------------------------
  64.    **   Prototypes
  65.    */
  66.  
  67. /****************************************************************************
  68. **   Program Start
  69. */
  70. void main(void)
  71. {
  72.     NWCONN_HANDLE connHandle,connList[48];
  73.     NWSTRUCT_SIZE connListSize, connSize;
  74.     NWNUMBER      numberOfConnections;
  75.     CONNECT_INFO  connInfo;
  76.     NWCCODE       ccode;
  77.     NWOBJ_ID      objectID;
  78.     char          temp[16];
  79.     WORD              i;
  80.  
  81.     connListSize=sizeof(connList);
  82.     connSize=sizeof(connInfo);
  83.  
  84.     ccode = NWCallsInit( NULL, NULL );
  85.     if (ccode){
  86.         printf( "\nNWCallsInit: failed %04x", ccode );
  87.         exit(1);
  88.         }
  89.     setmem(connList,sizeof(connList),'\0');
  90.     ccode=NWGetConnectionList(
  91.             /* > mode Novell Reserved  */ 0,
  92.             /* > conn list buffer      */ connList,
  93.             /* < conn list size        */ connListSize,
  94.             /* < number of connections */ &numberOfConnections);
  95.     if (ccode){
  96.         printf("NWGetConnectionList failed %X\n",ccode);
  97.         exit(1);
  98.     }
  99.     else{
  100.         for(i=0;i<numberOfConnections;i++){
  101.             connHandle=connList[i];
  102.             ccode=NWGetConnectionStatus(
  103.                     /* > conn Handle     */ connHandle,
  104.                     /* < conn Info       */ &connInfo,
  105.                     /* > conn Info size  */ connSize);
  106.             if(ccode){
  107.                 printf("NWGetConnectionStatus failed %X\n",ccode);
  108.                 exit(1);
  109.             }
  110.             clrscr();
  111.             printf("The connHandle is %d for server: %s\n",connHandle,
  112.                     connInfo.serverName)
  113.                     ;
  114.             if(connInfo.connectFlags&CONNECTION_AVAILABLE)
  115.                 printf("Conn Handle hasn't been allocated to a process on work station\n");
  116.             if(connInfo.connectFlags&CONNECTION_PRIVATE)
  117.                 printf("No description available for this flag\n");
  118.             if(connInfo.connectFlags&CONNECTION_LOGGED_IN)
  119.                 printf("Client logged in on this connection\n");
  120.             if(connInfo.connectFlags&CONNECTION_BROADCAST_AVAILABLE)
  121.                 printf("Broadcast to other stations available from this workstation\n");
  122.             if(connInfo.connectFlags&CONNECTION_ABORTED)
  123.                 printf("The session was aborted\n");
  124.             if(connInfo.connectFlags&CONNECTION_REFUSE_GEN_BROADCAST)
  125.                 printf("No general broadcast to be received on this connection\n");
  126.             if(connInfo.connectFlags&CONNECTION_BROADCASTS_DISABLED)
  127.                 printf("All broadcasts are disabled\n");
  128.             if(connInfo.connectFlags&CONNECTION_PRIMARY)
  129.                 printf("Workstations Primary Connection\n");
  130.             if(connInfo.connectFlags&CONNECTION_NDS)
  131.                 printf("This is a Directory Services connection\n");
  132.             if(connInfo.connectFlags&CONNECTION_PNW)
  133.                 printf("This is a Personal NetWare connection\n");
  134.             if(connInfo.connectFlags&CONNECTION_AUTHENTICATED)
  135.                 printf("This connection is authenticated to the tree\n");
  136.  
  137.             printf("Session ID: %X\n",connInfo.sessionID);
  138.             printf("Connection number : %d\n",connInfo.connNumber);
  139.  
  140.             /*-----------------------------------------------------------------
  141.             ** The ADDRESS and NODE listed below are for the internal server
  142.             ** address and node.  This is different than the NIC card node
  143.             ** or the LAN address.
  144.             */
  145.             printf("IPX Internal Network Address= %02X%02X%02X%02X\n",
  146.                       connInfo.serverAddr[0],
  147.                       connInfo.serverAddr[1],
  148.                       connInfo.serverAddr[2],
  149.                       connInfo.serverAddr[3]);
  150.  
  151.             printf("Internal Node Address= %02X%02X%02X%02X%02X%02X\n",
  152.                       connInfo.serverAddr[4],
  153.                       connInfo.serverAddr[5],
  154.                       connInfo.serverAddr[6],
  155.                       connInfo.serverAddr[7],
  156.                       connInfo.serverAddr[8],
  157.                       connInfo.serverAddr[9]);
  158.  
  159.             printf("Server bindery type %X\n",connInfo.serverType);
  160.             printf("Client bindery type %X\n",connInfo.clientType);
  161.             printf("Client Name: %s\n",connInfo.clientName);
  162.             printf("\n\n             Hit Return to Continue");
  163.             getch();
  164.         }
  165.     }
  166.  
  167. }
  168.