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 / SERVICE.H < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-10  |  18.6 KB  |  454 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 ...  SERVICE.H                                  *
  13.  *                                                                  *
  14.  *  This file contains information about the NetService 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.  ********************************************************************/
  27.  
  28.  
  29. #ifdef ANY_32_BIT
  30. #pragma pack(1)
  31. #endif
  32.  
  33.  
  34. #ifndef NETSERVICE_INCLUDED
  35.  
  36. #define NETSERVICE_INCLUDED
  37.  
  38. /****************************************************************
  39.  *                                                              *
  40.  *              Function prototypes                             *
  41.  *                                                              *
  42.  ****************************************************************/
  43.  
  44. extern API_FUNCTION
  45.   NetServiceControl ( const unsigned char LSFAR * pszServer,
  46.                       const unsigned char LSFAR * pszService,
  47.                       unsigned char               fbOpCode,
  48.                       unsigned char               fbArg,
  49.                       unsigned char       LSFAR * pbBuffer,
  50.                       unsigned short              cbBuffer );
  51.  
  52. extern API_FUNCTION
  53.   NetServiceEnum ( const unsigned char LSFAR * pszServer,
  54.                    short                       sLevel,
  55.                    unsigned char       LSFAR * pbBuffer,
  56.                    unsigned short              cbBuffer,
  57.                    unsigned short      LSFAR * pcEntriesRead,
  58.                    unsigned short      LSFAR * pcTotalAvail );
  59.  
  60. extern API_FUNCTION
  61.   NetServiceGetInfo ( const unsigned char LSFAR * pszServer,
  62.                       const unsigned char LSFAR * pszService,
  63.                       short                       sLevel,
  64.                       unsigned char       LSFAR * pbBuffer,
  65.                       unsigned short              cbBuffer,
  66.                       unsigned short      LSFAR * pcbTotalAvail );
  67.  
  68. extern API_FUNCTION
  69.   NetServiceInstall ( const unsigned char LSFAR * pszServer,
  70.                       const unsigned char LSFAR * pszService,
  71.                       const unsigned char LSFAR * pszCmdArgs,
  72.                       unsigned char       LSFAR * pbBuffer,
  73.                       unsigned short              cbBuffer );
  74.  
  75. extern API_FUNCTION
  76.   NetServiceStatus ( const unsigned char LSFAR * pbBuffer,
  77.                      unsigned short              cbBuffer );
  78.  
  79.  
  80. /****************************************************************
  81.  *                                                              *
  82.  *              Data structure templates                        *
  83.  *                                                              *
  84.  ****************************************************************/
  85.  
  86.  
  87. struct service_info_0 {
  88.     unsigned char   svci0_name[SNLEN+1]; /* service name                  */
  89. };      /* service_info_0 */
  90.  
  91. struct service_info_1 {
  92.     unsigned char   svci1_name[SNLEN+1]; /* service name                  */
  93.     unsigned short  svci1_status;        /* See status values below       */
  94.     unsigned long   svci1_code;          /* install code of service       */
  95.     unsigned short  svci1_pid;           /* pid of service program        */
  96. };      /* service_info_1 */
  97.  
  98. struct service_info_2 {
  99.     unsigned char   svci2_name[SNLEN+1];   /* service name                  */
  100.     unsigned short  svci2_status;          /* See status values below       */
  101.     unsigned long   svci2_code;            /* install code of service       */
  102.     unsigned short  svci2_pid;             /* pid of service program        */
  103.     unsigned char   svci2_text[STXTLEN+1]; /* text area for use by services */
  104. };      /* service_info_2 */
  105.  
  106. struct service_status {
  107.     unsigned short  svcs_status;          /* See status values below         */
  108.     unsigned long   svcs_code;            /* install code of service         */
  109.     unsigned short  svcs_pid;             /* pid of service program          */
  110.     unsigned char   svcs_text[STXTLEN+1]; /* text area for use by services   */
  111. };      /* service_status */
  112.  
  113.  
  114. #ifdef PURE_32
  115. /****************************************************************
  116.  *                                                              *
  117.  *              Function prototypes                             *
  118.  *             for "pure" 32-bit code                           *
  119.  *                                                              *
  120.  ****************************************************************/
  121.  
  122. extern API32_FUNCTION
  123.   Net32ServiceControl ( const unsigned char * pszServer,
  124.                         const unsigned char * pszService,
  125.                         unsigned short        usOpcode,     /* was char    */
  126.                         unsigned short        usArg,        /* was char    */
  127.                         unsigned char       * pbBuffer,
  128.                         unsigned long         ulBuffer );   /* was USHORT  */
  129.  
  130. extern API32_FUNCTION
  131.   Net32ServiceEnum ( const unsigned char  * pszServer,
  132.                      unsigned long          ulLevel,        /* was short */
  133.                      unsigned char        * pbBuffer,
  134.                      unsigned long          ulBuffer,       /* was USHORT  */
  135.                      unsigned long        * pulEntriesRead, /* was USHORT  */
  136.                      unsigned long        * pulTotalAvail );/* was PUSHORT */
  137.  
  138. extern API32_FUNCTION
  139.   Net32ServiceGetInfo ( const unsigned char * pszServer,
  140.                         const unsigned char * pszService,
  141.                         unsigned long         ulLevel,      /* was short */
  142.                         unsigned char       * pbBuffer,
  143.                         unsigned long         ulBuffer,        /* was USHORT  */
  144.                         unsigned long       * pulTotalAvail ); /* was PUSHORT */
  145.  
  146. extern API32_FUNCTION
  147.   Net32ServiceInstall ( const unsigned char  * pszServer,
  148.                         const unsigned char  * pszService,
  149.                         const unsigned char  * pszCmdArgs,
  150.                         unsigned char        * pbBuffer,
  151.                         unsigned long          ulBuffer ); /* was USHORT */
  152.  
  153. extern API32_FUNCTION
  154.   Net32ServicePostStatus ( const unsigned char * pbBuffer,
  155.                            unsigned long         ulBuffer );   /* was USHORT */
  156.  
  157.  
  158. extern API32_FUNCTION
  159.   Net32ServiceGetControlInfo (unsigned char * pszReserved,
  160.                               unsigned long   ulLevel,
  161.                               unsigned char * pbBuffer,
  162.                               unsigned long   ulBuffer);
  163.   
  164.  
  165. /****************************************************************
  166.  *                                                              *
  167.  *          Data structure templates, PURE_32 only              *
  168.  *                                                              *
  169.  ****************************************************************/
  170.  
  171. /* Just for safety, define HEV. */
  172. #ifndef __HEV__
  173. typedef ULONG HEV;
  174. #endif
  175. struct service_ctrl_info_0 {
  176.     unsigned short  svc_ctrl0_opcode;      /* service control operation     */
  177.     unsigned short  svc_ctrl0_arg;         /* Additional control data       */
  178.     HEV             svc_ctrl0_sem_handle;  /* Sem handle for control loop   */
  179. };      /* service_ctrl_info_0 */
  180.  
  181. struct service_status_1 {                    
  182.     unsigned short  svcs_status;          /* Same as in service_status       */
  183.     unsigned long   svcs_code;            /* Same as in service_status       */
  184.     unsigned short  svcs_pid;             /* Same as in service_status       */
  185.     unsigned char   svcs_text[STXTLEN+1]; /* Same as in service_status       */
  186.     unsigned long   svcs_flags;           /* Flags for service control, etc. */
  187. };      /* service_status_1 */
  188. #endif /* PURE_32 */
  189.  
  190.  
  191. /****************************************************************
  192.  *                                                              *
  193.  *              Special values and constants                    *
  194.  *                                                              *
  195.  ****************************************************************/
  196.  
  197. /*
  198.  *      SERVICE_RCV_SIG_FLAG is the value passed to DosSetSigHandler when
  199.  *      installing the handler within a service, to receive control
  200.  *      signals.
  201.  */
  202.  
  203. #define SERVICE_RCV_SIG_FLAG 5
  204.  
  205. /*
  206.  *      Flags for the new 32-bit services
  207.  */     
  208. #define SERVICE_CTRL_USES_SEMAPHORE    1
  209.  
  210. /*
  211.  *      Bitmask and bit values for svci1_status, svci2_status, and
  212.  *      svcs_status fields.  For each "subfield", there is a mask
  213.  *      defined, and a number of constants representing the value
  214.  *      obtained by doing (status & mask).
  215.  */
  216.  
  217. /* Bits 0,1 -- general status */
  218.  
  219. #define SERVICE_INSTALL_STATE           0x03
  220. #define SERVICE_UNINSTALLED             0x00
  221. #define SERVICE_INSTALL_PENDING         0x01
  222. #define SERVICE_UNINSTALL_PENDING       0x02
  223. #define SERVICE_INSTALLED               0x03
  224.  
  225. /* Bits 2,3 -- paused/active status */
  226.  
  227. #define SERVICE_PAUSE_STATE             0x0C
  228. #define SERVICE_ACTIVE                  0x00
  229. #define SERVICE_CONTINUE_PENDING        0x04
  230. #define SERVICE_PAUSE_PENDING           0x08
  231. #define SERVICE_PAUSED                  0x0C
  232.  
  233. /* Bit 4 -- uninstallable indication */
  234.  
  235. #define SERVICE_NOT_UNINSTALLABLE       0x00
  236. #define SERVICE_UNINSTALLABLE           0x10
  237.  
  238. /* Bit 5 -- pausable indication */
  239.  
  240. #define SERVICE_NOT_PAUSABLE            0x00
  241. #define SERVICE_PAUSABLE                0x20
  242.  
  243. /* Requester service only:
  244.  * Bits 8,9,10 -- redirection paused/active */
  245.  
  246. #define SERVICE_REDIR_PAUSED            0x700
  247. #define SERVICE_REDIR_DISK_PAUSED       0x100
  248. #define SERVICE_REDIR_PRINT_PAUSED      0x200
  249. #define SERVICE_REDIR_COMM_PAUSED       0x400
  250.  
  251. /*
  252.  *      Standard LAN Manager service names.
  253.  */
  254.  
  255. #define SERVICE_WORKSTATION     "REQUESTER"
  256. #define SERVICE_SERVER          "SERVER"
  257. #define SERVICE_MESSENGER       "MESSENGER"
  258. #define SERVICE_NETRUN          "NETRUN"
  259. #define SERVICE_ALERTER         "ALERTER"
  260. #define SERVICE_NETLOGON        "NETLOGON"
  261. #define SERVICE_NETPOPUP        "NETPOPUP"
  262. #define SERVICE_REPL            "REPLICATOR"
  263. #define SERVICE_DCDBREPL        "DCDBREPL"
  264.  
  265. /*
  266.  *      Additional standard LAN Manager for MS-DOS services
  267.  */
  268.  
  269. #define SERVICE_DOS_ENCRYPTION  "ENCRYPT"
  270.  
  271.  
  272. /*
  273.  *      NetServiceControl opcodes.
  274.  */
  275.  
  276. #define SERVICE_CTRL_INTERROGATE        0
  277. #define SERVICE_CTRL_PAUSE              1
  278. #define SERVICE_CTRL_CONTINUE           2
  279. #define SERVICE_CTRL_UNINSTALL          3
  280.  
  281. /*
  282.  *      Requester service only:  Bits used in the "arg" parameter
  283.  *      to NetServiceControl in conjunction with the opcode
  284.  *      SERVICE_CTRL_PAUSE or SERVICE_CTRL_CONTINUE, to pause or
  285.  *      continue redirection.
  286.  */
  287.  
  288. #define SERVICE_CTRL_REDIR_DISK         0x1
  289. #define SERVICE_CTRL_REDIR_PRINT        0x2
  290. #define SERVICE_CTRL_REDIR_COMM         0x4
  291.  
  292.  
  293. /*
  294.  *      Values for svci1_code, svci2_code, and svcs_code when
  295.  *      status of the service is SERVICE_INSTALL_PENDING or
  296.  *      SERVICE_UNINSTALL_PENDING.
  297.  *      A service can optionally provide a hint to the installer
  298.  *      that the install is proceeding and how long to wait
  299.  *      (in 0.1 second increments) before querying status again.
  300.  */
  301.  
  302. #define SERVICE_IP_NO_HINT              0x0
  303. #define SERVICE_CCP_NO_HINT             0x0
  304.  
  305. #define SERVICE_IP_QUERY_HINT           0x10000
  306. #define SERVICE_CCP_QUERY_HINT          0x10000
  307.  
  308.         /* Mask for install proceeding checkpoint number */
  309. #define SERVICE_IP_CHKPT_NUM            0x0FF
  310. #define SERVICE_CCP_CHKPT_NUM           0x0FF
  311.  
  312.         /* Mask for wait time hint before querying again */
  313. #define SERVICE_IP_WAIT_TIME            0x0FF00
  314. #define SERVICE_CCP_WAIT_TIME           0x0FF00
  315.  
  316.         /* Shift count for building wait time _code values */
  317. #define SERVICE_IP_WAITTIME_SHIFT       8
  318.  
  319.  
  320.  
  321. #define SERVICE_IP_CODE(tt,nn) \
  322.   ((long)SERVICE_IP_QUERY_HINT|(long)(nn|(tt<<SERVICE_IP_WAITTIME_SHIFT)))
  323.  
  324. #define SERVICE_CCP_CODE(tt,nn) \
  325.   ((long)SERVICE_CCP_QUERY_HINT|(long)(nn|(tt<<SERVICE_IP_WAITTIME_SHIFT)))
  326.  
  327. #define SERVICE_UIC_CODE(cc,mm) \
  328.   ((long)(((long)cc<<16)|(long)(unsigned)mm))
  329.  
  330. /***    SERVICE_BASE is the base of service error codes,
  331.  *      chosen to avoid conflict with OS, redirector,
  332.  *      netapi, and errlog codes.
  333.  */
  334.  
  335. #define SERVICE_BASE    3050
  336.  
  337.  
  338.  
  339.  
  340. /*  Uninstall codes, to be used in high byte of 'code' on final NetStatus,
  341.  *  which sets the status to UNINSTALLED
  342.  */
  343.  
  344. #define SERVICE_UIC_NORMAL      0
  345. #define SERVICE_UIC_BADPARMVAL  (SERVICE_BASE + 1) \
  346.         /* IBMLAN.INI or the command line has an illegal value for "%1". */
  347.         /* A IBMLAN.INI entry or what you just typed includes an illegal value for "%1". */
  348. #define SERVICE_UIC_MISSPARM    (SERVICE_BASE + 2) \
  349.         /* The required parameter %1 was not provided on the command line or in IBMLAN.INI. */
  350. #define SERVICE_UIC_UNKPARM     (SERVICE_BASE + 3) \
  351.         /* LAN Manager doesn't recognize "%1" as a valid option.  */
  352. #define SERVICE_UIC_RESOURCE    (SERVICE_BASE + 4) /* A request for %1 resources could not be satisfied. */
  353. #define SERVICE_UIC_CONFIG      (SERVICE_BASE + 5) /* A problem exists with the system configuration:  %1. */
  354. #define SERVICE_UIC_SYSTEM      (SERVICE_BASE + 6) /* A system error has occurred. */
  355. #define SERVICE_UIC_INTERNAL    (SERVICE_BASE + 7) /* An internal consistency error has occurred. */
  356. #define SERVICE_UIC_AMBIGPARM   (SERVICE_BASE + 8) \
  357.         /* IBMLAN.INI or the command line has an ambiguous option: %1. */
  358. #define SERVICE_UIC_DUPPARM     (SERVICE_BASE + 9) \
  359.         /* IBMLAN.INI or the command line has a duplicate parameter: %1. */
  360. #define SERVICE_UIC_KILL        (SERVICE_BASE + 10) \
  361.         /* The service did not respond to control and was stopped with the DosKillProc function.*/
  362. #define SERVICE_UIC_EXEC        (SERVICE_BASE + 11) \
  363.         /* An error occurred when attempting to run the service program. */
  364. #define SERVICE_UIC_SUBSERV     (SERVICE_BASE + 12) \
  365.         /* The sub-service %1 failed to start. */
  366. #define SERVICE_UIC_CONFLPARM   (SERVICE_BASE + 13) \
  367.         /* There is a conflict in the value or use of these options: %1 */
  368. #define SERVICE_UIC_FILE        (SERVICE_BASE + 14) \
  369.         /* There is a problem with the file %1.  %2*/
  370.  
  371.  
  372. /***
  373.  *      The modifiers
  374.  */
  375.  
  376. /*  General: */
  377. #define SERVICE_UIC_M_NULL      0
  378.  
  379. /*  BADPARMVAL:  A text string in service_info_2.text */
  380. /*  MISSPARM:  ditto */
  381. /*  UNKPARM:  ditto */
  382. /*  AMBIGPARM:  ditto */
  383. /*  DUPPARM:  ditto */
  384. /*  SUBSERV:  ditto */
  385.  
  386. /* CONFIG: */
  387. /*  see also 3074 to 3091 */
  388. #define SERVICE_UIC_ADDGR_FAIL  (SERVICE_BASE + 15) /* @E
  389.    NCBAddGroupName failed%0         */
  390. #define SERVICE_UIC_NO_STANDAL  (SERVICE_BASE + 16) /* @E
  391.    Server can not be standalone%0   */
  392. #define SERVICE_UIC_NUMMAILSLOT (SERVICE_BASE + 17) /* @E
  393.    Number of Mailslots must be greater than zero%0 */
  394. /*  RESOURCE: */
  395. #define SERVICE_UIC_M_MEMORY    (SERVICE_BASE + 20) /* @I
  396.         *memory%0 */
  397. #define SERVICE_UIC_M_DISK      (SERVICE_BASE + 21) /* @I
  398.         *disk space%0 */
  399. #define SERVICE_UIC_M_THREADS   (SERVICE_BASE + 22) /* @I
  400.         *thread%0 */
  401. #define SERVICE_UIC_M_PROCESSES (SERVICE_BASE + 23) /* @I
  402.         *process%0 */
  403.  
  404. /*  CONFIG: */
  405. /* 3065 to 3070 is also config error range */
  406. #define SERVICE_UIC_M_SECURITY  (SERVICE_BASE + 24) /* @I
  407.         *Security failure%0 */
  408.  
  409. #define SERVICE_UIC_M_SEC_FILE_ERR (SERVICE_BASE + 28) /* @I
  410.         *The server cannot access the user accounts database (NET.ACC)%0 */
  411. #define SERVICE_UIC_M_FILES     (SERVICE_BASE + 29) /* @I
  412.         *There are incompatible files installed in the LANMAN tree%0 */
  413. #define SERVICE_UIC_M_LOGS      (SERVICE_BASE + 30) /* @I
  414.         *The LANMAN\LOGS directory is invalid%0 */
  415. #define SERVICE_UIC_M_LANGROUP  (SERVICE_BASE + 31) /* @I
  416.         *The domain specified could not be used%0 */
  417. #define SERVICE_UIC_M_MSGNAME   (SERVICE_BASE + 32) /* @I
  418.         *The computername is being used as a message alias on another computer%0 */
  419. #define SERVICE_UIC_M_UAS       (SERVICE_BASE + 34) /* @I
  420.         *The user accounts system isn't configured correctly%0 */
  421. #define SERVICE_UIC_M_SERVER_SEC_ERR (SERVICE_BASE + 35) /* @I
  422.         *The server isn't running with user-level security%0 */
  423. #define SERVICE_UIC_M_WKSTA     (SERVICE_BASE + 37) /* @I
  424.         *The workstation is not configured appropriately%0 */
  425. #define SERVICE_UIC_M_ERRLOG    (SERVICE_BASE + 38) /* @I
  426.         *View your error log for details%0 */
  427. #define SERVICE_UIC_M_ADDPAK    (SERVICE_BASE + 40) /* @I
  428.         *ADDPAK file is corrupt.  Delete LANMAN\NETPROG\ADDPAK.SER and reapply all ADDPAKs%0 */
  429. #define SERVICE_UIC_M_LAZY      (SERVICE_BASE + 41) \
  430.         /* The LM386 server cannot be started because CACHE.EXE is not running%0 */
  431.  
  432.  
  433. /* SYSTEM:  A DOS or NET error number */
  434. /* INTERNAL:  None */
  435. /* KILL:  None */
  436. /* EXEC:  None */
  437.  
  438. /***
  439.  *      End modifiers
  440.  */
  441.  
  442.  
  443.  
  444. #endif /* NETSERVICE_INCLUDED */
  445.  
  446. #if defined(INCL_32) || defined (MIXED_32)
  447. #pragma linkage (NetServiceControl, far16 pascal)
  448. #pragma linkage (NetServiceEnum, far16 pascal)
  449. #pragma linkage (NetServiceGetInfo, far16 pascal)
  450. #pragma linkage (NetServiceInstall, far16 pascal)
  451. #pragma linkage (NetServiceStatus, far16 pascal)
  452. #pragma pack()
  453. #endif
  454.