home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / detk45he.zip / SERVICE.H < prev    next >
C/C++ Source or Header  |  1999-04-29  |  19KB  |  442 lines

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