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