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