home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dsstlkt5.zip / dssos2tk / dss / ALERT.H < prev    next >
C/C++ Source or Header  |  1998-05-08  |  7KB  |  243 lines

  1. /**************************************************************************/
  2. /*                                                                        */
  3. /*              IBM OS/2(tm) Directory and Security Services (DSS)        */
  4. /*                            Version 5.0                                 */
  5. /*                   (C) Copyright IBM Corp. 1995                         */
  6. /*                  Licensed Materials - Property of IBM                  */
  7. /*                                                                        */
  8. /**************************************************************************/
  9. /********************************************************************/
  10.  
  11.  
  12. /********************************************************************
  13.  *
  14.  *  About this file ...  ALERT.H
  15.  *
  16.  *  This file contains information about the NetAlert APIs.
  17.  *
  18.  *    Function prototypes.
  19.  *
  20.  *    Data structure templates.
  21.  *
  22.  *    Definition of special values.
  23.  *
  24.  *
  25.  *  NOTE:  You must include NETCONS.H before this file, since this
  26.  *       file    depends on values defined in NETCONS.H.
  27.  *
  28.  *  NOTE:  ALERT.H includes ALERTMSG.H, which defines the alert message
  29.  *       numbers.
  30.  *
  31.  ********************************************************************/
  32.  
  33.  
  34. #ifdef  ANY_32_BIT
  35. #pragma pack(1)
  36. #endif
  37.  
  38.  
  39. #ifndef NETALERT_INCLUDED
  40.  
  41. #define NETALERT_INCLUDED
  42.  
  43.  
  44. #include "alertmsg.h"
  45.  
  46.  
  47. /****************************************************************
  48.  *                                                              *
  49.  *              Function prototypes                             *
  50.  *                                                              *
  51.  ****************************************************************/
  52.  
  53. extern API_FUNCTION
  54.   NetAlertRaise ( const unsigned char LSFAR * pszEvent,
  55.                   const unsigned char LSFAR * pbBuffer,
  56.                   unsigned short              usBuffer,
  57.                   unsigned long               ulTimeout );
  58.  
  59. extern API_FUNCTION
  60.   NetAlertStart ( const unsigned char LSFAR * pszEvent,
  61.                   const unsigned char LSFAR * pszRecipient,
  62.                   unsigned short              usMaxData );
  63.  
  64. extern API_FUNCTION
  65.   NetAlertStop ( const unsigned char LSFAR * pszEvent,
  66.                  const unsigned char LSFAR * pszRecipient );
  67.  
  68.  
  69.  
  70. /****************************************************************
  71.  *                                *
  72.  *          Data structure templates            *
  73.  *                                *
  74.  ****************************************************************/
  75.  
  76.  
  77. /***   Standard alert structure
  78.  */
  79.  
  80. struct std_alert
  81. {
  82.         long            alrt_timestamp;
  83.         unsigned char   alrt_eventname[EVLEN+1];
  84.         unsigned char   alrt_pad1;
  85.         unsigned char   alrt_servicename[SNLEN+1];
  86. };
  87.  
  88. /*
  89.  *    The following macro gives a pointer to the other_info data.
  90.  *    It takes a "struct std_alert *" and returns a "unsigned char *".
  91.  */
  92.  
  93. #define ALERT_OTHER_INFO(x)    ((unsigned char *)(x)     + sizeof(struct std_alert))
  94. #define ALERT_OTHER_INFO_F(x)  ((unsigned char LSFAR *)(x) + sizeof(struct std_alert))
  95.  
  96. /*
  97.  *    The following macro gives a pointer to the variable-length data.
  98.  *    It takes a pointer to one of the other-info structs and
  99.  *    returns a "unsigned char *".
  100.  */
  101.  
  102. #define ALERT_VAR_DATA(p)      ((unsigned char *)(p)     + sizeof(*p))
  103. #define ALERT_VAR_DATA_F(p)    ((unsigned char LSFAR *)(p) + sizeof(*p))
  104.  
  105.  
  106. /***   Print alert other-info structure
  107.  */
  108.  
  109. struct print_other_info {
  110.         short   alrtpr_jobid;       /* Job ID for job */
  111.         short   alrtpr_status;      /* Status word from job info struct */
  112.                     /* bit 15 == 1 means job deleted */
  113.         long    alrtpr_submitted;   /* When submitted */
  114.         long    alrtpr_size;        /* Bytes in job */
  115. };
  116.  
  117. /*    Followed by (consecutive ASCIIZ strings) ...
  118.  *
  119.  *        computername
  120.  *        username
  121.  *        queuename
  122.  *        destination
  123.  *        status string
  124.  */
  125.  
  126. /***   Error log alert other-info structure
  127.  */
  128.  
  129. struct errlog_other_info {
  130.     short    alrter_errcode;
  131.     long    alrter_offset;
  132. };
  133.  
  134. /***   Admin alert other-info structure
  135.  */
  136.  
  137. struct admin_other_info {
  138.     short    alrtad_errcode;        /* code for message in net error message file */
  139.     short    alrtad_numstrings;    /* the number of merge strings 0-9 */
  140. };
  141.  
  142. /*    Followed by merge strings (consecutive ASCIIZ strings, count
  143.  *    is in alrtad_numstrings field).
  144.  */
  145.  
  146.  
  147. /***   User alert other-info structure
  148.  */
  149.  
  150. struct user_other_info {
  151.     short    alrtus_errcode;    /* code for message in net error message file */
  152.     short    alrtus_numstrings;     /* the number of merge strings 0-9 */
  153. };
  154.  
  155. /*    Followed by merge strings (consecutive ASCIIZ strings, count
  156.  *    is in alrtus_numstrings field).
  157.  *
  158.  *    Further followed by (consecutive ASCIIZ strings) ...
  159.  *
  160.  *        username
  161.  *        computername
  162.  */
  163.  
  164.  
  165.  
  166.  
  167. /***    Time set alert other-info structure.
  168.  *
  169.  *    Provides detailed information about a change in the system clock.
  170.  */
  171.  
  172. struct timeset_other_info {
  173.     unsigned long    alrtts_old_time;
  174.     unsigned long    alrtts_new_time;
  175.     unsigned long    alrtts_old_msec;
  176.     unsigned long    alrtts_new_msec;
  177.     unsigned char   alrtts_old_hsec;
  178.     unsigned char   alrtts_new_hsec;
  179.     unsigned short    alrtts_old_tz;
  180.     unsigned short    alrtts_new_tz;
  181. };
  182.  
  183.  
  184. /* -------------------- Begin f00 --------------------- */
  185.  
  186. #ifdef PURE_32
  187. /****************************************************************
  188.  *                                                              *
  189.  *              Function prototypes                             *
  190.  *                                                              *
  191.  ****************************************************************/
  192.  
  193. extern API32_FUNCTION
  194.   Net32AlertRaise ( const unsigned char    * pszEvent,
  195.                     const unsigned char    * pbBuffer,
  196.                     unsigned long            ulBuffer,
  197.                     unsigned long            ulTimeout );
  198.  
  199. extern API32_FUNCTION
  200.   Net32AlertStart ( const unsigned char    * pszEvent,
  201.                     const unsigned char    * pszRecipient,
  202.                     unsigned long            ulMaxData );
  203.  
  204. extern API32_FUNCTION
  205.   Net32AlertStop ( const unsigned char * pszEvent,
  206.                    const unsigned char * pszRecipient );
  207. #endif /* PURE_32 */
  208.  
  209. /* --------------------  End  f00  --------------------- */
  210.  
  211. /****************************************************************
  212.  *                                *
  213.  *          Special values and constants            *
  214.  *                                *
  215.  ****************************************************************/
  216.  
  217. /*
  218.  *    Names of standard Microsoft-defined alert events.
  219.  */
  220.  
  221. #define ALERT_PRINT_EVENT    "PRINTING"
  222. #define ALERT_MESSAGE_EVENT    "MESSAGE"
  223. #define ALERT_ERRORLOG_EVENT    "ERRORLOG"
  224. #define ALERT_ADMIN_EVENT    "ADMIN"
  225. #define ALERT_USER_EVENT    "USER"
  226.  
  227. /*
  228.  *     Three suggested timeouts (in milliseconds) for NetAlertRaise.
  229.  */
  230.  
  231. #define ALERT_SHORT_WAIT    100L
  232. #define ALERT_MED_WAIT        1000L
  233. #define ALERT_LONG_WAIT        10000L
  234.  
  235.  
  236.  
  237. #endif /* NETALERT_INCLUDED */
  238.  
  239. #ifdef ANY_32_BIT
  240. #pragma pack()
  241. #endif
  242.  
  243.