/packages/palmunits/src/inetmgr.pp

https://github.com/slibre/freepascal · Puppet · 964 lines · 836 code · 128 blank · 0 comment · 18 complexity · b0b5c70f20453f4ab24db4f44df330bb MD5 · raw file

  1. {$MACRO ON}
  2. (******************************************************************************
  3. *
  4. * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries.
  5. * All rights reserved.
  6. *
  7. * File: INetMgr.h
  8. *
  9. * Release: Palm OS SDK 4.0 (63220)
  10. *
  11. * Description:
  12. * This header file contains equates for the Internet Library.
  13. *
  14. * History:
  15. * 6/2/97 Created by Ron Marianetti
  16. * 12/23/99 Fix <> vs. "" problem. (jmp)
  17. *
  18. *****************************************************************************)
  19. unit inetmgr;
  20. interface
  21. uses palmos, libtraps, errorbase, datamgr, systemresources, event_;
  22. // Creator. Used for both the database that contains the INet Library and
  23. // it's features for the feature manager.
  24. const
  25. inetCreator = sysFileCINetLib; // The Net Library creator
  26. // INet Library features have this creator
  27. inetLibFtrCreator = sysFileCINetLib; // creatorID of INet Lib features.
  28. // Name of the InetLib
  29. inetLibName = 'INet.lib'; // pass in to SysLibFind()
  30. // Feature inetCreator, #0 is index of the the version number feature.
  31. // The Feature creator is inetLibFtrCreator.
  32. // Encoding is: 0xMMmfsbbb, where MM is major version, m is minor version
  33. // f is bug fix, s is stage: 3-release,2-beta,1-alpha,0-development,
  34. // bbb is build number for non-releases
  35. // V1.12b3 would be: 0x01122003
  36. // V2.00a2 would be: 0x02001002
  37. // V1.01 would be: 0x01013000
  38. inetFtrNumVersion = 0;
  39. // INetLib owns the Ctp device bits feature.
  40. // Those bits contains device specific info bits that are sent to the Elaine server.
  41. // See Ctp.h for the bit descriptions
  42. inetFtrNumCtpDeviceBits1 = 1;
  43. inetLibType = sysFileTLibrary; // Our Net Code Resources Database type
  44. // ID for proxy IP address in flash
  45. inetFlashProxyID = 'IP';
  46. inetDefaultFlashProxyID = 'DP';
  47. //Also uses mobitexNetworkIdUS and mobitexNetworkIdCanada (0xb433 and 0xc4d7) to store
  48. //current proxies for US and Canada. The responsibility for writing these and keeping
  49. //them in sync lies with the Wireless panel, not with netlib.
  50. //-----------------------------------------------------------------------------
  51. // IP addresses of Elaine servers - used for default wireless proxies
  52. //-----------------------------------------------------------------------------
  53. netProxyIPManhattanHGA = $0A0186A5; // Manhattan HGA = 10.1.134.165 or MAN 100005
  54. netProxyIPDefaultHGA = netProxyIPManhattanHGA;
  55. netProxyIPDefaultHGAStr = '10.1.134.165'; // Should correspond to above value
  56. (********************************************************************
  57. * Error codes
  58. ********************************************************************)
  59. inetErrNone = 0;
  60. inetErrTooManyClients = inetErrorClass or 1; // Too many clients already
  61. inetErrHandleInvalid = inetErrorClass or 2; // Invalid inetH or sockH
  62. inetErrParamsInvalid = inetErrorClass or 3;
  63. inetErrURLVersionInvalid = inetErrorClass or 4;
  64. inetErrURLBufTooSmall = inetErrorClass or 5;
  65. inetErrURLInvalid = inetErrorClass or 6;
  66. inetErrTooManySockets = inetErrorClass or 7;
  67. inetErrNoRequestCreated = inetErrorClass or 8;
  68. inetErrNotConnected = inetErrorClass or 9;
  69. inetErrInvalidRequest = inetErrorClass or 10;
  70. inetErrNeedTime = inetErrorClass or 11;
  71. inetErrHostnameInvalid = inetErrorClass or 12;
  72. inetErrInvalidPort = inetErrorClass or 13;
  73. inetErrInvalidHostAddr = inetErrorClass or 14;
  74. inetErrNilBuffer = inetErrorClass or 15;
  75. inetErrConnectTimeout = inetErrorClass or 16;
  76. inetErrResolveTimeout = inetErrorClass or 17;
  77. inetErrSendReqTimeout = inetErrorClass or 18;
  78. inetErrReadTimeout = inetErrorClass or 19;
  79. inetErrBufTooSmall = inetErrorClass or 20;
  80. inetErrSchemeNotSupported = inetErrorClass or 21;
  81. inetErrInvalidResponse = inetErrorClass or 22;
  82. inetErrSettingTooLarge = inetErrorClass or 25;
  83. inetErrSettingSizeInvalid = inetErrorClass or 26;
  84. inetErrRequestTooLong = inetErrorClass or 27;
  85. inetErrSettingNotImplemented = inetErrorClass or 28;
  86. // Configuration errors
  87. inetErrConfigNotFound = inetErrorClass or 29;
  88. inetErrConfigCantDelete = inetErrorClass or 30;
  89. inetErrConfigTooMany = inetErrorClass or 31;
  90. inetErrConfigBadName = inetErrorClass or 32;
  91. inetErrConfigNotAlias = inetErrorClass or 33;
  92. inetErrConfigCantPointToAlias = inetErrorClass or 34;
  93. inetErrConfigEmpty = inetErrorClass or 35;
  94. inetErrConfigAliasErr = inetErrorClass or 37;
  95. inetErrNoWirelessInterface = inetErrorClass or 38;
  96. // Encryption related errors
  97. inetErrEncryptionNotAvail = inetErrorClass or 39;
  98. // Need to re-send transaction because server told us to reset our
  99. // encryption sequence number
  100. inetErrNeedRetryEncSeqNum = inetErrorClass or 40;
  101. // Need to re-send transaction because server sent us a new
  102. // public key to use.
  103. inetErrNeedRetryEncPublicKey = inetErrorClass or 41;
  104. inetErrResponseTooShort = inetErrorClass or 42;
  105. // errors specific to handling Mobitex ILLEGAL responses
  106. inetErrMobitexIllegalOKHost = inetErrorClass or 43;
  107. inetErrMobitexIllegalBadHost = inetErrorClass or 44;
  108. // see error 92 also
  109. // HTTP errors
  110. inetErrHTTPBadRequest = inetErrorClass or 45;
  111. inetErrHTTPUnauthorized = inetErrorClass or 46;
  112. inetErrHTTPForbidden = inetErrorClass or 47;
  113. inetErrHTTPNotFound = inetErrorClass or 48;
  114. inetErrHTTPMethodNotAllowed = inetErrorClass or 49;
  115. inetErrHTTPNotAcceptable = inetErrorClass or 50;
  116. inetErrHTTPProxyAuthRequired = inetErrorClass or 51;
  117. inetErrHTTPRequestTimeout = inetErrorClass or 52;
  118. inetErrHTTPConflict = inetErrorClass or 53;
  119. inetErrHTTPGone = inetErrorClass or 54;
  120. inetErrHTTPLengthRequired = inetErrorClass or 55;
  121. inetErrHTTPPreconditionFailed = inetErrorClass or 56;
  122. inetErrHTTPRequestTooLarge = inetErrorClass or 57;
  123. inetErrHTTPRequestURITooLong = inetErrorClass or 58;
  124. inetErrHTTPUnsupportedType = inetErrorClass or 59;
  125. inetErrHTTPServerError = inetErrorClass or 60;
  126. // CTP errors
  127. inetErrCTPServerError = inetErrorClass or 61;
  128. // Cache errors
  129. inetErrTypeNotCached = inetErrorClass or 62;
  130. inetErrCacheInvalid = inetErrorClass or 63;
  131. // Palm: and PalmCall: scheme errors
  132. inetErrURLDispatched = inetErrorClass or 64;
  133. inetErrDatabaseNotFound = inetErrorClass or 65;
  134. inetErrCTPMalformedRequest = inetErrorClass or 66;
  135. inetErrCTPUnknownCommand = inetErrorClass or 67;
  136. inetErrCTPTruncated = inetErrorClass or 68;
  137. inetErrCTPUnknownError = inetErrorClass or 69;
  138. inetErrCTPProxyError = inetErrorClass or 70;
  139. inetErrCTPSocketErr = inetErrorClass or 71;
  140. inetErrCTPInvalidURL = inetErrorClass or 72;
  141. inetErrCTPReferringPageOutOfDate = inetErrorClass or 73;
  142. inetErrCTPBadRequest = inetErrorClass or 74;
  143. inetErrUNUSED = inetErrorClass or 75;
  144. inetErrCTPMailServerDown = inetErrorClass or 76;
  145. inetErrCTPHostNotFound = inetErrorClass or 77;
  146. // Content Conversion Errors
  147. inetErrCTPContentInvalidTag = inetErrorClass or 78;
  148. inetErrCTPContentInternal = inetErrorClass or 79;
  149. inetErrCTPContentDataEnd = inetErrorClass or 80;
  150. inetErrCTPContentResourceTooBig = inetErrorClass or 81;
  151. inetErrCTPContentNoNoFrames = inetErrorClass or 82;
  152. inetErrCTPContentUnsupportedContent = inetErrorClass or 83;
  153. inetErrCTPContentUnsupportedEncoding = inetErrorClass or 84;
  154. inetErrCTPContentBadForm = inetErrorClass or 85;
  155. inetErrCTPContentBadFormMissingAction = inetErrorClass or 86;
  156. inetErrCTPContentBadFormMissingMethod = inetErrorClass or 87;
  157. inetErrCTPContentNoSourceData = inetErrorClass or 88;
  158. inetErrCTPContentBadImage = inetErrorClass or 89;
  159. inetErrCTPContentImageTooLarge = inetErrorClass or 90;
  160. // Mobitex illegal handled error code. This error is sent after
  161. //INetLib handles inetErrMobitexIllegalOKHost or inetErrMobitexIllegalBadHost
  162. //errors. The application needs to know that something went wrong and it needs
  163. //to change state. This error does not need to be displayed to the user.
  164. inetErrMobitexErrorHandled = inetErrorClass or 91;
  165. // Proxy down, non-default host, show dialog asking to revert to default
  166. inetErrProxyDownBadHost = inetErrorClass or 92;
  167. // A second type of readtime. This should occur only when some data is received
  168. // and the connection is lost.
  169. inetErrHostConnectionLost = inetErrorClass or 93;
  170. // Unable to locate link record within a PQA file
  171. inetErrLinkNotFound = inetErrorClass or 94;
  172. inetErrCacheInvalidSort = inetErrorClass or 95;
  173. // The following are used and bit field parameters to the sort routine. They
  174. // are additive but ordered. Precendence is given to the lowest ordered bit.
  175. inetCacheCompareByMasterURL = $01;
  176. inetCacheCompareByURL = $02;
  177. inetCacheCompareByTime = $04;
  178. (********************************************************************
  179. * Input flags
  180. ********************************************************************)
  181. //-----------------------------------------------------------------------------
  182. // flag word definitions for INetLibURLOpen
  183. //-----------------------------------------------------------------------------
  184. inetOpenURLFlagLookInCache = $0001;
  185. inetOpenURLFlagKeepInCache = $0002;
  186. inetOpenURLFlagForceEncOn = $0008; // use encryption even if
  187. // scheme does not desire it
  188. inetOpenURLFlagForceEncOff = $0010; // no encryption even if
  189. // scheme desires it
  190. //-----------------------------------------------------------------------------
  191. // flag word definitions for INetURLInfo. These flags bits are set in the
  192. // flags field of the INetURLINfoType structure by INetLibURLGetInfo()
  193. //-----------------------------------------------------------------------------
  194. inetURLInfoFlagIsSecure = $0001;
  195. inetURLInfoFlagIsRemote = $0002;
  196. inetURLInfoFlagIsInCache = $0004;
  197. (********************************************************************
  198. * Configuration Support
  199. ********************************************************************)
  200. //-----------------------------------------------------------------------------
  201. // Names of built-in configuration aliases available through the
  202. // INetLibConfigXXX calls
  203. //-----------------------------------------------------------------------------
  204. inetCfgNameDefault = '.Default'; // The default configuration
  205. inetCfgNameDefWireline = '.DefWireline'; // The default wireline configuration
  206. inetCfgNameDefWireless = '.DefWireless'; // The default wireless configuration
  207. inetCfgNameCTPDefault = '.CTPDefault'; // Points to either .CTPWireline or .CTPWireless
  208. inetCfgNameCTPWireline = '.CTPWireline'; // Wireline through the Jerry Proxy
  209. inetCfgNameCTPWireless = '.CTPWireless'; // Wireless through the Jerry Proxy
  210. //--------------------------------------------------------------------
  211. // Structure of a configuration name. Used by INetLibConfigXXX calls
  212. //---------------------------------------------------------------------
  213. const
  214. inetConfigNameSize = 32;
  215. type
  216. INetConfigNameType = record
  217. name: array [0..inetConfigNameSize-1] of Char; // name of configuration
  218. end;
  219. INetConfigNamePtr = ^INetConfigNameType;
  220. (********************************************************************
  221. * Scheme Types
  222. ********************************************************************)
  223. type
  224. INetSchemeEnum = WordEnum; //!!!
  225. const
  226. inetSchemeUnknown = -1;
  227. inetSchemeDefault = 0;
  228. inetSchemeHTTP = Succ(inetSchemeDefault); // http:
  229. inetSchemeHTTPS = Succ(inetSchemeHTTP); // https:
  230. inetSchemeFTP = Succ(inetSchemeHTTPS); // ftp:
  231. inetSchemeGopher = Succ(inetSchemeFTP); // gopher:
  232. inetSchemeFile = Succ(inetSchemeGopher); // file:
  233. inetSchemeNews = Succ(inetSchemeFile); // news:
  234. inetSchemeMailTo = Succ(inetSchemeNews); // mailto:
  235. inetSchemePalm = Succ(inetSchemeMailTo); // palm:
  236. inetSchemePalmCall = Succ(inetSchemePalm); // palmcall:
  237. inetSchemeMail = Succ(inetSchemePalmCall); // not applicable to URLS, but used
  238. // for the INetLibSockOpen call when
  239. // creating a socket for mail IO
  240. inetSchemeMac = Succ(inetSchemeMail); // mac: - Mac file system HTML
  241. inetSchemeFirst = inetSchemeHTTP; // first one
  242. inetSchemeLast = inetSchemeMail; // last one
  243. (********************************************************************
  244. * Scheme Ports
  245. ********************************************************************)
  246. const
  247. inetPortFTP = 21;
  248. inetPortHTTP = 80;
  249. inetPortGopher = 70;
  250. inetPortNews = 119;
  251. inetPortHTTPS = 44;
  252. (********************************************************************
  253. * Structure of a cracked URL.
  254. ********************************************************************)
  255. type
  256. INetURLType = record
  257. version: UInt16; // should be 0, for future compatibility
  258. schemeP: ^UInt8; // ptr to scheme portion
  259. schemeLen: UInt16; // size of scheme portion
  260. schemeEnum: UInt16; // INetSchemEnum
  261. usernameP: ^UInt8; // ptr to username portion
  262. usernameLen: UInt16; // size of username
  263. passwordP: ^UInt8; // ptr to password portion
  264. passwordLen: UInt16; // size of password
  265. hostnameP: ^UInt8; // ptr to host name portion
  266. hostnameLen: UInt16; // size of host name
  267. port: UInt16; // port number
  268. pathP: ^UInt8; // ptr to path portion
  269. pathLen: UInt16; // size of path
  270. paramP: ^UInt8; // param (;param)
  271. paramLen: UInt16; // size of param
  272. queryP: ^UInt8; // query (?query)
  273. queryLen: UInt16; // size of query
  274. fragP: ^UInt8; // fragment (#frag)
  275. fragLen: UInt16; // size of fragment
  276. end;
  277. (********************************************************************
  278. * Structure for INetURLInfo. This structure is filled in with info
  279. * about a URL.
  280. ********************************************************************)
  281. type
  282. INetURLInfoType = record
  283. version: UInt16; // should be 0, for future compatibility
  284. flags: UInt16; // flags word, one or ore of
  285. // inetURLInfoFlagXXX flags
  286. undefined: UInt32; // reserved for future use
  287. end;
  288. (********************************************************************
  289. * Content and Compression Type Enums(from proxy server or PQA Builder)
  290. ********************************************************************)
  291. type
  292. INetContentTypeEnum = Enum;
  293. const
  294. inetContentTypeTextPlain = 0;
  295. inetContentTypeTextHTML = Succ(inetContentTypeTextPlain);
  296. inetContentTypeImageGIF = Succ(inetContentTypeTextHTML);
  297. inetContentTypeImageJPEG = Succ(inetContentTypeImageGIF);
  298. inetContentTypeApplicationCML = Succ(inetContentTypeImageJPEG);
  299. inetContentTypeImagePalmOS = Succ(inetContentTypeApplicationCML);
  300. inetContentTypeOthe = Succ(inetContentTypeImagePalmOS);
  301. type
  302. INetCompressionTypeEnum = Enum;
  303. const
  304. inetCompressionTypeNone = 0;
  305. inetCompressionTypeBitPacked = Succ(inetCompressionTypeNone);
  306. inetCompressionTypeLZ77 = Succ(inetCompressionTypeBitPacked);
  307. inetCompressionTypeBest = Succ(inetCompressionTypeLZ77);
  308. inetCompressionTypeLZ77Primer1 = Succ(inetCompressionTypeBest);
  309. (********************************************************************
  310. * Proxy Types
  311. ********************************************************************)
  312. type
  313. INetProxyEnum = Enum;
  314. const
  315. inetProxyNone = 0; // no proxy
  316. inetProxyCTP = 1; // CTP (Jerry) proxy
  317. (********************************************************************
  318. * Transport Types
  319. ********************************************************************)
  320. type
  321. INetTransportEnum = Enum;
  322. const
  323. inetTransportPPP = 0; // PPP
  324. inetTransportMobitex = 1; // Mobitex
  325. (********************************************************************
  326. * Settings for the INetLibSettingSet/Get call.
  327. ********************************************************************)
  328. type
  329. INetSettingEnum = Enum;
  330. const
  331. inetSettingProxyType = 0; // (RW) UInt32, INetProxyEnum
  332. inetSettingProxyName = Succ(inetSettingProxyType); // (RW) Char[], name of proxy
  333. inetSettingProxyPort = Succ(inetSettingProxyName); // (RW) UInt32, TCP port # of proxy
  334. inetSettingProxySocketType = Succ(inetSettingProxyPort); // (RW) UInt32, which type of socket to use
  335. // netSocketTypeXXX
  336. inetSettingCacheSize = Succ(inetSettingProxySocketType); // (RW) UInt32, max size of cache
  337. inetSettingCacheRef = Succ(inetSettingCacheSize); // (R) DmOpenRef, ref of cache DB
  338. inetSettingNetLibConfig = Succ(inetSettingCacheRef); // (RW) UInt32, Which NetLib config to use.
  339. inetSettingRadioID = Succ(inetSettingNetLibConfig); // (R) UInt32[2], the 64-bit radio ID
  340. inetSettingBaseStationID = Succ(inetSettingRadioID); // (R) UInt32, the radio base station ID
  341. inetSettingMaxRspSize = Succ(inetSettingBaseStationID); // (W) UInt32 (in bytes)
  342. inetSettingConvAlgorithm = Succ(inetSettingMaxRspSize); // (W) UInt32 (CTPConvEnum)
  343. inetSettingContentWidth = Succ(inetSettingConvAlgorithm); // (W) UInt32 (in pixels)
  344. inetSettingContentVersion = Succ(inetSettingContentWidth); // (W) UInt32 Content version (encoder version)
  345. inetSettingNoPersonalInfo = Succ(inetSettingContentVersion); // (RW) UInt32 send no deviceID/zipcode
  346. inetSettingUserName = Succ(inetSettingNoPersonalInfo);
  347. //---------------------------------------------------------------------------------
  348. // New Settings as of PalmOS 4.0
  349. //---------------------------------------------------------------------------------
  350. inetSettingGraphicsSel = Succ(inetSettingUserName); // (W) UInt8 (User Graphics selection)
  351. inetSettingTransportType = Succ(inetSettingGraphicsSel); // (RW) UInt32, INetTransportEnum
  352. inetSettingServerBits1 = Succ(inetSettingTransportType); // (RW) UInt32, bits sent by the server over ctp
  353. inetSettingSendRawLocationInfo = Succ(inetSettingServerBits1); // (W) Boolean, make the handheld send its Raw Location information.
  354. // One use of this feature is to convert Web clipping's "%Location:..." codes into content info
  355. inetSettingEnableCookies = Succ(inetSettingSendRawLocationInfo); // (RW) Boolean
  356. // true: Cookies are enabled
  357. // false: Cookies are disabled (default)
  358. inetSettingMaxCookieJarSize = Succ(inetSettingEnableCookies);
  359. // (RW) UInt32, maximum cookie jar size in
  360. // in kilobytes
  361. // The following setting is a new interface in PalmOS 4.0 that allow Clipper
  362. // or other INetLib clients to get raw location information as described in
  363. // PalmLocRawData.h.
  364. // INetLib will return a pointer to a newly allocated memory buffer containing
  365. // the raw location information to send to Elaine (Web Clipping proxy server).
  366. // Elaine will then use a Windows DLL to analyse the raw location information
  367. // in order to transform it into something useful like zipcode, cityname, etc.
  368. // See PalmLocRawData.h for more details...
  369. inetSettingLocRawInfo = Succ(inetSettingMaxCookieJarSize); // (R) void* Allocated memory buffer - must be free by caller
  370. // The following affect how the "Web Clipping" panel will edit the
  371. // configuration. When "reset to default" is pressed, these default
  372. // values will be copied back into the appropriate place.
  373. // If the field is set to not be editable, the panel will not allow
  374. // the user to change it
  375. inetSettingProxyNameDefault = Succ(inetSettingLocRawInfo); // Default Name for this config
  376. inetSettingProxyPortDefault = Succ(inetSettingProxyNameDefault); // Default Port for this config
  377. inetSettingProxyNameEditable = Succ(inetSettingProxyPortDefault); // Is the proxy name editable?
  378. inetSettingProxyPortEditable = Succ(inetSettingProxyNameEditable); // Is the proxy port editable?
  379. inetSettingPalmUserID = Succ(inetSettingProxyPortEditable); // The palm.net user id
  380. inetSettingLast = Succ(inetSettingPalmUserID);
  381. (********************************************************************
  382. * Settings for the INetLibSockSettingSet/Get call.
  383. ********************************************************************)
  384. type
  385. INetSockSettingEnum = Enum;
  386. const
  387. inetSockSettingScheme = 0; // (R) UInt32, INetSchemeEnum
  388. inetSockSettingSockContext = Succ(inetSockSettingScheme); // (RW) UInt32,
  389. inetSockSettingCompressionType = Succ(inetSockSettingSockContext); // (R) Char[]
  390. inetSockSettingCompressionTypeID = Succ(inetSockSettingCompressionType); // (R) UInt32 (INetCompressionTypeEnum)
  391. inetSockSettingContentType = Succ(inetSockSettingCompressionTypeID); // (R) Char[]
  392. inetSockSettingContentTypeID = Succ(inetSockSettingContentType); // (R) UInt32 (INetContentTypeEnum)
  393. inetSockSettingData = Succ(inetSockSettingContentTypeID); // (R) UInt32, pointer to data
  394. inetSockSettingDataHandle = Succ(inetSockSettingData); // (R) UInt32, MemHandle to data
  395. inetSockSettingDataOffset = Succ(inetSockSettingDataHandle); // (R) UInt32, offset to data from MemHandle
  396. inetSockSettingTitle = Succ(inetSockSettingDataOffset); // (RW) Char[]
  397. inetSockSettingURL = Succ(inetSockSettingTitle); // (R) Char[]
  398. inetSockSettingIndexURL = Succ(inetSockSettingURL); // (RW) Char[]
  399. inetSockSettingFlags = Succ(inetSockSettingIndexURL); // (W) UInt16, one or more of
  400. // inetOpenURLFlagXXX flags
  401. inetSockSettingReadTimeout = Succ(inetSockSettingFlags); // (RW) UInt32. Read timeout in ticks
  402. inetSockSettingContentVersion = Succ(inetSockSettingReadTimeout); // (R) UInt32, version number for content
  403. inetSockSettingLast = Succ(inetSockSettingContentVersion);
  404. (********************************************************************
  405. * Possible socket status values that can be returned from INetLibSockStatus
  406. ********************************************************************)
  407. type
  408. INetStatusEnum = Enum;
  409. const
  410. inetStatusNew = 0; // just opened
  411. inetStatusResolvingName = Succ(inetStatusNew); // looking up host address
  412. inetStatusNameResolved = Succ(inetStatusResolvingName); // found host address
  413. inetStatusConnecting = Succ(inetStatusNameResolved); // connecting to host
  414. inetStatusConnected = Succ(inetStatusConnecting); // connected to host
  415. inetStatusSendingRequest = Succ(inetStatusConnected); // sending request
  416. inetStatusWaitingForResponse = Succ(inetStatusSendingRequest); // waiting for response
  417. inetStatusReceivingResponse = Succ(inetStatusWaitingForResponse); // receiving response
  418. inetStatusResponseReceived = Succ(inetStatusReceivingResponse); // response received
  419. inetStatusClosingConnection = Succ(inetStatusResponseReceived); // closing connection
  420. inetStatusClosed = Succ(inetStatusClosingConnection); // closed
  421. inetStatusAcquiringNetwork = Succ(inetStatusClosed); // network temporarily
  422. // unreachable; socket on hold
  423. inetStatusPrvInvalid = 30; // internal value, not
  424. // returned by INetMgr. Should
  425. // be last.
  426. (********************************************************************
  427. * HTTP Attributes which can be set/get using the
  428. * INetLibHTTPAttrSet/Get calls.
  429. *
  430. * Generally, attributes are only set BEFORE calling
  431. * INetLibSockHTTPReqSend
  432. * and attributes are only gotten AFTER the complete response
  433. * has been received.
  434. *
  435. * Attributes marked with the following flags:
  436. * (R) - read only
  437. * (W) - write only
  438. * (RW) - read/write
  439. * (-) - not implemented yet
  440. ********************************************************************)
  441. type
  442. INetHTTPAttrEnum = Enum;
  443. const
  444. // local error trying to communicate with server, if any
  445. inetHTTPAttrCommErr = 0; // (R) UInt32, read-only
  446. // object attributes, defined at creation
  447. inetHTTPAttrEntityURL = Succ(inetHTTPAttrCommErr); // (-) Char[], which resource was requested
  448. //-----------------------------------------------------------
  449. // Request only attributes
  450. //-----------------------------------------------------------
  451. inetHTTPAttrReqAuthorization = Succ(inetHTTPAttrEntityURL); // (-) Char[]
  452. inetHTTPAttrReqFrom = Succ(inetHTTPAttrReqAuthorization); // (-) Char[]
  453. inetHTTPAttrReqIfModifiedSince = Succ(inetHTTPAttrReqFrom); // (-) UInt32
  454. inetHTTPAttrReqReferer = Succ(inetHTTPAttrReqIfModifiedSince); // (-) Char[]
  455. // The following are ignored unless going through a CTP proxy
  456. inetHTTPAttrWhichPart = Succ(inetHTTPAttrReqReferer); // (W) UInt32 (0 -> N)
  457. inetHTTPAttrIncHTTP = Succ(inetHTTPAttrWhichPart); // (W) UInt32 (Boolean) only applicable
  458. // when inetHTTPAttrConvAlgorithm set to
  459. // ctpConvNone
  460. inetHTTPAttrCheckMailHi = Succ(inetHTTPAttrIncHTTP); // (W) UInt32
  461. inetHTTPAttrCheckMailLo = Succ(inetHTTPAttrCheckMailHi); // (W) UInt32
  462. inetHTTPAttrReqContentVersion = Succ(inetHTTPAttrCheckMailLo); // (W) UInt32 Desired content version. Represented
  463. // as 2 low bytes. Lowest byte is minor version,
  464. // next higher byte is major version.
  465. //--------------------------------------------------------------
  466. // Response only attributes
  467. //--------------------------------------------------------------
  468. // Server response info
  469. inetHTTPAttrRspAll = Succ(inetHTTPAttrReqContentVersion); // (-) Char[] - entire HTTP response including
  470. // data
  471. inetHTTPAttrRspSize = Succ(inetHTTPAttrRspAll); // (R) UInt32 - entire HTTP Response size including
  472. // header and data
  473. inetHTTPAttrRspVersion = Succ(inetHTTPAttrRspSize); // (-) Char[]
  474. inetHTTPAttrResult = Succ(inetHTTPAttrRspVersion); // (R) UInt32 (ctpErrXXX when using CTP Proxy)
  475. inetHTTPAttrErrDetail = Succ(inetHTTPAttrResult); // (R) UInt32 (server/proxy err code when
  476. // using CTP Proxy)
  477. inetHTTPAttrReason = Succ(inetHTTPAttrErrDetail); // (R) Char[]
  478. inetHTTPAttrDate = Succ(inetHTTPAttrReason); // (-) UInt32
  479. inetHTTPAttrNoCache = Succ(inetHTTPAttrDate); // (-) UInt32
  480. inetHTTPAttrPragma = Succ(inetHTTPAttrNoCache); // (-) Char[]
  481. inetHTTPAttrServer = Succ(inetHTTPAttrPragma); // (-) Char[]
  482. inetHTTPAttrWWWAuthentication = Succ(inetHTTPAttrServer); // (-) Char[]
  483. // Returned entity attributes
  484. inetHTTPAttrContentAllow = Succ(inetHTTPAttrWWWAuthentication); // (-) Char[]
  485. inetHTTPAttrContentLength = Succ(inetHTTPAttrContentAllow); // (R) UInt32
  486. inetHTTPAttrContentLengthUncompressed = Succ(inetHTTPAttrContentLength); // (R) UInt32 (in bytes)
  487. inetHTTPAttrContentPtr = Succ(inetHTTPAttrContentLengthUncompressed); // (-) Char *
  488. inetHTTPAttrContentExpires = Succ(inetHTTPAttrContentPtr); // (-) UInt32
  489. inetHTTPAttrContentLastModified = Succ(inetHTTPAttrContentExpires); // (-) UInt32
  490. inetHTTPAttrContentLocation = Succ(inetHTTPAttrContentLastModified); // (-) Char[]
  491. inetHTTPAttrContentLengthUntruncated = Succ(inetHTTPAttrContentLocation); // (R) UInt32
  492. inetHTTPAttrContentVersion = Succ(inetHTTPAttrContentLengthUntruncated); // (R) UInt32, actual content version. Represented
  493. // as 2 low bytes. Lowest byte is minor version,
  494. // next higher byte is major version.
  495. inetHTTPAttrContentCacheID = Succ(inetHTTPAttrContentVersion); // (R) UInt32, cacheID for this item
  496. inetHTTPAttrReqSize = Succ(inetHTTPAttrContentCacheID); // (R) UInt32 size of request sent
  497. (********************************************************************
  498. * Structure of our Internet events. This structure is a superset of
  499. * the regular event type. Note that we use the first 2 user events
  500. * for the Internet Library so any app that uses this library must be
  501. * to use user event IDs greater than inetLastEvent.
  502. *
  503. * library refNum in it....
  504. ********************************************************************)
  505. const
  506. inetSockReadyEvent = firstINetLibEvent;
  507. inetSockStatusChangeEvent = firstINetLibEvent + 1;
  508. inetLastEvent = firstINetLibEvent + 1;
  509. type
  510. generic = record
  511. datum: array [0..7] of UInt16;
  512. end;
  513. inetSockReady = record
  514. sockH: MemHandle; // socket MemHandle
  515. context: UInt32; // application defined
  516. inputReady: Boolean; // true if ready for reads
  517. outputReady: Boolean; // true if ready for writes
  518. end;
  519. inetSockStatusChange = record
  520. sockH: MemHandle; // socket MemHandle
  521. context: UInt32; // application defined
  522. status: UInt16; // new status
  523. sockErr: Err; // socket err, if any
  524. end;
  525. INetEventType = record
  526. eType: UInt16;
  527. penDown: Boolean;
  528. reserved: UInt8;
  529. screenX: Int16;
  530. screenY: Int16;
  531. case Integer of
  532. 0: (generic: generic);
  533. 1: (inetSockReady: inetSockReady);
  534. 2: (inetSockStatusChange: inetSockStatusChange);
  535. end;
  536. (********************************************************************
  537. * Commands for INetLibWirelessIndicatorCmd (and INetLibWiCmd)
  538. ********************************************************************)
  539. type
  540. WiCmdEnum = Enum;
  541. const
  542. wiCmdInit = 0;
  543. wiCmdClear = Succ(wiCmdInit);
  544. wiCmdSetEnabled = Succ(wiCmdClear);
  545. wiCmdDraw = Succ(wiCmdSetEnabled);
  546. wiCmdEnabled = Succ(wiCmdDraw);
  547. wiCmdSetLocation = Succ(wiCmdEnabled);
  548. wiCmdEras = Succ(wiCmdSetLocation);
  549. (********************************************************************
  550. * INet Library functions.
  551. ********************************************************************)
  552. type
  553. INetLibTrapNumberEnum = Enum;
  554. const
  555. inetLibTrapSettingGet = sysLibTrapCustom;
  556. inetLibTrapSettingSet = Succ(inetLibTrapSettingGet);
  557. inetLibTrapGetEvent = Succ(inetLibTrapSettingSet);
  558. inetLibTrapURLOpen = Succ(inetLibTrapGetEvent);
  559. inetLibTrapSockRead = Succ(inetLibTrapURLOpen);
  560. inetLibTrapSockWrite = Succ(inetLibTrapSockRead);
  561. inetLibTrapSockOpen = Succ(inetLibTrapSockWrite);
  562. inetLibTrapSockClose = Succ(inetLibTrapSockOpen);
  563. inetLibTrapSockStatus = Succ(inetLibTrapSockClose);
  564. inetLibTrapSockSettingGet = Succ(inetLibTrapSockStatus);
  565. inetLibTrapSockSettingSet = Succ(inetLibTrapSockSettingGet);
  566. inetLibTrapSockConnect = Succ(inetLibTrapSockSettingSet);
  567. // Utilities
  568. inetLibTrapURLCrack = Succ(inetLibTrapSockConnect);
  569. inetLibTrapURLsAdd = Succ(inetLibTrapURLCrack);
  570. inetLibTrapURLsCompare = Succ(inetLibTrapURLsAdd);
  571. inetLibTrapURLGetInfo = Succ(inetLibTrapURLsCompare);
  572. // HTTP calls
  573. inetLibTrapSockHTTPReqCreate = Succ(inetLibTrapURLGetInfo);
  574. inetLibTrapSockHTTPAttrSet = Succ(inetLibTrapSockHTTPReqCreate);
  575. inetLibTrapSockHTTPReqSend = Succ(inetLibTrapSockHTTPAttrSet);
  576. inetLibTrapSockHTTPAttrGet = Succ(inetLibTrapSockHTTPReqSend);
  577. // Mail traps
  578. inetLibTrapSockMailReqCreate = Succ(inetLibTrapSockHTTPAttrGet);
  579. inetLibTrapSockMailAttrSet = Succ(inetLibTrapSockMailReqCreate);
  580. inetLibTrapSockMailReqAdd = Succ(inetLibTrapSockMailAttrSet);
  581. inetLibTrapSockMailReqSend = Succ(inetLibTrapSockMailReqAdd);
  582. inetLibTrapSockMailAttrGet = Succ(inetLibTrapSockMailReqSend);
  583. inetLibTrapSockMailQueryProgress = Succ(inetLibTrapSockMailAttrGet);
  584. // Cache calls
  585. inetLibTrapCacheList = Succ(inetLibTrapSockMailQueryProgress);
  586. inetLibTrapCacheGetObject = Succ(inetLibTrapCacheList);
  587. // Config calls
  588. inetLibConfigMakeActive_ = Succ(inetLibTrapCacheGetObject);
  589. inetLibConfigList_ = Succ(inetLibConfigMakeActive_);
  590. inetLibConfigIndexFromName_ = Succ(inetLibConfigList_);
  591. inetLibConfigDelete_ = Succ(inetLibConfigIndexFromName_);
  592. inetLibConfigSaveAs_ = Succ(inetLibConfigDelete_);
  593. inetLibConfigRename_ = Succ(inetLibConfigSaveAs_);
  594. inetLibConfigAliasSet_ = Succ(inetLibConfigRename_);
  595. inetLibConfigAliasGet_ = Succ(inetLibConfigAliasSet_);
  596. //old wireless Indicator
  597. inetLibTrapWiCmd = Succ(inetLibConfigAliasGet_);
  598. // File Calls
  599. inetLibTrapSockFileGetByIndex = Succ(inetLibTrapWiCmd);
  600. inetLibTrapCheckAntennaState = Succ(inetLibTrapSockFileGetByIndex);
  601. inetLibTrapCTPSend = Succ(inetLibTrapCheckAntennaState);
  602. // Additional Cache calls
  603. inetLibTrapCachePurge = Succ(inetLibTrapCTPSend);
  604. // new wireless Indicator
  605. inetLibTrapWirelessIndicatorCmd = Succ(inetLibTrapCachePurge);
  606. // Additional Cache calls
  607. inetLibTrapCacheGetObjectV2 = Succ(inetLibTrapWirelessIndicatorCmd);
  608. inetLibTrapIndexedCacheFind = Succ(inetLibTrapCacheGetObjectV2);
  609. inetLibTrapPrepareCacheForHistory = Succ(inetLibTrapIndexedCacheFind);
  610. //This should be at the END ***********
  611. inetLibTrapLast = Succ(inetLibTrapPrepareCacheForHistory);
  612. (********************************************************************
  613. * Structure of cache entry
  614. * Used as a parameter to INetLibCacheList. If urlP or titleP are NULL,
  615. * the corresponding length fields will be updated with the desired lengths
  616. ********************************************************************)
  617. type
  618. INetCacheEntryType = record
  619. urlP: ^UInt8;
  620. urlLen: UInt16;
  621. titleP: ^UInt8;
  622. titleLen: UInt16;
  623. lastViewed: UInt32; // seconds since 1/1/1904
  624. firstViewed: UInt32; // seconds since 1/1/1904
  625. end;
  626. INetCacheEntryP = ^INetCacheEntryType;
  627. (********************************************************************
  628. * Structure for INetLibCacheGetObject. This structure is filled in with info
  629. * about a cache entry.
  630. ********************************************************************)
  631. type
  632. INetCacheInfoType = record
  633. recordH: MemHandle;
  634. contentType: INetContentTypeEnum;
  635. encodingType: INetCompressionTypeEnum;
  636. uncompressedDataSize: UInt32;
  637. flags: UInt8;
  638. reserved: UInt8;
  639. dataOffset: UInt16; // offset to content
  640. dataLength: UInt16; // size of content
  641. urlOffset: UInt16; // offset to URL
  642. viewTime: UInt32; // time last viewed
  643. createTime: UInt32; // time entry was created
  644. murlOffset: UInt16; // offset to master URL
  645. serverBits1: UInt32; // Bits sent by the server
  646. end;
  647. INetCacheInfoPtr = ^INetCacheInfoType;
  648. //--------------------------------------------------
  649. // Library initialization, shutdown, sleep and wake
  650. //--------------------------------------------------
  651. function INetLibOpen(libRefnum: UInt16; config: UInt16; flags: UInt32;
  652. cacheRef: DmOpenRef; cacheSize: UInt32; var inetHP: MemHandle): Err; syscall sysLibTrapOpen;
  653. function INetLibClose(libRefnum: UInt16; inetH: MemHandle): Err; syscall sysLibTrapClose;
  654. function INetLibSleep(libRefnum: UInt16): Err; syscall sysLibTrapSleep;
  655. function INetLibWake(libRefnum: UInt16): Err; syscall sysLibTrapWake;
  656. //--------------------------------------------------
  657. // Settings
  658. //--------------------------------------------------
  659. function INetLibSettingGet(libRefnum: UInt16; inetH: MemHandle; setting: UInt16 {INetSettingEnum};
  660. bufP: Pointer; var bufLenP: UInt16): Err; syscall inetLibTrapSettingGet;
  661. function INetLibSettingSet(libRefnum: UInt16; inetH: MemHandle; setting: UInt16 {INetSettingEnum};
  662. bufP: Pointer; bufLen: UInt16): Err; syscall inetLibTrapSettingSet;
  663. //--------------------------------------------------
  664. // Event Management
  665. //--------------------------------------------------
  666. procedure INetLibGetEvent(libRefnum: UInt16; inetH: MemHandle; var eventP: INetEventType; timeout: Int32); syscall inetLibTrapGetEvent;
  667. //--------------------------------------------------
  668. // High level calls
  669. //--------------------------------------------------
  670. function INetLibURLOpen(libRefnum: UInt16; inetH: MemHandle; var urlP, cacheIndexURLP: UInt8;
  671. var sockHP: MemHandle; timeout: Int32; flags: UInt16): Err; syscall inetLibTrapURLOpen;
  672. function INetLibCTPSend(libRefnum: UInt16; inetH: MemHandle; var sockHP: MemHandle;
  673. var writeP: UInt8; writelen: UInt32; timeout: Int32; ctpCommand: UInt16): Err; syscall inetLibTrapCTPSend;
  674. function INetLibSockClose(libRefnum: UInt16; socketH: MemHandle): Err; syscall inetLibTrapSockClose;
  675. //--------------------------------------------------
  676. // Read/Write
  677. //--------------------------------------------------
  678. function INetLibSockRead(libRefnum: UInt16; sockH: MemHandle; bufP: Pointer;
  679. reqBytes: UInt32; var actBytesP: UInt32; timeout: Int32): Err; syscall inetLibTrapSockRead;
  680. function INetLibSockWrite(libRefnum: UInt16; sockH: MemHandle; bufP: Pointer;
  681. reqBytes: UInt32; var actBytesP: UInt32; timeout: Int32): Err; syscall inetLibTrapSockWrite;
  682. //--------------------------------------------------
  683. // Low level Socket calls
  684. //--------------------------------------------------
  685. function INetLibSockOpen(libRefnum: UInt16; inetH: MemHandle;
  686. scheme: UInt16 {INetSchemEnum}; var sockHP: MemHandle): Err; syscall inetLibTrapSockOpen;
  687. function INetLibSockStatus(libRefnum: UInt16; socketH: MemHandle; var statusP: UInt16;
  688. var sockErrP: Err; var inputReadyP, outputReadyP: Boolean): Err; syscall inetLibTrapSockStatus;
  689. function INetLibSockSettingGet(libRefnum: UInt16; socketH: MemHandle; setting: UInt16 {INetSockSettingEnum};
  690. bufP: Pointer; var bufLenP: UInt16): Err; syscall inetLibTrapSockSettingGet;
  691. function INetLibSockSettingSet(libRefnum: UInt16; socketH: MemHandle; setting: UInt16 {INetSockSettingEnum};
  692. bufP: Pointer; bufLen: UInt16): Err; syscall inetLibTrapSockSettingSet;
  693. function INetLibSockConnect(libRefnum: UInt16; sockH: MemHandle; var hostnameP: UInt8;
  694. port: UInt16; timeou: Int32): Err; syscall inetLibTrapSockConnect;
  695. //--------------------------------------------------
  696. // HTTP specific calls
  697. //--------------------------------------------------
  698. function INetLibSockHTTPReqCreate(libRefnum: UInt16; sockH: MemHandle; var verbP, resNameP, refererP: UInt8): Err; syscall inetLibTrapSockHTTPReqCreate;
  699. function INetLibSockHTTPAttrSet(libRefnum: UInt16; sockH: MemHandle; attr: UInt16 {inetHTTPAttrEnum};
  700. attrIndex: UInt16; var bufP: UInt8; bufLen, flags: UInt16): Err; syscall inetLibTrapSockHTTPAttrSet;
  701. function INetLibSockHTTPReqSend(libRefnum: UInt16; sockH: MemHandle; writeP: Pointer;
  702. writeLen: UInt32; timeout: Int32): Err; syscall inetLibTrapSockHTTPReqSend;
  703. function INetLibSockHTTPAttrGet(libRefnum: UInt16; sockH: MemHandle; attr: UInt16 {inetHTTPAttrEnum};
  704. attrIndex: UInt16; bufP: Pointer; var bufLenP: UInt32): Err; syscall inetLibTrapSockHTTPAttrGet;
  705. //--------------------------------------------------
  706. // Utilities
  707. //--------------------------------------------------
  708. function INetLibURLCrack(libRefnum: UInt16; var urlTextP: UInt8; var urlP: INetURLType): Err; syscall inetLibTrapURLCrack;
  709. function INetLibURLsAdd(libRefnum: UInt16; baseURLStr, embeddedURLStr, resultURLStr: PChar; var resultLenP: UInt16): Err; syscall inetLibTrapURLsAdd;
  710. function INetLibURLsCompare(libRefnum: UInt16; URLStr1, URLStr2: PChar): Int16; syscall inetLibTrapURLsCompare;
  711. function INetLibURLGetInfo(libRefnum: UInt16; inetH: MemHandle; var urlTextP: UInt8; var urlInfoP: INetURLInfoType): Err; syscall inetLibTrapURLGetInfo;
  712. type
  713. int = SmallInt;
  714. function INetLibWiCmd(refNum: UInt16; cmd: UInt16 {WiCmdEnum}; enableOrX, y: int): Boolean; syscall inetLibTrapWiCmd;
  715. function INetLibWirelessIndicatorCmd(refNum: UInt16; inetH: MemHandle; {WiCmdEnum} cmd: UInt16; enableOrX, y: int): Boolean; syscall inetLibTrapWirelessIndicatorCmd;
  716. function INetLibCheckAntennaState(refNum: UInt16): Err; syscall inetLibTrapCheckAntennaState;
  717. //--------------------------------------------------
  718. // Cache interface
  719. //--------------------------------------------------
  720. function INetLibCacheList(libRefnum: UInt16; inetH: MemHandle; var cacheIndexURLP: UInt8;
  721. var indexP: UInt16; var uidP: UInt32; cacheP: INetCacheEntryP): Err; syscall inetLibTrapCacheList;
  722. function INetLibCacheGetObject(libRefnum: UInt16; clientParamH: MemHandle; var urlTextP: UInt8;
  723. uniqueID: UInt32; cacheInfoP: INetCacheInfoPtr): Err; syscall inetLibTrapCacheGetObject;
  724. function INetLibCachePurge(libRefnum: UInt16; clientParamH: MemHandle; var urlTextP: UInt8; uniqueID: UInt32): Err; syscall inetLibTrapCachePurge;
  725. function INetLibCacheGetObjectV2(libRefnum: UInt16; clientParamH: MemHandle; var urlTextP: UInt8; uniqueID: UInt32;
  726. rcIndex: UInt16; cacheInfoP: INetCacheInfoPtr; cacheEntryP: INetCacheEntryP): Err; syscall inetLibTrapCacheGetObjectV2;
  727. function INetLibIndexedCacheFind(libRefnum: UInt16; cacheDBRef: DmOpenRef; var dataP: UInt8; lookFor: Int16; var indexP: UInt16;
  728. order: Int16; var cacheIdP: UInt32): Err; syscall inetLibTrapIndexedCacheFind;
  729. function INetLibPrepareCacheForHistory(libRefnum: UInt16; clientParamH: MemHandle): Err; syscall inetLibTrapPrepareCacheForHistory;
  730. //--------------------------------------------------
  731. // Configuration Calls
  732. //--------------------------------------------------
  733. function INetLibConfigMakeActive(refNum: UInt16; inetH: MemHandle; configIndex: UInt16): Err; syscall inetLibConfigMakeActive_;
  734. function INetLibConfigList(refNum: UInt16; var nameArray{[]}: INetConfigNameType; var arrayEntriesP: UInt16): Err; syscall inetLibConfigList_;
  735. function INetLibConfigIndexFromName(refNum: UInt16; nameP: INetConfigNamePtr; var indexP: UInt16): Err; syscall inetLibConfigIndexFromName_;
  736. function INetLibConfigDelete(refNum: UInt16; index: UInt16): Err; syscall inetLibConfigDelete_;
  737. function INetLibConfigSaveAs(refNum: UInt16; inetH: MemHandle; nameP: INetConfigNamePtr): Err; syscall inetLibConfigSaveAs_;
  738. function INetLibConfigRename(refNum: UInt16; index: UInt16; newNameP: INetConfigNamePtr): Err; syscall inetLibConfigRename_;
  739. function INetLibConfigAliasSet(refNum: UInt16; configIndex, aliasToIndex: UInt16): Err; syscall inetLibConfigAliasSet_;
  740. function INetLibConfigAliasGet(refNum: UInt16; aliasIndex: UInt16; var indexP: UInt16; var isAnotherAliasP: Boolean): Err; syscall inetLibConfigAliasGet_;
  741. //--------------------------------------------------
  742. // File specific calls
  743. //--------------------------------------------------
  744. function INetLibSockFileGetByIndex(libRefnum: UInt16; sockH: MemHandle; index: UInt32;
  745. var handleP: MemHandle; var offsetP, lengthP: UInt32): Err; syscall inetLibTrapSockFileGetByIndex;
  746. implementation
  747. end.