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