home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / header45.zip / chardev.h < prev    next >
C/C++ Source or Header  |  1999-04-29  |  15KB  |  346 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.  *  About this file ...  CHARDEV.H                                  *
  14.  *                                                                  *
  15.  *  This file contains information about the NetCharDev             *
  16.  *  and NetHandle class 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.  *         This file is always included by LAN.H.                   *
  29.  *                                                                  *
  30.  ********************************************************************/
  31.  
  32.  
  33. /****************************************************************
  34.  *                                                              *
  35.  *              Character Device Class                          *
  36.  *                                                              *
  37.  ****************************************************************/
  38.  
  39. #if (defined( INCL_NETCHARDEV ) || !defined( LAN_INCLUDED )) \
  40.     && !defined( NETCHARDEV_INCLUDED )
  41.  
  42. #define NETCHARDEV_INCLUDED
  43.  
  44. #ifdef ANY_32_BIT
  45. #pragma pack(1)
  46. #endif
  47.  
  48.  
  49. /****************************************************************
  50.  *                                                              *
  51.  *              Function prototypes - CHARDEV                   *
  52.  *                                                              *
  53.  ****************************************************************/
  54.  
  55. extern API_FUNCTION
  56.   NetCharDevControl ( const unsigned char LSFAR * pszServer,
  57.                       const unsigned char LSFAR * pszDevName,
  58.                       short                       sOpCode );
  59.  
  60. extern API_FUNCTION
  61.   NetCharDevEnum ( const unsigned char LSFAR *     pszServer,
  62.                    short                           sLevel,
  63.                    unsigned char LSFAR *           pbBuffer,
  64.                    unsigned short                  cbBuffer,
  65.                    unsigned short LSFAR *          pcEntriesRead,
  66.                    unsigned short LSFAR *          pcTotalAvail );
  67.  
  68. extern API_FUNCTION
  69.   NetCharDevGetInfo ( const unsigned char LSFAR *     pszServer,
  70.                       const unsigned char LSFAR *     pszDevName,
  71.                       short                           sLevel,
  72.                       unsigned char LSFAR *           pbBuffer,
  73.                       unsigned short                  cbBuffer,
  74.                       unsigned short LSFAR *          pcbTotalAvail );
  75.  
  76. extern API_FUNCTION
  77.   NetCharDevQEnum ( const unsigned char LSFAR *     pszServer,
  78.                     const unsigned char LSFAR *     pszUserName,
  79.                     short                           sLevel,
  80.                     unsigned char LSFAR *           pbBuffer,
  81.                     unsigned short                  cbBuffer,
  82.                     unsigned short LSFAR *          pcEntriesRead,
  83.                     unsigned short LSFAR *          pcTotalAvail );
  84.  
  85. extern API_FUNCTION
  86.   NetCharDevQGetInfo ( const unsigned char LSFAR *     pszServer,
  87.                        const unsigned char LSFAR *     pszQueueName,
  88.                        const unsigned char LSFAR *     pszUserName,
  89.                        short                           sLevel,
  90.                        unsigned char LSFAR *           pbBuffer,
  91.                        unsigned short                  cbBuffer,
  92.                        unsigned short LSFAR *          pcbTotalAvail );
  93.  
  94. extern API_FUNCTION
  95.   NetCharDevQSetInfo ( const unsigned char LSFAR * pszServer,
  96.                        const unsigned char LSFAR * pszQueueName,
  97.                        short                       sLevel,
  98.                        const unsigned char LSFAR * pbBuffer,
  99.                        unsigned short              cbBuffer,
  100.                        short                       sParmNum );
  101.  
  102. extern API_FUNCTION
  103.   NetCharDevQPurge ( const unsigned char LSFAR * pszServer,
  104.                      const unsigned char LSFAR * pszQueueName );
  105.  
  106. extern API_FUNCTION
  107.   NetCharDevQPurgeSelf ( const unsigned char LSFAR * pszServer,
  108.                          const unsigned char LSFAR * pszQueueName,
  109.                          const unsigned char LSFAR * pszComputerName );
  110.  
  111. /****************************************************************
  112.  *                                                              *
  113.  *              Data structure templates - CHARDEV              *
  114.  *                                                              *
  115.  ****************************************************************/
  116.  
  117. struct chardev_info_0 {
  118.     unsigned char          ch0_dev[DEVLEN+1];  /* device name                       */
  119. };      /* chardev_info_0 */
  120.  
  121. struct chardev_info_1 {
  122.     unsigned char  ch1_dev[DEVLEN+1]; /* device name                        */
  123.     unsigned char  ch1_pad1;          /* pad to a word boundary             */
  124.     unsigned short ch1_status;        /* status                             */
  125.                                       /*   bit 0 reserved                   */
  126.                                       /*   bit 1 on = opened                */
  127.                                       /*   bit 1 off = idle                 */
  128.                                       /*   bit 2 on = error                 */
  129.                                       /*   bit 2 off = no error             */
  130.     unsigned char  ch1_username[UNLEN+1]; /* name of device's current user  */
  131.     unsigned char  ch1_pad2;          /* pad to a word boundary             */
  132.     unsigned long  ch1_time;          /* time current user attached         */
  133. }; /* chardev_info_1 */
  134.  
  135.  
  136. struct chardevQ_info_0 {
  137.     unsigned char          cq0_dev[NNLEN+1];   /* queue name (network name)         */
  138. }; /* chardevQ_info_0 */
  139.  
  140. struct chardevQ_info_1 {
  141.     unsigned char               cq1_dev[NNLEN+1];  /* queue name (network name)     */
  142.     unsigned char               cq1_pad;           /* pad to a word boundary      */
  143.     unsigned short              cq1_priority;      /* priority (1 - 9)             */
  144.     unsigned char LSFAR * LSPTR cq1_devs;          /* names of devices assigned to queue */
  145.     unsigned short              cq1_numusers;      /* # of users waiting in queue        */
  146.     unsigned short              cq1_numahead;      /* # of users in queue ahead of this  */
  147.                                                    /*     user. -1 is returned if the    */
  148.                                                    /*     user is not in the queue.      */
  149. }; /* chardevQ_info_1 */
  150.  
  151.  
  152.  
  153. #ifdef PURE_32
  154. /****************************************************************
  155.  *                                                              *
  156.  *              Function prototypes - CHARDEV                   *
  157.  *                                                              *
  158.  ****************************************************************/
  159.  
  160. extern API32_FUNCTION
  161. Net32CharDevControl ( const unsigned char * pszServer,
  162.                       const unsigned char * pszDevName,
  163.                       unsigned long         ulOpCode );   /*was signed short*/
  164.  
  165. extern API32_FUNCTION
  166. Net32CharDevEnum ( const unsigned char * pszServer,
  167.                    unsigned long         ulLevel,         /*was signed short*/
  168.                    unsigned char       * pbBuffer,
  169.                    unsigned long         ulBuffer,        /*was USHORT*/
  170.                    unsigned long       * pulEntriesRead,  /*was USHORT*/
  171.                    unsigned long       * pulTotalAvail ); /*was USHORT*/
  172.  
  173. extern API32_FUNCTION
  174. Net32CharDevGetInfo ( const unsigned char * pszServer,
  175.                       const unsigned char * pszDevName,
  176.                       unsigned long         ulLevel,        /*was signed short*/
  177.                       unsigned char       * pbBuffer,
  178.                       unsigned long         ulBuffer,        /*was USHORT*/
  179.                       unsigned long       * pulTotalAvail ); /*was USHORT*/
  180.  
  181. extern API32_FUNCTION
  182. Net32CharDevQEnum ( const unsigned char * pszServer,
  183.                     const unsigned char * pszUserName,
  184.                     unsigned long         ulLevel,          /*was signed short*/
  185.                     unsigned char       * pbBuffer,
  186.                     unsigned long         ulBuffer,          /*was USHORT*/
  187.                     unsigned long       * pulEntriesRead,    /*was USHORT*/
  188.                     unsigned long       * pulTotalAvail );   /*was USHORT*/
  189.  
  190. extern API32_FUNCTION
  191. Net32CharDevQGetInfo ( const unsigned char * pszServer,
  192.                        const unsigned char * pszQueueName,
  193.                        const unsigned char * pszUserName,
  194.                        unsigned long         ulLevel,       /*was signed short*/
  195.                        unsigned char       * pbBuffer,
  196.                        unsigned long         ulBuffer,       /*was USHORT*/
  197.                        unsigned long       * pulTotalAvail); /*was USHORT*/
  198.  
  199. extern API32_FUNCTION
  200. Net32CharDevQSetInfo ( const unsigned char * pszServer,
  201.                        const unsigned char * pszQueueName,
  202.                        unsigned long         ulLevel,     /*was signed short*/
  203.                        const unsigned char * pbBuffer,
  204.                        unsigned long         ulBuffer,    /*was USHORT*/
  205.                        unsigned long         ulParmNum ); /*was signed short*/
  206.  
  207. extern API32_FUNCTION
  208. Net32CharDevQPurge ( const unsigned char * pszServer,
  209.                      const unsigned char * pszQueueName );
  210.  
  211. extern API32_FUNCTION
  212. Net32CharDevQPurgeSelf ( const unsigned char * pszServer,
  213.                          const unsigned char * pszQueueName,
  214.                          const unsigned char * pszComputerName );
  215. #endif /* PURE_32 */
  216.  
  217.  
  218. /****************************************************************
  219.  *                                                              *
  220.  *              Special values and constants - CHARDEV          *
  221.  *                                                              *
  222.  ****************************************************************/
  223.  
  224. /*
  225.  *      Bits for chardev_info_1 field ch1_status.
  226.  */
  227.  
  228. #define CHARDEV_STAT_OPENED             0x02
  229. #define CHARDEV_STAT_ERROR              0x04
  230.  
  231. /*
  232.  *      Opcodes for NetCharDevControl
  233.  */
  234.  
  235. #define CHARDEV_CLOSE                   0
  236.  
  237. /*
  238.  *      Values for parmnum parameter to NetCharDevQSetInfo.
  239.  */
  240.  
  241. #define CHARDEVQ_PRIORITY_PARMNUM       2
  242. #define CHARDEVQ_DEVICES_PARMNUM        3
  243.  
  244.  
  245. /*
  246.  *      Minimum, maximum, and recommended default for priority.
  247.  */
  248.  
  249. #define CHARDEVQ_MAX_PRIORITY           1
  250. #define CHARDEVQ_MIN_PRIORITY           9
  251. #define CHARDEVQ_DEF_PRIORITY           5
  252.  
  253. /*
  254.  *      Value indicating no requests in the queue.
  255.  */
  256.  
  257. #define CHARDEVQ_NO_REQUESTS            -1
  258.  
  259.  
  260. #ifdef ANY_32_BIT
  261. #pragma pack()
  262. #endif
  263. #endif /* NETCHARDEV_INCLUDED */
  264.  
  265. /****************************************************************
  266.  *                                                              *
  267.  *              Handle Class                                    *
  268.  *                                                              *
  269.  ****************************************************************/
  270.  
  271. #if (defined( INCL_NETHANDLE ) || !defined( LAN_INCLUDED )) \
  272.     && !defined( NETHANDLE_INCLUDED )
  273.  
  274. #define NETHANDLE_INCLUDED
  275.  
  276. #ifdef ANY_32_BIT
  277. #pragma pack(1)
  278. #endif
  279.  
  280.  
  281. /****************************************************************
  282.  *                                                              *
  283.  *              Function prototypes - HANDLE                    *
  284.  *                                                              *
  285.  ****************************************************************/
  286.  
  287. extern API_FUNCTION
  288.   NetHandleGetInfo ( unsigned short         hHandle,
  289.                      short                  sLevel,
  290.                      unsigned char LSFAR *           pbBuffer,
  291.                      unsigned short         cbBuffer,
  292.                      unsigned short LSFAR * pcbTotalAvail );
  293.  
  294. extern API_FUNCTION
  295.   NetHandleSetInfo ( unsigned short hHandle,
  296.                      short          sLevel,
  297.                      unsigned char LSFAR *   pbBuffer,
  298.                      unsigned short cbBuffer,
  299.                      unsigned short sParmNum );
  300.  
  301.  
  302. /****************************************************************
  303.  *                                                              *
  304.  *              Data structure templates - HANDLE               *
  305.  *                                                              *
  306.  ****************************************************************/
  307.  
  308. struct handle_info_1 {
  309.         unsigned long   hdli1_chartime; /* time in msec to wait before send */
  310.         unsigned short  hdli1_charcount; /* max size of send buffer */
  311. }; /* handle_info_1 */
  312.  
  313. struct handle_info_2 {
  314.       unsigned char LSFAR * LSPTR hdli2_username;  /* owner of name-pipe handle */
  315. }; /* handle_info_2 */
  316.  
  317.  
  318. /****************************************************************
  319.  *                                                              *
  320.  *              Special values and constants - HANDLE           *
  321.  *                                                              *
  322.  ****************************************************************/
  323.  
  324.  
  325. /*
  326.  *      Handle Get Info Levels
  327.  */
  328.  
  329. #define HANDLE_INFO_LEVEL_1             1
  330. #define HANDLE_INFO_LEVEL_2             2
  331.  
  332.  
  333. /*
  334.  *      Handle Set Info    parm numbers
  335.  */
  336.  
  337. #define HANDLE_SET_CHAR_TIME            1
  338. #define HANDLE_SET_CHAR_COUNT           2
  339.  
  340.  
  341. #ifdef ANY_32_BIT
  342. #pragma pack()
  343. #endif
  344.  
  345. #endif /* NETHANDLE_INCLUDED */
  346.