| 1 |
|
|---|
| 2 | /*
|
|---|
| 3 | *@@sourcefile lan.h:
|
|---|
| 4 | * header file for lan.c. See notes there.
|
|---|
| 5 | *
|
|---|
| 6 | * Note: Version numbering in this file relates to XWorkplace version
|
|---|
| 7 | * numbering.
|
|---|
| 8 | *
|
|---|
| 9 | *@@include #include <os2.h>
|
|---|
| 10 | *@@include #include <netcons.h>
|
|---|
| 11 | *@@include #include "helpers\lan.h"
|
|---|
| 12 | */
|
|---|
| 13 |
|
|---|
| 14 | /*
|
|---|
| 15 | * Copyright (C) 2001 Ulrich Mller.
|
|---|
| 16 | * This file is part of the "XWorkplace helpers" source package.
|
|---|
| 17 | * This is free software; you can redistribute it and/or modify
|
|---|
| 18 | * it under the terms of the GNU General Public License as published
|
|---|
| 19 | * by the Free Software Foundation, in version 2 as it comes in the
|
|---|
| 20 | * "COPYING" file of the XWorkplace main distribution.
|
|---|
| 21 | * This program is distributed in the hope that it will be useful,
|
|---|
| 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 24 | * GNU General Public License for more details.
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 | #if __cplusplus
|
|---|
| 28 | extern "C" {
|
|---|
| 29 | #endif
|
|---|
| 30 |
|
|---|
| 31 | #ifndef LANH_HEADER_INCLUDED
|
|---|
| 32 | #define LANH_HEADER_INCLUDED
|
|---|
| 33 |
|
|---|
| 34 | #ifndef SNLEN
|
|---|
| 35 | #define CNLEN 15 /* Computer name length */
|
|---|
| 36 | #define UNCLEN (CNLEN+2) /* UNC computer name length */
|
|---|
| 37 | #define NNLEN 12 /* 8.3 Net name length */
|
|---|
| 38 | #define RMLEN (UNCLEN+1+NNLEN) /* Maximum remote name length */
|
|---|
| 39 |
|
|---|
| 40 | #define SNLEN 15 /* Service name length */
|
|---|
| 41 | #define STXTLEN 63 /* Service text length */
|
|---|
| 42 | #endif
|
|---|
| 43 |
|
|---|
| 44 | #pragma pack(1)
|
|---|
| 45 |
|
|---|
| 46 | /*
|
|---|
| 47 | *@@ SERVER:
|
|---|
| 48 | *
|
|---|
| 49 | */
|
|---|
| 50 |
|
|---|
| 51 | typedef struct _SERVER
|
|---|
| 52 | {
|
|---|
| 53 | UCHAR achServerName[CNLEN + 1];
|
|---|
| 54 | // server name (without leading \\)
|
|---|
| 55 | UCHAR cVersionMajor; // major version # of net
|
|---|
| 56 | UCHAR cVersionMinor; // minor version # of net
|
|---|
| 57 | ULONG ulServerType; // server type
|
|---|
| 58 | PSZ pszComment; // server comment
|
|---|
| 59 | } SERVER, *PSERVER;
|
|---|
| 60 |
|
|---|
| 61 | /*
|
|---|
| 62 | *@@ SERVICEBUF1:
|
|---|
| 63 | *
|
|---|
| 64 | */
|
|---|
| 65 |
|
|---|
| 66 | typedef struct _SERVICEBUF1 // service_info_1
|
|---|
| 67 | {
|
|---|
| 68 | unsigned char svci1_name[SNLEN+1];
|
|---|
| 69 | unsigned short svci1_status;
|
|---|
| 70 | unsigned long svci1_code;
|
|---|
| 71 | unsigned short svci1_pid;
|
|---|
| 72 | } SERVICEBUF1, *PSERVICEBUF1;
|
|---|
| 73 |
|
|---|
| 74 | /*
|
|---|
| 75 | *@@ SERVICEBUF2:
|
|---|
| 76 | *
|
|---|
| 77 | */
|
|---|
| 78 |
|
|---|
| 79 | typedef struct _SERVICEBUF2 // service_info_2
|
|---|
| 80 | {
|
|---|
| 81 | unsigned char svci2_name[SNLEN+1]; /* service name */
|
|---|
| 82 | unsigned short svci2_status; /* See status values below */
|
|---|
| 83 | unsigned long svci2_code; /* install code of service */
|
|---|
| 84 | unsigned short svci2_pid; /* pid of service program */
|
|---|
| 85 | unsigned char svci2_text[STXTLEN+1]; /* text area for use by services */
|
|---|
| 86 | } SERVICEBUF2, *PSERVICEBUF2;
|
|---|
| 87 |
|
|---|
| 88 | #pragma pack()
|
|---|
| 89 |
|
|---|
| 90 | #ifndef SV_TYPE_ALL
|
|---|
| 91 | #define SV_TYPE_ALL 0xFFFFFFFF /* handy for NetServerEnum2 */
|
|---|
| 92 | #endif
|
|---|
| 93 |
|
|---|
| 94 | #ifndef SERVICE_INSTALL_STATE
|
|---|
| 95 | #define SERVICE_INSTALL_STATE 0x03
|
|---|
| 96 | #define SERVICE_UNINSTALLED 0x00
|
|---|
| 97 | // service stopped (not running)
|
|---|
| 98 | #define SERVICE_INSTALL_PENDING 0x01
|
|---|
| 99 | // service start pending
|
|---|
| 100 | #define SERVICE_UNINSTALL_PENDING 0x02
|
|---|
| 101 | // service stop pending
|
|---|
| 102 | #define SERVICE_INSTALLED 0x03
|
|---|
| 103 | // service started
|
|---|
| 104 |
|
|---|
| 105 | #define SERVICE_PAUSE_STATE 0x0C
|
|---|
| 106 | #define SERVICE_ACTIVE 0x00
|
|---|
| 107 | // service active (not paused)
|
|---|
| 108 | #define SERVICE_CONTINUE_PENDING 0x04
|
|---|
| 109 | // service continue pending
|
|---|
| 110 | #define SERVICE_PAUSE_PENDING 0x08
|
|---|
| 111 | // service pause pending
|
|---|
| 112 | #define SERVICE_PAUSED 0x0C
|
|---|
| 113 | // service paused
|
|---|
| 114 |
|
|---|
| 115 | #define SERVICE_NOT_UNINSTALLABLE 0x00
|
|---|
| 116 | // service cannot be stopped
|
|---|
| 117 | #define SERVICE_UNINSTALLABLE 0x10
|
|---|
| 118 | // service can be stopped
|
|---|
| 119 |
|
|---|
| 120 | #define SERVICE_NOT_PAUSABLE 0x00
|
|---|
| 121 | // service cannot be paused
|
|---|
| 122 | #define SERVICE_PAUSABLE 0x20
|
|---|
| 123 | // service can be paused
|
|---|
| 124 |
|
|---|
| 125 | /* Requester service only:
|
|---|
| 126 | * Bits 8,9,10 -- redirection paused/active */
|
|---|
| 127 |
|
|---|
| 128 | #define SERVICE_REDIR_PAUSED 0x700
|
|---|
| 129 | #define SERVICE_REDIR_DISK_PAUSED 0x100
|
|---|
| 130 | // redirector for disks paused
|
|---|
| 131 | #define SERVICE_REDIR_PRINT_PAUSED 0x200
|
|---|
| 132 | // redirector for spooled devices paused
|
|---|
| 133 | #define SERVICE_REDIR_COMM_PAUSED 0x400
|
|---|
| 134 | // redirector for serial devices paused
|
|---|
| 135 |
|
|---|
| 136 | #define SERVICE_CTRL_INTERROGATE 0
|
|---|
| 137 | #define SERVICE_CTRL_PAUSE 1
|
|---|
| 138 | #define SERVICE_CTRL_CONTINUE 2
|
|---|
| 139 | #define SERVICE_CTRL_UNINSTALL 3
|
|---|
| 140 | #endif
|
|---|
| 141 |
|
|---|
| 142 | APIRET lanInit(VOID);
|
|---|
| 143 |
|
|---|
| 144 | APIRET lanQueryServers(PSERVER *paServers,
|
|---|
| 145 | ULONG *pcServers);
|
|---|
| 146 |
|
|---|
| 147 | APIRET lanServiceGetInfo(PCSZ pcszServiceName,
|
|---|
| 148 | PSERVICEBUF2 pBuf);
|
|---|
| 149 |
|
|---|
| 150 | APIRET lanServiceInstall(PCSZ pcszServiceName,
|
|---|
| 151 | PSERVICEBUF2 pBuf2);
|
|---|
| 152 |
|
|---|
| 153 | APIRET lanServiceControl(PCSZ pcszServiceName,
|
|---|
| 154 | ULONG opcode,
|
|---|
| 155 | PSERVICEBUF2 pBuf2);
|
|---|
| 156 | #endif
|
|---|
| 157 |
|
|---|
| 158 | #if __cplusplus
|
|---|
| 159 | }
|
|---|
| 160 | #endif
|
|---|
| 161 |
|
|---|