INetMgr.h
declares the Internet library API. For more information on the Internet library, see the chapter "Network Communication" in the Palm OS Programmer's Companion.
NOTE:  The information in this chapter applies only to version 3.2 or later of the Palm OS® on Palm VII® devices. These features are implemented only if the Wireless Internet Feature Set is present.
WARNING!In future OS versions, Palm Computing® does not intend to support or provide backward compatibility for the Internet library API documented in this chapter.
INetCompressionTypeEnum
enum indicates the type of compression used for data exchanged via a socket. One of these enumerated types is set as the value of the inetSockSettingCompressionTypeID socket setting (a read-only setting).
typedef enum {
inetCompressionTypeNone = 0,
inetCompressionTypeBitPacked,
inetCompressionTypeLZ77
} INetCompressionTypeEnum;
Custom 5-bit compression scheme. This is typically used for data sent from the Palm Web Clipping Proxy server. | |
INetConfigNameType
structure holds the name of an Internet library network configuration. A configuration is a set of specific values for the Internet library settings. The Internet library defines a set of built-in configuration aliases for common network setups. These aliases point to configurations instead of holding the actual values themselves. You can use an alias anywhere in the API you would use a configuration. System-defined configuration aliases are listed in "Configuration Aliases" .
INetLibConfigIndexFromName
,
INetLibConfigRename
, and
INetLibConfigSaveAs
.
#define inetConfigNameSize 32;
typedef struct {
Char name[inetConfigNameSize]; // name of configuration
} INetConfigNameType, *INetConfigNamePtr;
INetContentTypeEnum
enum specifies the type of content to be exchanged via a socket. One of these enumerated types is set as the value of the inetSockSettingContentTypeID socket setting (a read-only setting).
typedef enum {
inetContentTypeTextPlain = 0,
inetContentTypeTextHTML,
inetContentTypeImageGIF,
inetContentTypeImageJPEG,
inetContentTypeApplicationCML,
inetContentTypeImagePalmOS,
inetContentTypeOther
} INetContentTypeEnum;
INetHTTPAttrEnum
enum specifies HTTP request and response attributes that are set by
INetLibSockHTTPAttrSet
and returned by
INetLibSockHTTPAttrGet
.
typedef enum {
//-----------------------------------------------------------
// Request only attributes
//-----------------------------------------------------------
// The following are ignored unless going through a CTP proxy
inetHTTPAttrWhichPart, // (W) UInt32 (0 -> N)
inetHTTPAttrIncHTTP, // (W) UInt32 (Boolean) only applicable
// when inetHTTPAttrConvAlgorithm set to ctpConvNone
inetHTTPAttrCheckMailHi, // (W) UInt32
inetHTTPAttrCheckMailLo, // (W) UInt32
inetHTTPAttrReqContentVersion, // (W) UInt32, desired content
// version. Represented as 2 low bytes. Lowest byte is
// minor version, next higher byte is major version.
//--------------------------------------------------------------
// Response only attributes
//--------------------------------------------------------------
// Server response info
inetHTTPAttrRspSize, // (R) UInt32, entire HTTP Response size
// including header and data
inetHTTPAttrResult, // (R) UInt32 (ctpErrXXX when using CTP Proxy)
inetHTTPAttrErrDetail, // (R) UInt32 (server/proxy err code when
// using CTP Proxy)
inetHTTPAttrReason, // (R) Char[]
// Returned entity attributes
inetHTTPAttrContentLength, // (R) UInt32
inetHTTPAttrContentLengthUncompressed, // (R) UInt32 (in bytes)
inetHTTPAttrContentLengthUntruncated, //(R) UInt32
inetHTTPAttrContentVersion, // (R) UInt32, actual content version.
// Represented as 2 low bytes. Lowest byte is minor
// version, next higher byte is major version.
inetHTTPAttrContentCacheID, // (R) UInt32, cacheID for this item
inetHTTPAttrReqSize // (R) UInt32 size of request sent
} INetHTTPAttrEnum;
INetSchemeEnum
enum specifies a protocol (http, https, etc.) used by a socket. Specify one of these enumerated types for the INetSockSettingScheme
socket setting and for the scheme
parameter to the
INetLibSockOpen
call.
typedef enum {
inetSchemeUnknown = -1,
inetSchemeDefault = 0,
inetSchemeHTTP, // http:
inetSchemeHTTPS, // https:
inetSchemeFTP, // ftp:
inetSchemeGopher, // gopher:
inetSchemeFile, // file:
inetSchemeNews, // news:
inetSchemeMailTo, // mailto:
inetSchemePalm, // palm:
inetSchemePalmCall, // palmcall:
inetSchemeMail, // not applicable to URLs, but used
    // for the INetLibSockOpen call when
    // creating a socket for mail IO
inetSchemeMac, // mac: - Mac file system HTML
inetSchemeFirst = inetSchemeHTTP, // first one
inetSchemeLast = inetSchemeMail // last one
} INetSchemeEnum;
INetSettingEnum
enum specifies a setting to be returned or set by the
INetLibSettingGet
or
INetLibSettingSet
calls.
typedef enum {
inetSettingCacheSize, // (RW) UInt32, max size of cache
inetSettingCacheRef, // (R) DmOpenRef, ref of cache DB
inetSettingNetLibConfig, // (RW) UInt32, NetLib config to use
inetSettingRadioID, // (R) UInt32[2], the 64-bit radio ID
inetSettingBaseStationID, // (R) UInt32, the radio base station Id
inetSettingMaxRspSize, // (W) UInt32 (in bytes)
inetSettingConvAlgorithm, // (W) UInt32 (CTPConvEnum)
inetSettingContentWidth, // (W) UInt32 (in pixels)
inetSettingContentVersion, // (W) UInt32, content version (encoder
// version)
inetSettingNoPersonalInfo, // (RW) UInt32, send no deviceID/zipcode
inetSettingUserName,
inetSettingLast
} INetSettingEnum;
INetSockSettingEnum
enum specifies a socket setting to be returned or set by the
INetLibSockSettingGet
or
INetLibSockSettingSet
calls.
typedef enum {
inetSockSettingScheme, // (R) UInt32, INetSchemeEnum
inetSockSettingSockContext, // (RW) UInt32,
inetSockSettingCompressionType, // (R) Char[]
inetSockSettingCompressionTypeID, // (R) UInt32
// (INetCompressionTypeEnum)
inetSockSettingContentType, // (R) Char[]
inetSockSettingContentTypeID, // (R) UInt32 (INetContentTypeEnum)
inetSockSettingData, // (R) UInt32, pointer to data
inetSockSettingDataHandle,// (R) UInt32, handle to data
inetSockSettingDataOffset,// (R) UInt32, offset to data from handle
inetSockSettingTitle, // (W) Char[]
inetSockSettingURL, // (R) Char[]
inetSockSettingIndexURL, // (RW) Char[]
inetSockSettingFlags, // (RW) UInt16, one or more of
// inetOpenURLFlagXXX flags
inetSockSettingReadTimeout, // (RW) UInt32, read timeout in ticks
inetSockSettingContentVersion,// (R) UInt32, content version number
inetSockSettingLast
} INetSockSettingEnum;
inetSockSettingScheme
|
Requested scheme; one of the INetSchemeEnum values. Read-only.
|
inetSockSettingSockContext
| Not used. |
inetSockSettingCompressionType
| Name of requested compression type. Read-only. |
inetSockSettingCompressionTypeID
|
Requested compression type; one of the INetCompressionTypeEnum values. Read-only.
|
inetSockSettingContentType
| String containing the MIME type of the content. Used only on received raw data. Read-only. |
inetSockSettingContentTypeID
|
Content type of socket data; one of the INetContentTypeEnum values. Read-only.
|
inetSockSettingData
| Pointer to socket data. Read-only. |
inetSockSettingDataHandle
| Handle to socket data. Read-only. |
inetSockSettingDataOffset
| Offset to socket data from handle. Read-only. |
inetSockSettingTitle
| Web page title. This value is written to the cache (and Clipper uses it later in a history list of cache entries). Write-only. |
inetSockSettingURL
| URL of requested data. Read-only. |
inetSockSettingIndexURL
| Index (or master) URL of requested data (for cache indexing). This is the topmost web page in a group of hierarchical pages; it serves to group the pages together and to filter cache list results. Clipper sets this to the URL of the active PQA, for all pages linked from the PQA. |
inetSockSettingFlags
|
URL request flags; one or more of inetOpenURLFlag ... flags (see URL Open Constants).
|
inetSockSettingReadTimeout
|
The default timeout value for reads when the application uses the event mechanism. The time since last receiving data from a socket is monitored and a timeout error status event is returned from INetLibGetEvent if the timeout is exceeded.
|
inetSockSettingContentVersion
|
Content version number. Read-only.
|
INetStatusEnum
enum specifies the status of the socket. The status is returned in the
inetSockStatusChangeEvent
event structure and by the call
INetLibSockStatus
.
typedef enum {
inetStatusNew, // just opened
inetStatusResolvingName, // looking up host address
inetStatusNameResolved, // found host address
inetStatusConnecting, // connecting to host
inetStatusConnected, // connected to host
inetStatusSendingRequest, // sending request
inetStatusWaitingForResponse, // waiting for response
inetStatusReceivingResponse, // receiving response
inetStatusResponseReceived, // response received
inetStatusClosingConnection, // closing connection
inetStatusClosed, // closed
inetStatusAcquiringNetwork, // network temporarily
// unreachable; socket on hold
inetStatusPrvInvalid = 30 // internal value, not returned by
// INetMgr. Should be last.
} INetStatusEnum;
INetLibConfigIndexFromName
to obtain the alias's index from the name. For more information, see
INetConfigNameType
.
inetURLInfoFlag
... constants convey information about a URL and are returned by the function
INetLibURLGetInfo
.
inetOpenURLFlag
... constants control how the
INetLibURLOpen
call operates with respect to caching and encryption. These flags are also used for the inetSockSettingFlags socket setting.
Err INetLibCacheGetObject (UInt16 libRefnum, MemHandle clientParamH, UInt8 * urlTextP, UInt32 uniqueID, INetCacheInfoPtr cacheInfoP)
  |
|
Refnum of the Internet library. |
  |
|
Inet handle allocated by INetLibOpen . |
  |
|
Pointer to URL text string to find. If this parameter is NULL , then uniqueID is used to find the entry. |
  |
|
Unique ID of the cache entry to find. This value can be obtained by calling INetLibCacheList . This parameter is ignored if urlTextP is specified. |
  |
|
Pointer to a structure where information about the cache entry is returned. See the Comments section for details. |
INetCacheInfoPtr
type returned from this function is defined as a pointer to an INetCacheInfoType
structure, which has the following definition:
typedef struct {
MemHandle recordH; // handle to the cache record
INetContentTypeEnum contentType;
INetCompressionTypeEnum encodingType;
UInt32 uncompressedDataSize;
UInt8 flags; // unused
UInt8 reserved;
UInt16 dataOffset; // offset to content
UInt16 dataLength; // size of content
UInt16 urlOffset; // offset to URL
UInt32 viewTime; // time last viewed
UInt32 createTime; // time entry was created
UInt16 murlOffset; // offset to master URL
} INetCacheInfoType, *INetCacheInfoPtr;
Err INetLibCacheList (UInt16 libRefnum, MemHandle inetH, UInt8 * cacheIndexURLP, UInt16 * indexP, UInt32 * uidP, INetCacheEntryP cacheP)
  |
|
Refnum of the Internet library. |
  |
|
Inet handle allocated by INetLibOpen . |
  |
|
Pointer to a long value where the unique ID of the found cache entry is returned. |
  |
|
Pointer to a structure where information about the found cache entry is returned. See the Comments section for details. |
uidP
the unique ID of the first cache entry with an index equal to or greater than indexP
. The indexP
value is updated to point to the next entry upon return.
index
, until it returns the error inetErrTypeNotCached
.
uidP
value.
typedef struct {
UInt8 * urlP; // ptr to URL string
UInt16 urlLen; // length of URL string
UInt8 * titleP; // ptr to title string
UInt16 titleLen; // length of title string
UInt32 lastViewed; // time last viewed
    // seconds since 1/1/1904
UInt32 firstViewed; // time first viewed
    // seconds since 1/1/1904
} INetCacheEntryType, *INetCacheEntryP;
Err INetLibCheckAntennaState(UInt16 Refnum)
Err INetLibClose (UInt16 libRefnum, MemHandle inetH)
  |
|
Refnum of the Internet library. |
  |
|
Inet handle allocated by INetLibOpen . |
NetLibClose
, if necessary, to close the net Library or decrement its open count.
INetLibOpen
Err INetLibConfigAliasGet (UInt16 refNum, UInt16 aliasIndex, UInt16 * indexP, Boolean * isAnotherAliasP)
  |
|
Refnum of the Internet library. |
  |
|
Pointer where the index of the configuration pointed to by aliasIndex is returned. 0 is returned if aliasIndex does not point to another configuration. |
  |
|
If *indexP is the index of another alias configuration, this Boolean is set to true . |
INetLibConfigAliasSet
Err INetLibConfigAliasSet (UInt16 refNum, UInt16 configIndex, UInt16 aliasToIndex)
  |
|
Refnum of the Internet library. |
  |
|
Index of configuration that the alias identified by configIndex is to point to. Specify 0 to remove an existing alias assignment. |
INetLibConfigAliasGet
Err INetLibConfigDelete (UInt16 refNum, UInt16 index)
  |
|
Refnum of the Internet library. |
INetLibConfigIndexFromName
,
INetLibConfigList
Err INetLibConfigIndexFromName (UInt16 refNum, INetConfigNamePtr nameP, UInt16 * indexP)
  |
|
Refnum of the Internet library. |
  |
|
Pointer to an INetConfigNameType structure that names the configuration whose index you want to get. |
  |
|
Pointer where the index of the configuration identified in nameP is returned. |
INetLibConfigList
Err INetLibConfigList (UInt16 refNum, INetConfigNameType nameArray[], UInt16 * arrayEntriesP)
  |
|
Refnum of the Internet library. |
  |
|
Pointer to an array of INetConfigNameType structs that is to be filled in by this routine. |
INetLibConfigMakeActive
INetLibOpen
.
Err INetLibConfigMakeActive (UInt16 refNum, MemHandle inetH, UInt16 configIndex)
  |
|
Refnum of the Internet library. |
  |
|
Inet handle allocated by INetLibOpen . |
INetLibConfigSaveAs
,
INetLibConfigList,
INetLibConfigIndexFromName
Err INetLibConfigRename (UInt16 refNum, UInt16 index, INetConfigNamePtr newNameP)
  |
|
Refnum of the Internet library. |
  |
|
Pointer to an INetConfigNameType structure holding the new name of the configuration. The name cannot start with a period or an underscore. |
Err INetLibConfigSaveAs (UInt16 refNum, MemHandle inetH, INetConfigNamePtr nameP)
  |
|
Refnum of the Internet library. |
  |
|
Inet handle allocated by INetLibOpen . |
  |
|
Pointer to an INetConfigNameType structure holding the name of the configuration. The name cannot start with a period or an underscore. |
EvtGetEvent
that informs an application of status changes to Internet sockets as well as user interface events.
void INetLibGetEvent (UInt16 libRefnum, MemHandle inetH, INetEventType* eventP, Int32 timeout)
  |
|
Refnum of the Internet library. |
  |
|
Inet handle allocated by INetLibOpen , or NULL . |
  |
|
The event structure is returned via this pointer. |
  |
|
Timeout in ticks. Specify evtWaitForever to wait forever. |
EvtGetEvent
in applications which use the Internet library. For convenience, if inetH
is NULL
, INetLibGetEvent
is equivalent to EvtGetEvent
.
INetLibGetEvent
returns two additional events besides those returned by EvtGetEvent
:
inetSockReadyEvent
and
inetSockStatusChangeEvent
.
INetLibSockStatus
,
INetLibURLOpen
,
INetLibSockOpen
,
INetLibSockRead
Err INetLibOpen (UInt16 libRefnum, UInt16 config, UInt32 flags, DmOpenRef cacheRef, UInt32 cacheSize, MemHandle* inetHP)
  |
|
Refnum of the Internet library. Pass the value "INet.lib" to SysLibFind to return this refnum. |
  |
|
Indicates the type of network service desired by the application. Returned by INetLibConfigIndexFromName . |
  |
|
Currently unused; set to 0. |
  |
|
Document cache database reference. Obtain this by using one of the DmOpenDatabase ... calls. Pass NULL if you don't want to use a cache. |
  |
|
Maximum size of the document cache (in bytes). This is ignored if you pass NULL for cacheRef . |
  |
|
Pointer to a handle variable. |
INetLibClose
, which closes both the Internet library and the net library, if necessary.
INetLibClose
,
INetLibConfigIndexFromName
Err INetLibSettingGet (UInt16 libRefnum, MemHandle inetH, UInt16 /*INetSettingEnum */ setting, void * bufP, UInt16 * bufLenP)
  |
|
Refnum of the Internet library. |
  |
|
Inet handle allocated by INetLibOpen . |
  |
|
The setting to get. Specify one of the INetSettingEnum enumerated types. |
  |
|
Pointer to buffer where the return value is to be put. |
  |
|
Size of bufP on entry. Size of setting value on exit. |
INetSettingEnum
for details.
INetLibOpen
,
INetLibSettingSet
,
INetSettingEnum
Err INetLibSettingSet (UInt16 libRefnum, MemHandle inetH, UInt16 /*INetSettingEnum*/ setting, void * bufP, UInt16 * bufLen)
  |
|
Refnum of the Internet library. |
  |
|
Inet handle allocated by INetLibOpen . |
  |
|
The setting to set. Specify one of the INetSettingEnum enumerated types. |
  |
|
Pointer to the new setting value. |
  |
|
Size of the value in bufP . |
inetH
is around (until
INetLibClose
is called) and do not affect other applications that might be using the Internet library.
INetLibURLOpen
or
INetLibSockOpen
.
INetLibSettingGet
,
INetSettingEnum
Err INetLibSockClose (UInt16 libRefnum, MemHandle socketH)
  |
|
Refnum of the Internet library. |
  |
|
Handle of the socket to close. |
INetLibSockOpen
or INetLibURLOpen
.
INetLibOpen
,
INetLibSockOpen
,
INetLibURLOpen
Err INetLibSockConnect (UInt16 libRefnum, MemHandle sockH, UInt8 * hostnameP, UInt16 port, Int32 timeout)
  |
|
Refnum of the Internet library. |
  |
|
Handle (allocated by INetLibSockOpen or INetLibURLOpen ) of the socket to connect. |
  |
|
Pointer to host name string; can be dotted decimal text string. |
  |
|
Port number, or 0 for default port. |
  |
|
Timeout in ticks; -1 means wait forever. |
INetLibSockRead
, or it may wait for the connect to complete by either polling INetLibSockStatus
until the socket status is inetStatusConnected
(not recommended), or by waiting for an inetSockStatusChangeEvent
event from INetLibGetEvent
and checking the status then (preferred).
INetLibSockOpen
,
INetLibSockStatus
,
INetLibGetEvent
Err INetLibSockHTTPAttrGet (UInt16 libRefnum, MemHandle sockH, UInt16 /*inetHTTPAttrEnum*/ attr, UInt16 attrIndex, void * bufP, UInt32 * bufLenP)
  |
|
Refnum of the Internet library. |
  |
|
Handle (allocated by INetLibSockOpen or INetLibURLOpen ) of the socket. |
  |
|
The attribute to get. Specify one of the INetHTTPAttrEnum values. |
  |
|
The attribute index (if any). Currently unused. |
  |
|
Pointer to the address where the result is returned. |
  |
|
Pointer to the size of bufP on entry; size of returned value on exit. |
INetLibSockHTTPReqCreate
and INetLibSockHTTPAttrSet
, or the response header returned by the remote host.
INetLibSockHTTPReqCreate
Err INetLibSockHTTPAttrSet (UInt16 libRefnum, MemHandle sockH, UInt16 /*inetHTTPAttrEnum*/ attr, UInt16 attrIndex, UInt8 * bufP, UInt16 bufLen, UInt16 flags)
  |
|
Refnum of the Internet library. |
  |
|
Handle (allocated by INetLibSockOpen or INetLibURLOpen ) of the socket. |
  |
|
The attribute to set. Specify one of the INetHTTPAttrEnum values. |
  |
|
The attribute index (if any). Currently unused. |
  |
|
Pointer to additional header text to add. |
  |
|
Length of bufP . |
  |
|
Flags that control the addition of new headers. Currently unused. |
INetLibSockHTTPReqCreate
. Generally, attributes are set only before calling INetLibSockHTTPReqSend
.
INetLibSockHTTPReqCreate
,
INetLibSockHTTPReqSend
Err INetLibSockHTTPReqCreate (UInt16 libRefnum, MemHandle sockH, UInt8 * verbP, UInt8 * resNameP, UInt8 * refererP)
  |
|
Refnum of the Internet library. |
  |
|
Handle (allocated by INetLibSockOpen or INetLibURLOpen ) of the socket. |
  |
|
Pointer to a string holding an HTTP verb; most likely "GET". |
  |
|
Pointer to a string holding the name of the resource to get or put. |
  |
|
Pointer to a string holding the name of the referring URL, or NULL if none. |
This call forms an HTTP request for the socket. The request is not actually sent to the remote host until INetLibSockHTTPReqSend
is called. After this call, the application can add additional HTTP request headers using
INetLibSockHTTPAttrSet
.
INetLibSockHTTPAttrSet
,
INetLibSockHTTPReqSend
Err INetLibSockHTTPReqSend (UInt16 libRefnum, MemHandle sockH, void * writeP, UInt32 writeLen, Int32 timeout)
  |
|
Refnum of the Internet library. |
  |
|
Handle (allocated by INetLibSockOpen or INetLibURLOpen ) of the socket. |
  |
|
Pointer to additional data to send after the request headers. Usually used for POST and PUT operations. |
  |
|
Number of bytes in writeP . |
  |
|
Timeout in ticks. |
INetLibSockHTTPReqCreate
and INetLibSockHTTPAttrSet
to the remote host. If this is an POST
or PUT
operation, the data to write can be specified in writeP
.
INetLibSockHTTPReqSend
doesn't always do network I/O. If the proper socket flag is set, it checks first to see if the requested data is already in the cache. If it is, then a pointer to the cached data is stored in the socket and the socket status is updated to show that data is ready to be read. This will trigger an
inetSockReadyEvent
event.
inetOpenURLFlagLookInCache
) that causes the cache to be checked first can be set via the flags
parameter to
INetLibURLOpen
or by calling
INetLibSockSettingSet
with the appropriate setting (inetSockSettingFlags
).
INetLibSockStatus
until the inputReady
boolean is set (not recommended), or by waiting for an inetSockReadyEvent
event from INetLibGetEvent
(preferred).
INetLibSockHTTPReqCreate
,
INetLibSockHTTPAttrSet
,
INetLibGetEvent
Err INetLibSockOpen (UInt16 libRefnum, MemHandle inetH, UInt16 /*INetSchemeEnum*/ scheme, MemHandle* sockHP)
  |
|
Refnum of the Internet library. |
  |
|
Inet handle allocated by INetLibOpen . |
  |
|
The protocol scheme to use. Specify one of the INetSchemeEnum types. |
  |
|
Pointer to the address where the socket handle is returned. |
INetLibURLOpen
when finer control over the socket settings is required.
INetLibURLOpen
, an HTTP request can be handled with the simple sequence: INetLibURLOpen
, INetLibSockRead
, and INetLibSockClose
. When using INetLibSockOpen
, the same HTTP request would be handled by replacing the INetLibURLOpen
call with the sequence: INetLibSockOpen
, INetLibSockSettingSet
(optional), INetLibSockConnect
, INetLibSockHTTPReqCreate
, INetLibSockHTTPAttrSet
(optional), and INetLibSockHTTPReqSend
.
INetLibSockOpen
allows an application finer control over the socket settings (by calling INetLibSockSettingSet
) and the HTTP request headers (by calling INetLibSockHTTPAttrSet
).
INetLibOpen
,
INetLibURLOpen
,
INetLibSockRead
,
INetLibSockClose
,
INetLibSockSettingSet
,
INetLibSockHTTPAttrSet
Err INetLibSockRead (UInt16 libRefnum, MemHandle sockH, void * bufP, UInt32 reqBytes, UInt32 * actBytesP, Int32 timeout)
  |
|
Refnum of the Internet library. |
  |
|
Inet handle allocated by INetLibOpen . |
  |
|
Pointer to buffer where the data is placed. |
  |
|
Requested number of bytes. |
  |
|
Pointer to the actual number of bytes read. |
  |
|
Timeout in ticks; -1 means wait forever. |
reqBytes
bytes from the given socket. It returns the actual number of bytes read in *actBytesP
. If the connection with the remote host has been closed, *actBytesP
contains 0 on exit.
*actBytesP
contains 0, indicating the connection has been closed, or until an error is returned.
inetSockReadyEvent
from
INetLibGetEvent
before calling INetLibSockRead
. Alternatively, the application could call
INetLibSockStatus
to determine if the socket has any data ready (not recommended), or could simply rely on INetLibSockRead
to block until at least one byte is available to read. If no data is available before the timeout expires, inetErrReadTimeout
error is returned.
INetLibURLOpen
,
INetLibSockOpen
,
INetLibSockStatus
,
INetLibSockClose,
INetLibGetEvent
Err INetLibSockSettingGet (UInt16 libRefnum, MemHandle socketH, UInt16 /*INetSockSettingEnum*/ setting, void * bufP, UInt16 * bufLenP)
  |
|
Refnum of the Internet library. |
  |
|
Handle (allocated by INetLibSockOpen or INetLibURLOpen ) of the socket to get a setting from. |
  |
|
The setting to get. Specify one of the INetSockSettingEnum values. |
  |
|
Pointer to buffer where the setting value is to be placed. |
  |
|
Size of bufP on entry; size of returned value on exit. |
INetLibSockSettingSet
Err INetLibSockSettingSet (UInt16 libRefnum, MemHandle socketH, UInt16 /*INetSockSettingEnum*/ setting, void * bufP, UInt16 bufLen)
  |
|
Refnum of the Internet library. |
  |
|
Handle (allocated by INetLibSockOpen or INetLibURLOpen ) of the socket to set. |
  |
|
The setting to set. Specify one of the INetSockSettingEnum values. |
  |
|
Pointer to buffer containing the new setting value. |
  |
|
Size of new setting in bufP . |
INetLibSockSettingGet
Err INetLibSockStatus (UInt16 libRefnum, MemHandle socketH, UInt16 * statusP, Err* sockErrP, Boolean* inputReadyP, Boolean* outputReadyP)
  |
|
Refnum of the Internet library. |
  |
|
Handle (allocated by INetLibSockOpen or INetLibURLOpen ) of the socket to get status on. |
  |
|
Pointer to the address where the status is returned. The status will be one of the INetStatusEnum values. |
  |
|
Currently unused. |
  |
|
Pointer to a Boolean; true is returned if the socket has data available to read. |
  |
|
Pointer to a Boolean; true is returned if the socket can accept data for writing. |
INetLibGetEvent
will rarely need to use this call since socket status changes are returned in the event structure.
INetLibURLOpen
,
INetLibSockOpen
,
INetLibSockRead,
INetLibGetEvent
Err INetLibURLCrack (UInt16 libRefnum, UInt8 * urlTextP, INetURLType* urlP)
  |
|
Refnum of the Internet library. |
  |
|
Pointer to URL text string. |
  |
|
Pointer to address where the URL information block is to be returned. |
urlP
is set to NULL
on entry, then on exit it will point to the start of that component within the original urlTextP
string; the associated member length is set to the length of that URL component. If a pointer member of urlP
is not NULL
on entry, then it must point to a buffer of sufficient size to hold the member data, and on exit the component string will be copied into this buffer and the associated member length will be updated with the actual size. Note that the returned strings are not NULL
terminated, so the length values are important.
InetURLType
block to zeros and let this function fill in all the information about the URL components.
InetURLType
block returned from this function has the following structure:
typedef struct {
UInt16 version; // 0, for future compatibility
UInt8 * schemeP; // ptr to scheme portion
UInt16 schemeLen; // size of scheme portion
UInt16 schemeEnum; // INetSchemeEnum; the scheme
UInt8 * usernameP; // ptr to username portion
UInt16 usernameLen; // size of username
UInt8 * passwordP; // ptr to password portion
UInt16 passwordLen; // size of password
UInt8 * hostnameP; // ptr to host name portion
UInt16 hostnameLen; // size of host name
UInt16 port; // port number
UInt8 * pathP; // ptr to path portion
UInt16 pathLen; // size of path
UInt8 * paramP; // ptr to param (;param)
UInt16 paramLen; // size of param
UInt8 * queryP; // ptr to query (?query)
UInt16 queryLen; // size of query
UInt8 * fragP; // ptr to fragment (#frag)
UInt16 fragLen; // size of fragment
} INetURLType
Err INetLibURLGetInfo (UInt16 libRefnum, MemHandle inetH, UInt8 * urlTextP, INetURLInfoType* urlInfoP)
  |
|
Refnum of the Internet library. |
  |
|
Inet handle allocated by INetLibOpen . |
  |
|
Pointer to URL text string. |
  |
|
Pointer to address where the URL information structure is to be returned. |
InetURLInfo
block returned from this function has the following structure:
typedef struct {
UInt16 version; // 0, for future compatibility
UInt16 flags; // flags word
UInt32 undefined; // reserved for future use
} INetURLInfo
flags
word can consist of some combination of these values:
inetURLInfoFlagIsSecure // URL was encrypted
inetURLInfoFlagIsRemote // URL was retrieved from the net
inetURLInfoFlagIsInCache // URL is stored in the cache
Err INetLibURLOpen (UInt16 libRefnum, MemHandle inetH, UInt8 * urlP, UInt8 * cacheIndexURLP, MemHandle* sockHP, Int32 timeout, UInt16 flags)
  |
|
Refnum of the Internet library. |
  |
|
Inet handle allocated by INetLibOpen . |
  |
|
Pointer to string containing the URL to access. |
  |
|
Pointer to address where the socket handle is returned. |
  |
|
Timeout in ticks; -1 means wait forever. |
  |
|
Flags indicating caching and encryption options desired. Specify zero, one, or more of the URL open flags (see URL Open Constants). |
urlP
and returns a socket handle. Note that if you specify that the cache should be searched first, and if the data is found in the cache, no network I/O occurs. The application can then read that socket resource through the
INetLibSockRead
call.
INetLibSockOpen
, INetLibSockConnect
, INetLibSockHTTPReqCreate
, and INetLibSockHTTPReqSend
.
INetLibSockRead
, or to use
INetLibGetEvent
to model asynchronous operation. Using INetLibGetEvent
is the preferred way of performing network I/O since it maximizes battery life and user-interface responsiveness.
INetLibSockOpen
,
INetLibSockConnect
,
INetLibSockRead
,
INetLibSockClose
Err INetLibURLsAdd (UInt16 libRefnum, Char * baseURLStr, Char * embeddedURLStr, Char * resultURLStr, UInt16 * resultLenP)
  |
|
Refnum of the Internet library. |
  |
|
Pointer to base URL string. |
  |
|
Pointer to URL text string to append. |
  |
|
Pointer to resulting URL string. |
  |
|
Pointer to size of resultURLStr buffer on entry. On exit, pointer to resulting URL length (including NULL terminator). |
INetLibURLOpen
or other functions. This routine ensures that the resulting string conforms to the URL format.
Boolean INetLibWiCmd (UInt16 refNum, UInt16 /*WiCmdEnum*/ cmd, int enableOrX, int y)
  |
|
Refnum of the Internet library. |
  |
|
The command to invoke. Specify one of the WiCmdEnum values (see Comments section). |
  |
|
If cmd is wiCmdSetEnabled , specify 1 to enable the wireless indicator or 0 to disable it. If cmd is wiCmdSetLocation , this specifies the x coordinate of the location. |
  |
|
The y coordinate of the location. Used only if cmd is wiCmdSetLocation . |
cmd
is wiCmdEnabled
, this function returns true
if the wireless indicator is enabled or false
if it is not. For other command types, the return value is undefined.
INetLibGetEvent
. It should be shown on screen while a wireless transaction is in progress. It may also be shown when the user has nothing useful to do next but initiate a wireless transaction, and there isn't much other useful information being displayed.
WiCmdEnum
enum specifies a command that operates on the wireless indicator in the user interface. The definition of this type is found in WirelessIndicator.h
and is as follows:
typedef enum {
wiCmdInit =0,
wiCmdClear,
wiCmdSetEnabled,
wiCmdDraw,
wiCmdEnabled,
wiCmdSetLocation,
wiCmdErase
} WiCmdEnum;
  |   |