home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warphead.zip / H / ALERT.H < prev    next >
C/C++ Source or Header  |  1997-09-05  |  7KB  |  235 lines

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