home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / sbcast.exe / SETBCAST.C < prev    next >
C/C++ Source or Header  |  1995-09-28  |  4KB  |  126 lines

  1. /****************************************************************************
  2. **      DISCLAIMER  
  3. **  
  4. **   Novell, Inc. makes no representations or warranties with respect to
  5. **   any NetWare software, and specifically disclaims any express or
  6. **   implied warranties of merchantability, title, or fitness for a
  7. **   particular purpose.  
  8. **
  9. **   Distribution of any NetWare software is forbidden without the
  10. **   express written consent of Novell, Inc.  Further, Novell reserves
  11. **   the right to discontinue distribution of any NetWare software.
  12. **   
  13. **   Novell is not responsible for lost profits or revenue, loss of use
  14. **   of the software, loss of data, costs of re-creating lost data, the
  15. **   cost of any substitute equipment or program, or claims by any party
  16. **   other than you.  Novell strongly recommends a backup be made before
  17. **   any software is installed.   Technical support for this software
  18. **   may be provided at the discretion of Novell.
  19. ****************************************************************************
  20. **
  21. **   File: setbcast.c
  22. **
  23. **   Desc: This code will set the BroadCast mode to
  24. **         0x0000 Receive all broadcasts
  25. **         0x0001 Recieve only server broadcasts. User messages not stored.
  26. **         0x0002 Desable broadcasts. User messages not stored. Server
  27. **                messages are stored but notification is not given to the
  28. **                workstation.
  29. **         0x0003 Both user and server messages are stored but message
  30. **                notification is not sent to the workstation.  The client
  31. **                can poll for messages.
  32. **
  33. **
  34. **   Programmers:
  35. **   Ini   Who         Firm
  36. **   ------------------------------------------------------------------
  37. **   ARM   A. Ray Maxwell     Novell Developer Support.
  38. **
  39. **   History:
  40. **
  41. **   ------------------------------------------------------------------
  42. **   09-25-95   ARM   First code.
  43. */
  44.  
  45. /***************************************************************************
  46. **   Include headers, macros, function prototypes, etc.
  47. */
  48.  
  49.     /*------------------------------------------------------------------
  50.     **   ANSI
  51.     */
  52.     #include <stdlib.h>          /* exit()                */
  53.     #include <stdio.h>           /* sprintf()             */
  54.     #include <string.h>
  55.     #include <conio.h>           /* clrscr()              */
  56.     /*------------------------------------------------------------------
  57.     **   NetWare
  58.     */
  59.     #define NWDOS
  60.     #include <nwcalls.h>
  61.     #include <ntypes.h>
  62.  
  63.     extern unsigned _stklen = (1024 * 8);
  64.  
  65.  
  66. /****************************************************************************
  67. **   Program Start
  68. */
  69. void main(int argc,char *argv[])
  70. {
  71.     NWCCODE        ccode;
  72.     NWCONN_HANDLE  connHandle;
  73.     nuint32 mode;
  74.     /*-----------------------------------------------------------------------
  75.     **Initialize NWCalls
  76.     */
  77.     ccode = NWCallsInit( NULL, NULL );
  78.     if (ccode)
  79.     {
  80.         printf( "\nNWCallsInit failed: %04x", ccode );
  81.         exit(1);
  82.     }
  83.     ccode = NWGetDefaultConnectionID(&connHandle);
  84.     if (ccode)
  85.     {
  86.         printf( "\nNWGetDefaultConnectionID failed: %04x", ccode );
  87.         exit(1);
  88.     }
  89.     mode=(strtoul(argv[1],(char**)NULL,16));
  90.  
  91.     if (argc<2 || mode<0 || mode>3)
  92.     {
  93.         clrscr();
  94.         printf(" setbcast <mode number>\n");
  95.         printf(" Where mode is one of the following:\n");
  96.         printf("0x0000 Receive all broadcasts\n");
  97.         printf("0x0001 Recieve only server broadcasts. User messages not stored.\n");
  98.         printf("0x0002 Desable broadcasts. User messages not stored. Server \n");
  99.         printf("       messages are stored but notification is not given to the \n");
  100.         printf("       workstation.\n");
  101.         printf("0x0003 Both user and server messages are stored but message \n");
  102.         printf("       notification is not sent to the workstation.  The client\n");
  103.         printf("       can poll for messages.\n");
  104.         exit(1);
  105.     }
  106.  
  107.     /* Set broadcast mode to 2:  disabled */
  108.     ccode = NWSetBroadcastMode(connHandle, mode);
  109.     if (ccode)
  110.         printf( "\nNWSetBroadcastMode: failed %04x", ccode );
  111.     else
  112.         switch(mode)
  113.         {
  114.             case 0x0000 : printf("Broadcast mode set to 0x0000\n");
  115.                               break;
  116.             case 0x0001 : printf("Broadcast mode set to 0x0001\n");
  117.                               break;
  118.             case 0x0002 : printf("Broadcast mode set to 0x0002\n");
  119.                               break;
  120.             case 0x0003 : printf("Broadcast mode set to 0x0003\n");
  121.                               break;
  122.          default     : printf("Should NEVER get here!!!!!\n");
  123.                        break;
  124.       }
  125.