home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Collection - Online Library - January 1996 / CKITOS2196.ISO / diskette / gg244090.dsk / unc.dsk / CHAPTER.09 / COMMON.H < prev    next >
C/C++ Source or Header  |  1993-08-04  |  2KB  |  50 lines

  1. /***************************************************************************/
  2. /*                                                                         */
  3. /* Name:        header file common.h                                       */
  4. /*                                                                         */
  5. /* Description: Common header file for the Message Box example.            */
  6. /*              Defines the error check pseudo function which is called    */
  7. /*              to check the return status of call to the RPC runtime.     */
  8. /*              Defines also the principal used by the server to           */
  9. /*              authenticate, the name for the entry in the CDS name       */
  10. /*              space and the return values of the remote procedures.      */
  11. /*                                                                         */
  12. /***************************************************************************/
  13.  
  14. # ifndef _MBOX_COMMON
  15. # define _MBOX_COMMON
  16.  
  17. # ifndef _H_STDIO
  18. # include <stdio.h>
  19. # endif
  20.  
  21. # define ERRCHK(x)                                                     \
  22.         if ( (x) != error_status_ok ) {                                \
  23.            fprintf( stderr, "FAULT: %s: %d\n", __FILE__, __LINE__ - 1);\
  24.            dce_error_inq_text(x, dce_error_string, &error_inq_st);     \
  25.            fprintf(stderr, "cause: %s\n", dce_error_string);           \
  26.            fflush(stderr);                                             \
  27.            exit ( x );                                                 \
  28.         }
  29.  
  30. char                                    dce_error_string[256];
  31. error_status_t                          error_inq_st;
  32.  
  33. # define NUM_ELEMS(a)                   (sizeof(a)/sizeof(a[0]))
  34.  
  35. # define ENTRY_NAME                     "/.:/Servers/MessageBox"
  36. # define PRINCIPAL_NAME                 "MessageBox"
  37.  
  38. /* Return values of remote procedures */
  39. # define MBOX_OK                         0
  40. # define MBOX_NO_MSG                     1
  41. # define MBOX_READ                       2
  42. # define MBOX_APPEND                     3
  43. # define MBOX_CREATE                     4
  44. # define MBOX_NOT_AUTHORIZED            -1
  45. # define MBOX_PRINCIPAL_EXIST           -2
  46. # define MBOX_PRINCIPAL_NOT_EXIST       -3
  47. # define MBOX_ALL_USED                  -4
  48.  
  49. # endif
  50.