home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0210 - 0219 / ibm0210-0219 / ibm0213.tar / ibm0213 / LS4APWAD.ZIP / LS40A.A12 / IBMLSA / IBM400R2 / OSLANAPI.ZIP / IBMLAN / NETSRC / H / AUDIT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-10  |  19.6 KB  |  526 lines

  1. /**************************************************************************/
  2. /*                                                                        */
  3. /*              IBM OS/2(tm) Local Area Network (LAN) Server              */
  4. /*                            Version 3.0                                 */
  5. /* (c) Copyright International Business Machines Corporation, 1988, 1992  */
  6. /*                                                                        */
  7. /**************************************************************************/
  8. /********************************************************************/
  9.  
  10.  
  11.  
  12. /********************************************************************
  13.  *                                                                  *
  14.  *  About this file ...  AUDIT.H                                    *
  15.  *                                                                  *
  16.  *  This file contains information about the NetAudit 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.  ********************************************************************/
  29.  
  30.  
  31.  
  32. #if defined(INCL_32) || defined(ANY_32_BIT)
  33. #pragma pack(1)
  34. #endif
  35.  
  36.  
  37.  
  38. #ifndef NETAUDIT_INCLUDED
  39.  
  40. #define NETAUDIT_INCLUDED
  41.  
  42.  
  43. /****************************************************************
  44.  *                                *
  45.  *        Data Structures for LogRead            *
  46.  *                                *
  47.  ****************************************************************/
  48.  
  49. #ifndef LOGFLAGS_FORWARD
  50.  
  51. typedef struct loghandle
  52.     {
  53.     unsigned long    time;        /* Timestamp of first record */
  54.     unsigned long    last_flags;    /* Last call's flags */
  55.     unsigned long    offset;     /* Current offset in log */
  56.     unsigned long    rec_offset;    /* Current record offset in log */
  57.     }    HLOG;
  58.  
  59.  
  60. #define LOGFLAGS_FORWARD    0
  61. #define LOGFLAGS_BACKWARD    0x1
  62. #define LOGFLAGS_SEEK        0x2
  63.  
  64. #endif
  65.  
  66.  
  67. /****************************************************************
  68.  *                                                              *
  69.  *              Function prototypes                             *
  70.  *                                                              *
  71.  ****************************************************************/
  72.  
  73.  
  74.  
  75. extern API_FUNCTION
  76.   NetAuditClear ( const unsigned char LSFAR * pszServer,
  77.                   const unsigned char LSFAR * pszBackupFile,
  78.                   unsigned char LSFAR *       pszReserved );
  79.  
  80. extern API_FUNCTION
  81.   NetAuditOpen ( const unsigned char LSFAR * pszServer,
  82.                  unsigned LSINT      LSFAR * phAuditLog,
  83.                  unsigned char       LSFAR * pszReserved );
  84.  
  85. extern API_FUNCTION
  86.   NetAuditRead ( const unsigned char LSFAR * pszServer,
  87.                  const unsigned char LSFAR * pszReserved1,
  88.                  HLOG LSFAR *                phAuditLog,
  89.                  unsigned long               ulOffset,
  90.                  unsigned short LSFAR      * pusReserved2,
  91.                  unsigned long               ulReserved3,
  92.                  unsigned long               flOffset,
  93.                  unsigned char LSFAR *       pbBuffer,
  94.                  unsigned short              cbBuffer,
  95.                  unsigned short LSFAR      * pcbReturned,
  96.                  unsigned short LSFAR      * pcbTotalAvail );
  97.  
  98.  
  99. extern API_FUNCTION
  100.   NetAuditWrite ( unsigned short              usType,
  101.                   const unsigned char LSFAR * pbBuffer,
  102.                   unsigned short              cbBuffer,
  103.                   unsigned char LSFAR *       pszReserved1,
  104.                   unsigned char LSFAR *       pszReserved2 );
  105.  
  106.  
  107. /****************************************************************
  108.  *                                *
  109.  *          Data structure templates            *
  110.  *                                *
  111.  ****************************************************************/
  112.  
  113. /*
  114.  *   General audit_entry information.  For each type of entry,
  115.  *   there may be additional information.  This is found at an
  116.  *   offset of "ae_data_offset" from the start of the audit_entry
  117.  *   structure.
  118.  *   
  119.  *   Note that at the very end of each record is a word (unsigned
  120.  *   short) that is the length of the record, the same value as
  121.  *   found in ae_len.  This length includes the whole record, including
  122.  *   the trailing length word.  This allows scanning backward.
  123.  */
  124.  
  125. struct audit_entry {
  126.     unsigned short      ae_len;         /* length of record */
  127.      unsigned short        ae_reserved;
  128.         unsigned long       ae_time;        /* time of entry    */
  129.         unsigned short      ae_type;        /* type of entry    */
  130.         unsigned short      ae_data_offset; /* offset to ae_data */
  131. };     /* audit_entry */
  132.  
  133. /*
  134.  *    The following structures represent the layout of the data area
  135.  *    of specific audit entry types.  This is the information found
  136.  *    at an offset of "ae_data_offset" from the start of the record.
  137.  *    This will usually immediately follow the audit_entry structure,
  138.  *    but DO NOT ASSUME THIS. Use the ae_data_offset value.
  139.  *
  140.  *    Some of these fields are offsets of the start of a text string.
  141.  *    The offset is from the start of the data area (i.e. the position
  142.  *    identified by ae_data_offset), NOT from the start of the whole
  143.  *    entry.  This data will appear as ASCIIZ strings, usually in the
  144.  *    area following the defined structure.
  145.  */
  146.  
  147.                     /* Server status record */
  148. struct ae_srvstatus {
  149.  
  150.     unsigned short    ae_sv_status;
  151.                     /* AE_SRVSTART, AE_SRVPAUSED, */
  152.                     /*  AE_SRVCONT, AE_SRVSTOP    */
  153. };    /* ae_srvstatus */
  154.  
  155. struct ae_sesslogon {
  156.     unsigned short    ae_so_compname;    /* ptr to computername of client    */
  157.     unsigned short    ae_so_username;    /* ptr to username of client (NULL  */
  158.                     /*  if same as computername)        */
  159.     unsigned short    ae_so_privilege;    /* AE_GUEST, AE_USER, AE_ADMIN        */
  160. };    /* ae_sesslogon */
  161.     
  162. struct ae_sesslogoff {
  163.     unsigned short    ae_sf_compname;    /* ptr to computername of client    */
  164.     unsigned short    ae_sf_username;    /* ptr to username of client (NULL  */
  165.                     /*  if same as computername)        */
  166.     unsigned short    ae_sf_reason;    /* AE_NORMAL, AE_ERROR, AE_AUTODIS, */
  167.                     /*  AE_ADMINDIS                */
  168. };    /* ae_sesslogoff */
  169.  
  170. struct ae_sesspwerr {
  171.     unsigned short    ae_sp_compname;    /* ptr to computername of client  */
  172.     unsigned short    ae_sp_username;    /* ptr to username submitted by   */
  173.                     /*  client (NULL if same as       */
  174.                     /*  computername)          */
  175. };    /* ae_sesspwerr */
  176.     
  177. struct ae_connstart {
  178.     unsigned short    ae_ct_compname;    /* ptr to computername of client    */
  179.     unsigned short    ae_ct_username;    /* ptr to username of client (NULL  */
  180.                     /*  if same as computername)        */
  181.     unsigned short    ae_ct_netname;    /* ptr to netname of share        */
  182.     unsigned short    ae_ct_connid;    /* Unique connection ID            */
  183. };    /* ae_connstart */
  184.  
  185. struct ae_connstop {
  186.     unsigned short    ae_cp_compname;    /* ptr to computername of client    */
  187.     unsigned short    ae_cp_username;    /* ptr to username of client (NULL  */
  188.                     /*  if same as computername)        */
  189.     unsigned short    ae_cp_netname;    /* ptr to netname of share        */
  190.     unsigned short    ae_cp_connid;    /* Unique connection ID            */
  191.     unsigned short    ae_cp_reason;    /* AE_NORMAL/AE_SESSDIS/AE_UNSHARE  */
  192. };    /* ae_connstop */
  193.  
  194. struct ae_connrej {
  195.     unsigned short    ae_cr_compname;    /* ptr to computername of client    */
  196.     unsigned short    ae_cr_username;    /* ptr to username of client (NULL  */
  197.                     /*  if same as computername)        */
  198.     unsigned short    ae_cr_netname;    /* ptr to netname of share        */
  199.     unsigned short    ae_cr_reason;    /* AE_USERLIMIT, AE_BADPW        */
  200. };    /* ae_connrej */
  201.  
  202. struct ae_resaccess {
  203.     unsigned short    ae_ra_compname;    /* ptr to computername of client    */
  204.     unsigned short    ae_ra_username;    /* ptr to username of client (NULL  */
  205.                     /*  if same as computername)        */
  206.     unsigned short    ae_ra_resname;    /* ptr to resource name            */
  207.     unsigned short    ae_ra_operation;    /* Bitmask uses bits defined in     */
  208.                     /*  access.h                */
  209.     unsigned short    ae_ra_returncode;    /* return code from operation        */
  210.     unsigned short    ae_ra_restype;    /* type of resource record        */
  211.     unsigned short    ae_ra_fileid;    /* unique server ID of file        */
  212. };    /* ae_resaccess */
  213.  
  214. struct ae_resaccessrej {
  215.     unsigned short    ae_rr_compname;    /* ptr to computername of client    */
  216.     unsigned short    ae_rr_username;    /* ptr to username of client (NULL  */
  217.                     /*  if same as computername)        */
  218.     unsigned short    ae_rr_resname;    /* ptr to resource name            */
  219.     unsigned short    ae_rr_operation;    /* Bitmask uses bits defined in     */
  220.                     /*  access.h                */
  221. };    /* ae_resaccessrej */
  222.  
  223. struct ae_closefile {
  224.     unsigned short    ae_cf_compname;    /* ptr to computername of client    */
  225.     unsigned short    ae_cf_username;    /* ptr to username of client (NULL  */
  226.                     /*  if same as computername)        */
  227.     unsigned short    ae_cf_resname;    /* ptr to resource name            */
  228.     unsigned short    ae_cf_fileid;    /* unique ID of file            */
  229.     unsigned long     ae_cf_duration;    /* length of use of file        */
  230.     unsigned short    ae_cf_reason;    /* How the file was closed        */
  231.                     /* 0 = Normal Client Close        */
  232.                     /* 1 = Session Disconnected        */
  233.                     /* 2 = Administrative Close        */
  234. };    /* ae_closefile */
  235.  
  236. struct ae_servicestat {
  237.     unsigned short    ae_ss_compname; /* ptr to computername of client    */
  238.     unsigned short    ae_ss_username; /* ptr to username of client (NULL  */
  239.                     /*  if same as computername)        */
  240.     unsigned short    ae_ss_svcname;    /* ptr to service name            */
  241.     unsigned short    ae_ss_status;    /* status of service            */
  242.     unsigned long    ae_ss_code;    /* code of service            */
  243.     unsigned short    ae_ss_text;    /* text of service            */
  244.     unsigned short    ae_ss_returnval;
  245. };    /* ae_servicestat */
  246.  
  247.  
  248. struct ae_aclmod {
  249.     unsigned short    ae_am_compname;    /* ptr to computername of client    */
  250.     unsigned short    ae_am_username;    /* ptr to username of client (NULL  */
  251.                     /*  if same as computername)        */
  252.     unsigned short    ae_am_resname;    /* ptr to resource name         */
  253.     unsigned short    ae_am_action;    /* action performed on ACL record   */
  254.                     /* 0 = mod, 1 = del, 2 = add        */
  255.     unsigned short    ae_am_datalen;    /* length of data following struct  */
  256. };    /* ae_aclmod */
  257.  
  258.  
  259. struct ae_uasmod {
  260.     unsigned short    ae_um_compname;    /* ptr to computername of client    */
  261.     unsigned short    ae_um_username;    /* ptr to username of client (NULL  */
  262.                     /*  if same as computername)        */
  263.     unsigned short    ae_um_resname;    /* ptr to resource name         */
  264.     unsigned short    ae_um_rectype;    /* type of UAS record            */
  265.                     /* 0 = user, 1 = group, 2 = modals  */
  266.     unsigned short    ae_um_action;    /* action performed on record        */
  267.                     /* 0 = mod, 1 = del, 2 = add        */
  268.     unsigned short    ae_um_datalen;    /* length of appended structure     */
  269. };    /* ae_uasmod */
  270.  
  271. struct ae_netlogon {
  272.     unsigned short    ae_no_compname;    /* ptr to computername of client    */
  273.     unsigned short    ae_no_username;    /* ptr to username of client (NULL  */
  274.                     /*  if same as computername)        */
  275.     unsigned short    ae_no_privilege;    /* AE_GUEST, AE_USER, AE_ADMIN        */
  276.     unsigned long     ae_no_authflags;    /* operator privileges            */
  277. };    /* ae_netlogon */
  278.  
  279. struct ae_netlogoff {
  280.     unsigned short    ae_nf_compname;    /* ptr to computername of client    */
  281.     unsigned short    ae_nf_username;    /* ptr to username of client (NULL  */
  282.                     /* if same as computername)        */
  283.     unsigned short    ae_reserved1;    /* AE_NORMAL (reason for logoff)    */
  284.     unsigned short    ae_reserved2;    /* AE_NORMAL (details of reason)    */
  285. };    /* ae_netlogoff */
  286.  
  287. struct ae_netlogdenied {
  288.     unsigned short    ae_nd_compname;    /* ptr to computername of client    */
  289.     unsigned short    ae_nd_username;    /* ptr to username of client (NULL  */
  290.                     /*  if same as computername)        */
  291.     unsigned short    ae_nd_reason;    /* reason for denial of netlogon    */
  292.     unsigned short    ae_nd_subreason;    /* details of reason for denial     */
  293. };    /* ae_netlogdenied */
  294.  
  295. struct ae_acclim {
  296.     unsigned short    ae_al_compname;    /* ptr to computername of client    */
  297.     unsigned short    ae_al_username;    /* ptr to username of client (NULL  */
  298.                     /*  if same as computername)        */
  299.     unsigned short    ae_al_resname;    /* ptr to resource name         */
  300.     unsigned short    ae_al_limit;    /* limit that was exceeded        */
  301. };    /* ae_acclim */
  302.  
  303.  
  304. struct ae_resaccess2 {
  305.     unsigned short    ae_ra2_compname;  /* ptr to computername of client    */
  306.     unsigned short    ae_ra2_username;  /* ptr to username of client (NULL  */
  307.                                         /*  if same as computername)        */
  308.     unsigned short    ae_ra2_resname;    /* ptr to resource name         */
  309.     unsigned short    ae_ra2_operation; /* Bitmask uses bits defined in     */
  310.                     /*  access.h                */
  311.     unsigned short    ae_ra2_returncode; /* return code from operation        */
  312.     unsigned short    ae_ra2_restype;    /* type of resource record        */
  313.     unsigned long     ae_ra2_fileid;    /* unique server ID of file        */
  314. };    /* ae_resaccess2 */
  315.  
  316.  
  317. /* -------------------- Begin F2359 --------------------- */
  318.  
  319. #ifdef PURE_32
  320. /****************************************************************
  321.  *                                                              *
  322.  *       Function prototypes for "pure" 32-bit code             *
  323.  *                                                              *
  324.  ****************************************************************/
  325.  
  326. extern API32_FUNCTION
  327.   Net32AuditClear ( const unsigned char * pszServer,
  328.                     const unsigned char * pszBackupFile,
  329.                     unsigned char       * pszReserved );
  330.  
  331. extern API32_FUNCTION
  332.   Net32AuditRead ( const unsigned char * pszServer,
  333.                    const unsigned char * pszReserved1,
  334.                    HLOG                * phAuditLogHandle,
  335.                    unsigned long         ulOffset,
  336.                    unsigned short      * pusReserved2,
  337.                    unsigned long         ulReserved3,
  338.                    unsigned long         ulOpenFlags,          
  339.                    unsigned char       * pbBuffer,             
  340.                    unsigned long         ulBuffer,
  341.                    unsigned long       * pulReturned,
  342.                    unsigned long       * pulTotalAvail );
  343.                                         
  344.  
  345. extern API32_FUNCTION
  346.   Net32AuditWrite ( unsigned short        usType,
  347.                     const unsigned char * pbBuffer,
  348.                     unsigned long         ulBuffer,
  349.                     unsigned char       * pszReserved1,
  350.                     unsigned char       * pszReserved2);
  351.  
  352.  
  353. #endif /* PURE_32 */
  354.  
  355. /* --------------------  End  F2359 --------------------- */
  356.  
  357. /****************************************************************
  358.  *                                                              *
  359.  *          Special values and constants            *
  360.  *                                                              *
  361.  ****************************************************************/
  362.  
  363.  
  364. /*
  365.  *      Audit entry types (field ae_type in audit_entry).
  366.  */
  367.  
  368. #define AE_SRVSTATUS     0
  369. #define AE_SESSLOGON     1
  370. #define AE_SESSLOGOFF    2
  371. #define AE_SESSPWERR     3
  372. #define AE_CONNSTART     4
  373. #define AE_CONNSTOP      5
  374. #define AE_CONNREJ       6
  375. #define AE_RESACCESS     7
  376. #define AE_RESACCESSREJ  8
  377. #define AE_CLOSEFILE     9
  378. #define AE_SERVICESTAT  11
  379. #define AE_ACLMOD       12
  380. #define AE_UASMOD       13
  381. #define AE_NETLOGON     14
  382. #define AE_NETLOGOFF    15
  383. #define AE_NETLOGDENIED 16
  384. #define AE_ACCLIMITEXCD 17
  385. #define AE_RESACCESS2   18
  386. #define AE_ACLMODFAIL   19
  387.  
  388.  
  389. /*
  390.  *    Values for ae_ss_status field of ae_srvstatus.
  391.  */
  392.  
  393. #define AE_SRVSTART     0
  394. #define AE_SRVPAUSED    1
  395. #define AE_SRVCONT      2
  396. #define AE_SRVSTOP      3
  397.  
  398. /*
  399.  *      Values for ae_so_privilege field of ae_sesslogon.
  400.  */
  401.  
  402. #define AE_GUEST        0
  403. #define AE_USER         1
  404. #define AE_ADMIN        2
  405.  
  406. /*
  407.  *      Values for various ae_XX_reason fields.
  408.  */
  409.  
  410. #define AE_NORMAL       0
  411. #define AE_USERLIMIT    0
  412. #define AE_GENERAL      0
  413. #define AE_ERROR        1
  414. #define AE_SESSDIS      1
  415. #define AE_BADPW        1
  416. #define AE_AUTODIS      2
  417. #define AE_UNSHARE      2
  418. #define AE_ADMINPRIVREQD 2
  419. #define AE_ADMINDIS     3
  420. #define AE_NOACCESSPERM 3
  421. #define AE_ACCRESTRICT  4
  422. #define AE_UNDEFINEDUSER   9        /* @P01 */
  423.  
  424. #define    AE_NORMAL_CLOSE 0
  425. #define    AE_SES_CLOSE    1
  426. #define    AE_ADMIN_CLOSE  2
  427.  
  428.  
  429. /*
  430.  * Values for xx_subreason fields.
  431.  */
  432.  
  433. #define AE_LIM_UNKNOWN      0
  434. #define AE_LIM_LOGONHOURS   1
  435. #define AE_LIM_EXPIRED      2
  436. #define AE_LIM_INVAL_WKSTA  3
  437. #define AE_LIM_DISABLED     4
  438. #define AE_LIM_DELETED      5
  439.  
  440.  
  441.  
  442. /*
  443.  * Values for xx_action fields
  444.  */
  445.  
  446. #define AE_MOD          0
  447. #define AE_DELETE       1
  448. #define AE_ADD          2
  449. #define AE_PWSET        9                      /*   @D01A   */
  450.  
  451.  
  452. /*
  453.  * Types of UAS record for um_rectype field
  454.  */
  455.  
  456. #define AE_UAS_USER         0
  457. #define AE_UAS_GROUP        1
  458. #define AE_UAS_MODALS       2
  459.  
  460.  
  461. /*
  462.  * Bitmasks for auditing events
  463.  *
  464.  *  The parentheses around the hex constants broke h_to_inc
  465.  *  and have been purged from the face of the earth.
  466.  */
  467.  
  468. #define SVAUD_SERVICE           0x1
  469. #define SVAUD_GOODSESSLOGON     0x6
  470. #define SVAUD_BADSESSLOGON      0x18
  471. #define SVAUD_SESSLOGON         (SVAUD_GOODSESSLOGON | SVAUD_BADSESSLOGON)
  472. #define SVAUD_GOODNETLOGON      0x60
  473. #define SVAUD_BADNETLOGON       0x180
  474. #define SVAUD_NETLOGON          (SVAUD_GOODNETLOGON | SVAUD_BADNETLOGON)
  475. #define SVAUD_LOGON             (SVAUD_NETLOGON | SVAUD_SESSLOGON)
  476. #define SVAUD_GOODUSE           0x600
  477. #define SVAUD_BADUSE            0x1800
  478. #define SVAUD_USE               (SVAUD_GOODUSE | SVAUD_BADUSE)
  479. #define SVAUD_USERLIST          0x2000
  480. #define SVAUD_PERMISSIONS       0x4000
  481. #define SVAUD_RESOURCE          0x8000
  482. #define SVAUD_LOGONLIM        0x00010000
  483.  
  484.  
  485. /*
  486.  * Resource access audit bitmasks.
  487.  */
  488.  
  489. #define AA_AUDIT_ALL        0x0001
  490. #define AA_A_OWNER        0x0004
  491. #define AA_CLOSE        0x0008
  492. #define AA_S_OPEN        0x0010
  493. #define AA_S_WRITE        0x0020
  494. #define AA_S_CREATE        0x0020
  495. #define AA_S_DELETE        0x0040
  496. #define AA_S_ACL        0x0080
  497. #define AA_S_ALL        ( AA_S_OPEN | AA_S_WRITE | AA_S_DELETE | AA_S_ACL)
  498. #define AA_F_OPEN        0x0100
  499. #define AA_F_WRITE        0x0200
  500. #define AA_F_CREATE        0x0200
  501. #define AA_F_DELETE        0x0400
  502. #define AA_F_ACL        0x0800
  503. #define AA_F_ALL        ( AA_F_OPEN | AA_F_WRITE | AA_F_DELETE | AA_F_ACL)
  504.  
  505. /* Pinball-specific */
  506. #define AA_A_OPEN        0x1000
  507. #define AA_A_WRITE        0x2000
  508. #define AA_A_CREATE        0x2000
  509. #define AA_A_DELETE        0x4000
  510. #define AA_A_ACL        0x8000
  511. #define AA_A_ALL        ( AA_F_OPEN | AA_F_WRITE | AA_F_DELETE | AA_F_ACL)
  512.  
  513.  
  514.  
  515.  
  516.  
  517. #endif /* NETAUDIT_INCLUDED */
  518.  
  519. #if  defined(INCL_32) || defined(MIXED_32)
  520. #pragma linkage (NetAuditClear, far16 pascal)
  521. #pragma linkage (NetAuditOpen, far16 pascal)
  522. #pragma linkage (NetAuditRead, far16 pascal)
  523. #pragma linkage (NetAuditWrite, far16 pascal)
  524. #pragma pack()
  525. #endif
  526.