home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lansystk.zip / INCLUDE / LANSERV / SERVICE.H < prev    next >
C/C++ Source or Header  |  1998-05-08  |  19KB  |  452 lines

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