Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

261 lines
9.3 KiB

  1. /*----------------------------------------------------------------------------
  2. moscl.h
  3. Header for MOS client side API
  4. Copyright (C) 1993 Microsoft Corporation
  5. All rights reserved.
  6. Authors:
  7. Phillich Philippe Choquier
  8. History:
  9. 08/12/93 Phillich Created.
  10. --------------------------------------------------------------------------*/
  11. #if !defined(_MOSCL_DEFINED)
  12. #include <servdefs.h>
  13. #include <mostpc.h>
  14. #if defined(__cplusplus)
  15. extern "C" {
  16. #endif
  17. #if !defined(MOSDllImport)
  18. #if defined(WIN32)
  19. #define MOSDllImport(a) __declspec( dllimport ) a
  20. #define MOSDllExport(a) __declspec( dllexport ) a
  21. #else
  22. #define MOSDllExport(a) a __export
  23. #define MOSDllImport(a) a __import
  24. #endif
  25. #endif
  26. #if !defined(_MHANDLE_DEFINED)
  27. typedef WORD MHANDLE;
  28. typedef WORD HMCONNECT;
  29. typedef HMCONNECT *PHMCONNECT;
  30. typedef WORD HMSESSION;
  31. typedef HMSESSION *PHMSESSION;
  32. typedef WORD HMPIPE;
  33. typedef HMPIPE *PHMPIPE;
  34. #define _MHANDLE_DEFINED
  35. #endif
  36. #define INVALID_MOS_HANDLE_VALUE ((MHANDLE)0xffff)
  37. #define MOS_IO_ERROR 0xffff
  38. #define MOS_WRITE_PENDING 0xfffffffe
  39. typedef struct _MC_CONNECT_CB {
  40. WORD cSizeStructure;
  41. WORD Type;
  42. DWORD ComPort;
  43. DWORD BaudRate;
  44. DWORD dwOptions;
  45. WORD SpeakerMode;
  46. WORD wReserved;
  47. } MC_CONNECT_CB;
  48. // for dwOptions
  49. #define MOS_CONNECT_DISABLE_DATA_COMPRESSION 1
  50. #define MOS_CONNECT_DISABLE_ERROR_CORRECTION 2
  51. #define MOS_CONNECT_LAUNCH_LIGHTS 4
  52. #define MOS_DONT_SET_DCEDTE_SPEED 8
  53. enum MOS_SPEAKERMODE { MOS_SPEAKERALWAYSOFF, MOS_SPEAKERONUNTILCONNECT, MOS_SPEAKERALWAYSON, MOS_SPEAKEROFFWHILEDIALING };
  54. enum MOS_CONNECT_TYPE {
  55. MOS_CONNECT_MODEM,
  56. MOS_CONNECT_ISDN,
  57. MOS_CONNECT_PIPE,
  58. MOS_CONNECT_EICON,
  59. MOS_CONNECT_EXISTING,
  60. MOS_CONNECT_INVALID,
  61. MOS_CONNECT_UDP,
  62. MOS_CONNECT_TAPI,
  63. MOS_CONNECT_TCP
  64. } ;
  65. enum MOS_EVENT {
  66. EVENT_BUSY,
  67. EVENT_NOCARRIER,
  68. EVENT_CONNECTED,
  69. EVENT_NODIALTONE,
  70. EVENT_USER_CLOSED,
  71. EVENT_START_RECEIVE_DATA,
  72. EVENT_END_RECEIVE_DATA,
  73. EVENT_START_XMIT_DATA,
  74. EVENT_END_XMIT_DATA,
  75. EVENT_CRC_ERROR,
  76. EVENT_CONNECTION_DROPPED,
  77. EVENT_WRITE_ERROR,
  78. EVENT_NO_EVENT,
  79. EVENT_DATALINK,
  80. EVENT_SPEED_1200,
  81. EVENT_SPEED_2400,
  82. EVENT_SPEED_4800,
  83. EVENT_SPEED_9600,
  84. EVENT_SPEED_12000,
  85. EVENT_SPEED_14400,
  86. EVENT_SPEED_16800,
  87. EVENT_SPEED_19200,
  88. EVENT_SPEED_21600,
  89. EVENT_SPEED_24400,
  90. EVENT_SPEED_26400,
  91. EVENT_SPEED_28800,
  92. EVENT_SPEED_57600,
  93. EVENT_OPEN_ERROR, // can't open communication device
  94. EVENT_SPEED,
  95. EVENT_UNREACHABLE_NETWORK_ADDRESS,
  96. EVENT_ACTIVE,
  97. EVENT_CAUSE_TOO_MANY_RCV_ERROR,
  98. EVENT_CAUSE_TOO_MANY_XM_ERROR,
  99. EVENT_PAD_DISCONNECT,
  100. EVENT_CAUSE_UNAVAIL,
  101. EVENT_SVCCONNECT_DONE,
  102. EVENT_RAS_AUTH_START,
  103. EVENT_RAS_AUTH_FAILED,
  104. EVENT_RAS_ERROR,
  105. EVENT_RAS_DIALSTART_PRIMARY,
  106. EVENT_RAS_DIALSTART_BACKUP,
  107. EVENT_TCPINSTALL_ERROR,
  108. EVENT_TCPCONNECT_START,
  109. EVENT_TCPCONNECT_RETRY,
  110. EVENT_TCPCONNECT_FAILED,
  111. EVENT_DNSLOOKUP,
  112. EVENT_DNSLOOKUP_FAILED,
  113. EVENT_LOCKEDACCOUNT,
  114. EVENT_INVALIDPASSWORD,
  115. EVENT_PPPRANDOMFAILURE,
  116. EVENT_RAS_REMOTE_DISCONNECTION,
  117. EVENT_RAS_NOCARRIER,
  118. EVENT_RAS_BADTCPCONFIG,
  119. EVENT_PROXYCONNECT_START,
  120. EVENT_PROXYCONNECT_FAILED,
  121. EVENT_PROXYAUTH_START,
  122. EVENT_PROXYAUTH_FAILED,
  123. EVENT_PROXY_DISCOVERY_START,
  124. EVENT_PROXY_DISCOVERY_FAILED,
  125. EVENT_PROXY_ALTCONNECT_START,
  126. EVENT_PROXY_RESOURCE_FAILURE,
  127. EVENT_PROXY_GENERIC_FAILURE,
  128. EVENT_PROXY_PROTOCOL_MISMATCH,
  129. EVENT_PROXY_BAD_SETTINGS,
  130. EVENT_PROXY_BAD_VERSION,
  131. EVENT_PPP_TIMEOUT,
  132. } ;
  133. #define SERVER_NAME_MAX_LEN (30)
  134. #define SERVICE_NAME_MAX_LEN (256)
  135. #define IPADDRESS_MAX_LEN (30)
  136. #define MOSCL_ATTACH_TIMEOUT (15 * 1000)
  137. #define MOSADDR_CANONIC 1
  138. #define MOSADDR_DIALABLE 2
  139. #define MOSADDR_WANADDR 3
  140. #define MOSADDR_CARRIERID 4
  141. #define MOSADDR_COUNTRYCODE 5
  142. #define MOSADDR_AREACODE 6
  143. #define MOSADDR_MODEMNAME 7
  144. #define MOSADDR_CONNECTMODE 8
  145. // Maximum Message Size
  146. #define MSI_MAXMSGSIZE (12*1024)
  147. #define GMS_MAXMSGSIZE 1
  148. #define GMS_LEVEL2TIMEOUT 2
  149. typedef void (CALLBACK *MC_CONNECT_NOTIFY)(LPVOID, HMCONNECT, WORD, DWORD);
  150. typedef void (CALLBACK *MP_READ_NOTIFY)(LPVOID, HMPIPE, DWORD);
  151. typedef void (CALLBACK *MP_WRITE_NOTIFY)(LPVOID, HMPIPE, LPVOID, DWORD);
  152. typedef void (CALLBACK *MP_OPEN_NOTIFY)(LPVOID, HMPIPE, WORD );
  153. #if defined(WIN32)
  154. MOSDllExport(BOOL WINAPI) InitMOS( HINSTANCE, WORD );
  155. #else
  156. MOSDllExport(BOOL WINAPI) InitMOS( HINSTANCE );
  157. #endif
  158. MOSDllExport(BOOL WINAPI) TerminateMOS();
  159. MOSDllExport(WORD WINAPI) GetMOSConnectionStatus(HMCONNECT);
  160. MOSDllExport(HMCONNECT WINAPI) OpenMOSConnection(LPSTR,MC_CONNECT_NOTIFY,LPVOID,MC_CONNECT_CB FAR*);
  161. MOSDllExport(BOOL WINAPI) CloseMOSConnection(HMCONNECT);
  162. MOSDllExport(HMSESSION WINAPI) OpenMOSSession(HMCONNECT, LPSTR);
  163. MOSDllExport(HMSESSION WINAPI) OpenMOSSessionEx(HMCONNECT, LPSTR, SERVICE_VERSION );
  164. MOSDllExport(BOOL WINAPI) CloseMOSSession(HMSESSION);
  165. MOSDllExport(HMPIPE WINAPI) OpenMOSPipe(HMSESSION, LPSTR);
  166. MOSDllExport(HMPIPE WINAPI) OpenMOSPipeEx(HMSESSION, LPSTR, LPSTR);
  167. MOSDllExport(BOOL WINAPI) CloseMOSPipe(HMPIPE);
  168. MOSDllExport(DWORD WINAPI) ReadMOSPipe(HMPIPE, LPVOID, DWORD, WORD);
  169. MOSDllExport(DWORD WINAPI) WriteMOSPipe(HMPIPE, LPVOID, LPVOID, DWORD, BOOL);
  170. MOSDllExport(MP_READ_NOTIFY WINAPI) SetMOSPipeReadNotify(HMPIPE, MP_READ_NOTIFY, LPVOID);
  171. MOSDllExport(MP_WRITE_NOTIFY WINAPI) SetMOSPipeWriteNotify(HMPIPE, MP_WRITE_NOTIFY);
  172. MOSDllExport(WORD WINAPI) GetMOSLastError(HMCONNECT);
  173. MOSDllExport(DWORD WINAPI) GetMOSPipeReadSize(HMPIPE hmp, WORD );
  174. MOSDllExport(DWORD WINAPI) GetMOSSysInfo( HMCONNECT hmC, WORD wType );
  175. MOSDllExport(HMPIPE WINAPI) OpenMOSPipeWithNotify(HMSESSION hms, LPSTR Name,
  176. LPSTR Param, MP_READ_NOTIFY r, LPVOID u,
  177. MP_WRITE_NOTIFY );
  178. MOSDllExport(HMPIPE WINAPI) OpenMOSPipeWithNotifyEx(HMSESSION hms, LPSTR Name,
  179. LPSTR Param, MP_READ_NOTIFY r, LPVOID u,
  180. MP_WRITE_NOTIFY, SERVICE_VERSION sv );
  181. MOSDllExport(HMPIPE WINAPI) OpenMOSPipeWithNotifyAndTimeoutEx(HMSESSION hms, LPSTR Name,
  182. LPSTR Param, MP_READ_NOTIFY r, LPVOID u,
  183. MP_WRITE_NOTIFY, SERVICE_VERSION sv, DWORD dwT, MP_OPEN_NOTIFY pON );
  184. #define OpenMOSPipeWithReadNotify(a,b,c,d,e) OpenMOSPipeWithNotify(a,b,c,d,e,NULL)
  185. #if defined(__cplusplus)
  186. }
  187. #endif
  188. // MOS error values
  189. #define MOSERROR_FAILED (-1) // operation failed (reason unknown).
  190. #define MOSERROR_SUCCESS (0) // operation successful.
  191. #define MOSERROR_TIMEOUT (1)
  192. #define MOSERROR_IO_PENDING (2) // Overlapped IO operation in progress.
  193. #define MOSERROR_IO_BUSY (3) // Synchronous operation in progress.
  194. #define MOSERROR_INVALID_CONNECTION_HANDLE (4)
  195. #define MOSERROR_INVALID_SESSION_HANDLE (5)
  196. #define MOSERROR_INVALID_PIPE_HANDLE (6)
  197. #define MOSERROR_PIPE_IS_CLOSING (7)
  198. #define MOSERROR_OPENING_ARENA (8) // An error occured while trying to OpenSharedArena().
  199. #define MOSERROR_ASYNC_WRITE_NO_CALLBACK (9) // Cannot perform async write without first defining a callback function.
  200. #define MOSERROR_ARENA_NOTHING_DURING_READ (10) // A call to GetFirstFromList() returned ARENA_NOTHING.
  201. #define MOSERROR_ADDTOLIST_RET_FALSE (11) // A call to AddToList() returned FALSE for some reason.
  202. #define MOSERROR_PIPE_NOT_FOUND (12)
  203. //#define MOSERROR_BUFFER_TOO_SMALL (13) // The specified buffer was too small for the data to be returned in.
  204. //#define MOSERROR_SERVICE_NOT_FOUND (14) // The specified Service could not be found.
  205. //#define MOSERROR_OVERLAPPED_BUFFERS (15) // One or more of the specified buffers are overlapped.
  206. //#define MOSERROR_RPC_FAILED (16) // An RPC call failed.
  207. //#define MOSERROR_BILLING_DOWNLOAD_ALREADY_ACTIVE (17) // Can't start download session event when existing session in progress.
  208. //#define MOSERROR_BILLING_DOWNLOAD_NOT_ACTIVE (18) // Can't ask for next or prev event when no download in progress.
  209. //#define MOSERROR_BILLING_DOWNLOAD_INVALID_HANDLE (19) // An invalid download session handle was specified.
  210. //#define MOSERROR_BILLING_DOWNLOAD_INVALID_COMMAND (20) // An invalid download command was specified.
  211. //#define MOSERROR_ERROR_ACCESSING_LOGFILE (21) // There was an error accessing the billing logfile.
  212. #define MOSERROR_MSGSIZETOOBIG (22) // Message Size Too Big for WriteMOSPipe.
  213. //#define MOSERROR_ERROR_SERIALIZING (23) // An error occurred while a C++ object attempted to serialize itself.
  214. //#define MOSERROR_ERROR_DESERIALIZING (24) // An error occurred while a C++ object attempted to deserialize itself.
  215. #define MOSERROR_INVALID_CONNECTION_TYPE (25) // InitMOS() & OpenMOSConnection mismatch
  216. #define MOSERROR_MORE_DATA (26) // Fitting # of logs are returned in the buffer, but more data is available still.
  217. #define MOSERROR_INVALID_PARAMETER (27)
  218. #define MOSERROR_OUT_OF_RESOURCE (28)
  219. #define MOSERROR_ATTACH_REJECT (29)
  220. #define MOSERROR_NO_ACCESS (30)
  221. #define MOSERROR_LOCATE_REJECT (31)
  222. #define MOSERROR_SERVER_REJECT (32)
  223. #define MOSERROR_SERVICE_VERSION_MISMATCH (33)
  224. #define MOSERROR_TOO_MANY_PIPES (34)
  225. #define MOSERROR_PIPE_IS_NOTOPENED (35)
  226. #define MOSERROR_NO_ACCESS_ON_TOLL_FREE (36)
  227. #define MOSERROR_GET_RIGHTS_TIMEOUT (37)
  228. #define _MOSCL_DEFINED
  229. #endif