
Newton Technology Journal June 1996
3
configuration of your links, and a communications tool that you use with
your endpoints to perform communications on the Internet.
Figure 1 shows the relationship of the Newton Internet Enabler
components.
Figure 1 Newton Internet Enabler components
The Newton Internet Enabler application programming interface
provides two kinds of functions: domain name service functions and link
controller functions. You use the domain name service functions to translate
between Internet domain names and their corresponding IP addresses. You
use the link controller functions to establish, release, and find the status of
your Internet links.
The domain name service and link controller functions are global
functions in the Newton system software. These functions provide an
interface between Newton communications endpoints and the Inet tool,
which is the underlying communications tool that performs the actual work
of establishing, maintaining, and communicating over the links.
The Inet communications tool provides a configurable stack of protocols
at and below the TCP/IP level. The Inet tool is a standard Newton
communications tool, which means that it provides all of the endpoint
services that are provided by other built-in communications tools, such as
the built-in modem tool and the built-in serial tool. Like the other
communications tools, you can control the configuration of the Inet tool
with communications options.
The Inet tool can establish physical links using various low-level
communications services. Each communications service is provided by a
Newton communications tool such as the built-in modem tool. The Inet
tool can run various link-level protocols that are provided with the Newton
system software, including PPP and SLIP.
Your application can use several endpoints with the same Newton
Internet Enabler link. Each endpoint, however, requires a significant amount
of memory. The total number (for all applications) of endpoints that can be
active is restricted by a combination of the user’s hardware configuration and
which software is currently in use on the device.
The remainder of this article describes the Newton Internet Enabler
application programming interface. The November, 1995 issue of Newton
Technology Journal (Volume 1, Number 5) provides an overview of Newton
communications technology, including a discussion of endpoints and
communications tools.
NEWTON INTERNET ENABLER AND CALLBACK FUNCTIONS
Many of the Newton Internet Enabler functions require you to provide a
callback function, which is a function that the Inet tool calls during and/or
after the performance of the operation that you requested. The callback
function receives status and error information.
For example, the InetCancelLink function calls the callback
function that you provide after it finishes its operation. Your callback
function for InetCancelLink can determine if an error occurred and
can determine the current status of the link that you wanted canceled.
Some operations call your callback function more than once. For
example, the InetGrabLink function calls the callback function you
provide many times during its operations. You can use your
InetGrabLink callback function to monitor the progress of the grab,
since each call to it provides you with the current status.
When a function requires that you specify a callback function, you do
so by providing a context frame and the symbol of the function defined in
that frame that you want to use as the callback function. For example,
the InetGrabLink function takes three parameters and is declared
as follows:
InetGrabLink(linkID, clientContext, clientCallback);
When you call InetGrabLink, you must specify a frame (or your
application frame) as the value of
clientContext
, and you must specify a
function defined in the frame as the value of
clientCallback
.
You might create a callback function for your InetGrabLink calls
that looks like the following:
myApp.GrabLinkCallback := func(linkID, stat, err)
begin
if err=nil and stat.linkStatus <> 'connected then
; // display status
if err then
; //handle the error
// link established, so resolve the address
end;
,
Lower-level Newton comm tool
(e.g. the b uilt-in modem tool)
Link
Controller
requests
SLIP
PPP
IP
configuration info
host names,
IP numbers
endpoint
comm scripting
messages
Inet tool
function calls
Inet tool
option requests
physical link requests
comm tool requests, e.g.
connect, get, put
data indata out
Setup
application
NewtonScript
client applications
Link Controller
Domain
Name
Server
Inet tool
TCP
UDP
serial stub driver
transport services
link-level protocols
communications stack
continued from page 1
Newton Internet Enabler
Comentários a estes Manuais