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