home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / 3COMM.ZIP / H.ZIP / AUDIT.H < prev    next >
C/C++ Source or Header  |  1989-05-17  |  8KB  |  233 lines

  1. /********************************************************************/
  2. /**                   Microsoft OS/2 LAN Manager                   **/
  3. /**            Copyright(c) Microsoft Corp., 1987, 1988            **/
  4. /********************************************************************/
  5.  
  6.  
  7.  
  8. /********************************************************************
  9.  *                                    *
  10.  *  About this file ...  AUDIT.H                    *
  11.  *                                    *
  12.  *  This file contains information about the NetAudit APIs.        *
  13.  *                                    *
  14.  *    Function prototypes.                        *
  15.  *                                    *
  16.  *    Data structure templates.                    *
  17.  *                                    *
  18.  *    Definition of special values.                    *
  19.  *                                    *
  20.  *                                    *
  21.  *  NOTE:  You must include NETCONS.H before this file, since this  *
  22.  *       file    depends on values defined in NETCONS.H.            *
  23.  *                                    *
  24.  ********************************************************************/
  25.  
  26.  
  27. /**************************************************************** 
  28.  *                                *
  29.  *          Function prototypes                 *
  30.  *                                *
  31.  ****************************************************************/
  32.  
  33.  
  34. extern API_FUNCTION 
  35.   NetAuditWrite ( unsigned short, const char far *, unsigned short, 
  36.             char far *, char far * );
  37.  
  38. extern API_FUNCTION 
  39.   NetAuditOpen ( const char far *, unsigned far *, char far *);
  40.  
  41. extern API_FUNCTION
  42.   NetAuditClear ( const char far *, const char far *, char far *);
  43.  
  44.  
  45. /**************************************************************** 
  46.  *                                *
  47.  *          Data structure templates            *
  48.  *                                *
  49.  ****************************************************************/
  50.  
  51. /*
  52.  *    General audit_entry information.  For each type of entry,
  53.  *    there may be additional information.  This is found at an
  54.  *    offset of "ae_data_offset" from the start of the audit_entry
  55.  *    structure.
  56.  *
  57.  *    Note that at the very end of each record is a word (unsigned
  58.  *    short) which is the length of the record, the same value as
  59.  *    found in ae_len.  This length includes the whole record, including
  60.  *    the trailing length word.  This allows scanning backward.
  61.  */
  62.  
  63. struct audit_entry {
  64.     unsigned short      ae_len;         /* length of record */
  65.      unsigned short        ae_reserved;
  66.         unsigned long       ae_time;        /* time of entry    */
  67.         unsigned short      ae_type;        /* type of entry    */
  68.         unsigned short      ae_data_offset; /* offset to ae_data */
  69.     };
  70.  
  71. /*
  72.  *    The following structures represent the layout of the data area
  73.  *    of specific audit entry types.  This is the information found
  74.  *    at an offset of "ae_data_offset" from the start of the record.
  75.  *    This will usually be immediately following the audit_entry,
  76.  *    structure, but DO NOT ASSUME THIS, use the ae_data_offset value.
  77.  *
  78.  *    Some of these fields are offsets of the start of a text string.
  79.  *    The offset is from the start of the data area (i.e. the position
  80.  *    identified by ae_data_offset), NOT from the start of the whole
  81.  *    entry.  This data will appear as ASCIZ strings, usually in the
  82.  *    area following the defined structure.
  83.  */
  84.  
  85.                     /* Server status record */
  86. struct ae_srvstatus {
  87.     unsigned short    ae_ss_status;    /* AE_SRVSTART, AE_SRVPAUSED, */
  88.                     /*  AE_SRVCONT, AE_SRVSTOP    */
  89. };
  90.  
  91. struct ae_sesslogon {
  92.     unsigned short    ae_so_compname;    /* ptr to computername of client    */
  93.     unsigned short    ae_so_username;    /* ptr to username of client (NULL  */
  94.                     /*  if same as computername)        */
  95.     unsigned short    ae_so_privilege;    /* AE_GUEST, AE_USER, AE_ADMIN        */
  96. };
  97.     
  98. struct ae_sesslogoff {
  99.     unsigned short    ae_sf_compname;    /* ptr to computername of client    */
  100.     unsigned short    ae_sf_username;    /* ptr to username of client (NULL  */
  101.                     /*  if same as computername)        */
  102.     unsigned short    ae_sf_reason;    /* AE_NORMAL, AE_ERROR, AE_AUTODIS, */
  103.                     /*  AE_ADMINDIS                */
  104. };
  105.  
  106. struct ae_sesspwerr {
  107.     unsigned short    ae_sp_compname;    /* ptr to computername of client  */
  108.     unsigned short    ae_sp_username;    /* ptr to username submitted by   */
  109.                     /*  client (NULL if same as       */
  110.                     /*  computername)          */
  111. };
  112.     
  113. struct ae_connstart {
  114.     unsigned short    ae_ct_compname;    /* ptr to computername of client    */
  115.     unsigned short    ae_ct_username;    /* ptr to username of client (NULL  */
  116.                     /*  if same as computername)        */
  117.     unsigned short    ae_ct_netname;    /* ptr to netname of share        */
  118.     unsigned short    ae_ct_connid;    /* Unique connection id            */
  119. };
  120.  
  121. struct ae_connstop {
  122.     unsigned short    ae_cp_compname;    /* ptr to computername of client    */
  123.     unsigned short    ae_cp_username;    /* ptr to username of client (NULL  */
  124.                     /*  if same as computername)        */
  125.     unsigned short    ae_cp_netname;    /* ptr to netname of share        */
  126.     unsigned short    ae_cp_connid;    /* Unique connection id            */
  127.     unsigned short    ae_cp_reason;    /* AE_NORMAL/AE_SESSDIS/AE_UNSHARE  */
  128. };
  129.  
  130. struct ae_connrej {
  131.     unsigned short    ae_cr_compname;    /* ptr to computername of client    */
  132.     unsigned short    ae_cr_username;    /* ptr to username of client (NULL  */
  133.                     /*  if same as computername)        */
  134.     unsigned short    ae_cr_netname;    /* ptr to netname of share        */
  135.     unsigned short    ae_cr_reason;    /* AE_USERLIMIT, AE_BADPW        */
  136. };
  137.  
  138. struct ae_resaccess {
  139.     unsigned short    ae_ra_compname;    /* ptr to computername of client    */
  140.     unsigned short    ae_ra_username;    /* ptr to username of client (NULL  */
  141.                     /*  if same as computername)        */
  142.     unsigned short    ae_ra_resname;    /* ptr to resource name            */
  143.     unsigned short    ae_ra_operation;    /* Bitmask uses bits defined in     */
  144.                     /*  access.h                */
  145.     unsigned short    ae_ra_returncode;    /* return code from operation        */
  146.     unsigned short    ae_ra_restype;    /* type of resource record        */
  147.     unsigned short    ae_ra_fileid;    /* unique server id of file        */
  148. };
  149.  
  150. struct ae_resaccessrej {
  151.     unsigned short    ae_rr_compname;    /* ptr to computername of client    */
  152.     unsigned short    ae_rr_username;    /* ptr to username of client (NULL  */
  153.                     /*  if same as computername)        */
  154.     unsigned short    ae_rr_resname;    /* ptr to resource name            */
  155.     unsigned short    ae_rr_operation;    /* Bitmask uses bits defined in     */
  156.                     /*  access.h                */
  157. };
  158.  
  159. struct ae_closefile {
  160.     unsigned short    ae_cf_compname;    /* ptr to computername of client    */
  161.     unsigned short    ae_cf_username;    /* ptr to username of client (NULL  */
  162.                     /*  if same as computername)        */
  163.     unsigned short    ae_cf_resname;    /* ptr to resource name            */
  164.     unsigned short    ae_cf_fileid;    /* unique id of file            */
  165.     unsigned long     ae_cf_duration;    /* length of use of file        */
  166.     unsigned short    ae_cf_reason;    /* How the file was closed        */
  167.                     /* 0 = Normal Client Close        */
  168.                     /* 1 = Session Disconnected        */
  169.                     /* 2 = Administrative Close        */
  170. };
  171.  
  172.  
  173. /**************************************************************** 
  174.  *                                *
  175.  *          Special values and constants            *
  176.  *                                *
  177.  ****************************************************************/
  178.  
  179.  
  180. /*
  181.  *     Audit entry types (field ae_type in audit_entry).
  182.  */
  183.  
  184. #define AE_SRVSTATUS    0
  185. #define AE_SESSLOGON    1
  186. #define AE_SESSLOGOFF    2
  187. #define AE_SESSPWERR    3
  188. #define AE_CONNSTART    4
  189. #define AE_CONNSTOP    5
  190. #define AE_CONNREJ    6
  191. #define AE_RESACCESS    7
  192. #define AE_RESACCESSREJ    8
  193. #define    AE_CLOSEFILE    9
  194.  
  195. /* 
  196.  *    Values for ae_ss_status field of ae_srvstatus.
  197.  */
  198.  
  199. #define AE_SRVSTART    0
  200. #define AE_SRVPAUSED    1
  201. #define AE_SRVCONT    2
  202. #define AE_SRVSTOP    3
  203.  
  204. /*
  205.  *     Values for ae_so_privilege field of ae_sesslogon.
  206.  */
  207.  
  208. #define AE_GUEST    0        
  209. #define AE_USER        1
  210. #define AE_ADMIN    2
  211.  
  212. /* 
  213.  *    Values for various ae_XX_reason fields.
  214.  */
  215.  
  216. #define AE_NORMAL    0        
  217. #define AE_USERLIMIT    0
  218. #define AE_ERROR    1
  219. #define AE_SESSDIS    1
  220. #define AE_BADPW    1
  221. #define AE_AUTODIS    2
  222. #define AE_UNSHARE    2
  223. #define AE_ADMINPRIVREQD 2
  224. #define AE_ADMINDIS    3
  225. #define AE_NOACCESSPERM 3
  226.  
  227. #define    AE_NORMAL_CLOSE    0
  228. #define    AE_SES_CLOSE    1
  229. #define    AE_ADMIN_CLOSE    2
  230.  
  231.  
  232.  
  233.