home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / header45.zip / alert.h < prev    next >
C/C++ Source or Header  |  1999-04-29  |  8KB  |  258 lines

  1. /**************************************************************************/
  2. /*                                                                        */
  3. /*              IBM OS/2(tm) Local Area Network (LAN) Server              */
  4. /*                            Version 5.03                                */
  5. /*                   (C) Copyright IBM Corp. 1988, 1998                   */
  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. #ifndef NETALERT_INCLUDED
  35.  
  36. #define NETALERT_INCLUDED
  37.  
  38. #ifdef  ANY_32_BIT
  39. #pragma pack(1)
  40. #endif
  41.  
  42. #include "alertmsg.h"
  43.  
  44. /****************************************************************
  45.  *                                                              *
  46.  *              Function prototypes                             *
  47.  *                                                              *
  48.  ****************************************************************/
  49.  
  50. extern API_FUNCTION
  51.   NetAlertRaise ( const unsigned char LSFAR * pszEvent,
  52.                   const unsigned char LSFAR * pbBuffer,
  53.                   unsigned short              usBuffer,
  54.                   unsigned long               ulTimeout );
  55.  
  56. extern API_FUNCTION
  57.   NetAlertStart ( const unsigned char LSFAR * pszEvent,
  58.                   const unsigned char LSFAR * pszRecipient,
  59.                   unsigned short              usMaxData );
  60.  
  61. extern API_FUNCTION
  62.   NetAlertStop ( const unsigned char LSFAR * pszEvent,
  63.                  const unsigned char LSFAR * pszRecipient );
  64.  
  65.  
  66.  
  67. /****************************************************************
  68.  *                                                              *
  69.  *              Data structure templates                        *
  70.  *                                                              *
  71.  ****************************************************************/
  72.  
  73.  
  74. /***   Standard alert structure
  75.  */
  76.  
  77. struct std_alert
  78. {
  79.         long            alrt_timestamp;
  80.         unsigned char   alrt_eventname[EVLEN+1];
  81.         unsigned char   alrt_pad1;
  82.         unsigned char   alrt_servicename[SNLEN+1];
  83. };
  84.  
  85. /*
  86.  *      The following macro gives a pointer to the other_info data.
  87.  *      It takes a "struct std_alert *" and returns a "unsigned char *".
  88.  */
  89.  
  90. #define ALERT_OTHER_INFO(x)    ((unsigned char *)(x)     + sizeof(struct std_alert))
  91. #define ALERT_OTHER_INFO_F(x)  ((unsigned char LSFAR *)(x) + sizeof(struct std_alert))
  92.  
  93. /*
  94.  *      The following macro gives a pointer to the variable-length data.
  95.  *      It takes a pointer to one of the other-info structs and
  96.  *      returns a "unsigned char *".
  97.  */
  98.  
  99. #define ALERT_VAR_DATA(p)      ((unsigned char *)(p)     + sizeof(*p))
  100. #define ALERT_VAR_DATA_F(p)    ((unsigned char LSFAR *)(p) + sizeof(*p))
  101.  
  102.  
  103. /***   Print alert other-info structure
  104.  */
  105.  
  106. struct print_other_info {
  107.         short   alrtpr_jobid;       /* Job ID for job */
  108.         short   alrtpr_status;      /* Status word from job info struct */
  109.                                     /* bit 15 == 1 means job deleted */
  110.         long    alrtpr_submitted;   /* When submitted */
  111.         long    alrtpr_size;        /* Bytes in job */
  112. };
  113.  
  114. /*      Followed by (consecutive ASCIIZ strings) ...
  115.  *
  116.  *              computername
  117.  *              username
  118.  *              queuename
  119.  *              destination
  120.  *              status string
  121.  */
  122.  
  123. /***   Spool alert info structure
  124.  */
  125.  
  126. struct spool_alert_info {
  127.         unsigned long   splalrt_jobid;      /* Job ID for job          */
  128.         unsigned long   splalrt_type;       /* spool alert type        */
  129.         unsigned long   splalrt_flags;      /* is currently set to 0   */
  130. };
  131.  
  132. /*      Followed by (consecutive ASCIIZ strings) ...
  133.  *
  134.  *              DestComputername
  135.  *              ObjectName (username)
  136.  *              Caption
  137.  *              MsgText
  138.  */
  139.  
  140. /***   Error log alert other-info structure
  141.  */
  142.  
  143. struct errlog_other_info {
  144.         short   alrter_errcode;
  145.         long    alrter_offset;
  146. };
  147.  
  148. /***   Admin alert other-info structure
  149.  */
  150.  
  151. struct admin_other_info {
  152.         short   alrtad_errcode;         /* code for message in net error message file */
  153.         short   alrtad_numstrings;      /* the number of merge strings 0-9 */
  154. };
  155.  
  156. /*      Followed by merge strings (consecutive ASCIIZ strings, count
  157.  *      is in alrtad_numstrings field).
  158.  */
  159.  
  160.  
  161. /***   User alert other-info structure
  162.  */
  163.  
  164. struct user_other_info {
  165.         short   alrtus_errcode; /* code for message in net error message file */
  166.         short   alrtus_numstrings;       /* the number of merge strings 0-9 */
  167. };
  168.  
  169. /*      Followed by merge strings (consecutive ASCIIZ strings, count
  170.  *      is in alrtus_numstrings field).
  171.  *
  172.  *      Further followed by (consecutive ASCIIZ strings) ...
  173.  *
  174.  *              username
  175.  *              computername
  176.  */
  177.  
  178.  
  179.  
  180.  
  181. /***    Time set alert other-info structure.
  182.  *
  183.  *      Provides detailed information about a change in the system clock.
  184.  */
  185.  
  186. struct timeset_other_info {
  187.         unsigned long   alrtts_old_time;
  188.         unsigned long   alrtts_new_time;
  189.         unsigned long   alrtts_old_msec;
  190.         unsigned long   alrtts_new_msec;
  191.         unsigned char   alrtts_old_hsec;
  192.         unsigned char   alrtts_new_hsec;
  193.         unsigned short  alrtts_old_tz;
  194.         unsigned short  alrtts_new_tz;
  195. };
  196.  
  197.  
  198.  
  199. #ifdef PURE_32
  200. /****************************************************************
  201.  *                                                              *
  202.  *              Function prototypes                             *
  203.  *                                                              *
  204.  ****************************************************************/
  205.  
  206. extern API32_FUNCTION
  207.   Net32AlertRaise ( const unsigned char    * pszEvent,
  208.                     const unsigned char    * pbBuffer,
  209.                     unsigned long            ulBuffer,
  210.                     unsigned long            ulTimeout );
  211.  
  212. extern API32_FUNCTION
  213.   Net32AlertStart ( const unsigned char    * pszEvent,
  214.                     const unsigned char    * pszRecipient,
  215.                     unsigned long            ulMaxData );
  216.  
  217. extern API32_FUNCTION
  218.   Net32AlertStop ( const unsigned char * pszEvent,
  219.                    const unsigned char * pszRecipient );
  220. #endif /* PURE_32 */
  221.  
  222.  
  223. /****************************************************************
  224.  *                                                              *
  225.  *              Special values and constants                    *
  226.  *                                                              *
  227.  ****************************************************************/
  228.  
  229. /*
  230.  *      Names of standard Microsoft-defined alert events.
  231.  */
  232.  
  233. #define ALERT_PRINT_EVENT       "PRINTING"
  234. #define ALERT_MESSAGE_EVENT     "MESSAGE"
  235. #define ALERT_ERRORLOG_EVENT    "ERRORLOG"
  236. #define ALERT_ADMIN_EVENT       "ADMIN"
  237. #define ALERT_USER_EVENT        "USER"
  238.  
  239. /* New alert event defined for NetworkSplAlert API */
  240. #define ALERT_NWIPRT_EVENT      "SPLALERT"
  241.  
  242.  
  243. /*
  244.  *      Three suggested timeouts (in milliseconds) for NetAlertRaise.
  245.  */
  246.  
  247. #define ALERT_SHORT_WAIT        100L
  248. #define ALERT_MED_WAIT          1000L
  249. #define ALERT_LONG_WAIT         10000L
  250.  
  251.  
  252.  
  253. #ifdef ANY_32_BIT
  254. #pragma pack()
  255. #endif
  256.  
  257. #endif /* NETALERT_INCLUDED */
  258.