ITK Programmer's Guide


 

Table of contents | Intro | General | TCP Low Level | TCP High Level | UDP | DNS | PPP
Encoding/Decoding | Internet Config | Goodies | Cryptography | Appendix

 

Chapter 2 : General ITK Routines

   

   

Chapter contents:


About this chapter...

This chapter describes general ITK routines like ITK_Init which is used to provide ITK its licence number so that it will not run in demo mode.

ITK_TCPInfos provides general information about the TCP/IP layer available on the machine where ITK is used.

Two new routines have been added in ITKv2 to provide global information about the currently used streams (ITK_TCPGetStrm) and the TCP/IP layers (ITK_TCPGlobInfo).

   

   


ITK_Init

Syntax:

result := ITK_Init(licence1;licence2)


Description:

Initialises ITK by giving ITK it's license number.
If the license number is incorrect, ITK will run automatically in demo mode.


Warning:

If both license numbers are empty or invalid, ITK will run in demo mode and beep three times.

Just call this routine once in your application prior to any other call to ITK, otherwise the "demo dialog" will show up (the best place to do this is the "Startup" procedure or the "On Startup" method of 4Dv6).

If you are using ITK in 4D Server's stored procedures, you will have to call ITK_Init at the beginning of those procedures, otherwise the "demo dialog" will show up on 4D Server.


Note:

The secondary license number can be used in multiplatform applications. In that case, you can pass both Mac and Windows license numbers in one ITK_Init call.


Params:

In/Out

Parameter

Type

   

Example or note

->

licence1

String

First licence number

   

->

licence2

String

Second licence number (for multiplatform applications)

   

<-

result

Longint

Buffer size for this stream (in bytes)

This parameter is only used under MacTCP.
Accepts values between 8192 and 32767.
Pass 0 for ITK to use a default buffer of 8KB (8192 bytes).


Example:

$err := ITK_Init("ITK...";"ITK...")
If ($err <0)
  ALERT("Your TCP/IP layers couldn't be initialised !")
End If
 
Back to top


ITK_TCPInfos

Syntax:

result := ITK_TCPInfos(localIP; version1; version2; ITKversion)


Description:

Returns global information about the TCP/IP layers.


Params:

In/Out

Parameter

Type

   

Example or note

<-

localIP

Longint

local IP address

On multihomed systems, the primary (or default) local IP address is returned.

<-

version1

Longint

version of TCP/IP layers

1 = MacTCP 1.1
2 = MacTCP 1.1.1
3 = MacTCP 2.0.x
4 = TCP/IP (OpenTransport)
5 = Winsock

<-

version2

Longint

OpenTransport's version number

Under OpenTransport, returns OpenTransport's version code. OpenTransport version codes are values returned by Gestalt selector 'otvr' with Apple's standard version format.
$MMmrssbb (in hexadecimal) where:

  • MM = major version number
  • m = minor version number
  • r = release version number
  • ss = stage code ($20 = dev, $40 = alpha, $60 = beta, $80 = Final)
  • bb = build number

For example, OpenTransport 1.1 returns 17858590 decimal, which is $01108000 in hexadecimal so this is version 1.1F.

<-

ITKversion

Longint

ITK's version number

Same format as Apple's standard version format (see above).

<-

result

Longint

error code (negative values).

   


Example:

$err := ITK_TCPInfos(locAddr;TCPvers;OTvers)
if (TCPvers=5) ` we're under Windows
  foldSep := "\"
else
  foldSep := ":"
end if
 
Back to top


ITK_TCPGetStrm

Syntax:

result := ITK_TCPGetStrm(index)


Description:

This routine allows to retrieve the list of all current TCP streams allocated by ITK.


Params:

In/Out

Parameter

Type

   

Example or note

->

index

Longint

Index value

Pass 0 to get the current number of streams.
Pass 1..n to get the Nth stream.

<-

result

Longint

StreamRef (if index > 0)
number of streams (if index=0)
0 (index out of range)

If index > 0 returns the StreamRef.
If index = 0 returns the amount of allocated streams
If the returned value is 0 the index is out of range.


Example:

$nbStrm := ITK_TCPGetStrm(0) ` get the number of allocated streams
For ($i;1;$nbStrm)
  $status := ITK_TCPStatus(ITK_TCPGetStrm($i))
End For
 
Back to top


ITK_TCPGlobInfo

Syntax:

result := ITK_TCPGlobInfo(infoSelector)


Description:

Returns global information about the TCP layers.


Params:

In/Out

Parameter

Type

   

Example or note

->

 

infoSelector

 

Longint

 

global info selector

Global info selectors:

  • 1 = round trip average*
  • 2 = minimum round trip time*
  • 3 = maximum round trip time*
  • 4 = maximum TCP segment size*
  • 5 = maximum TCP connections
  • 6 = number of connection attempts
  • 7 = number of connections opened
  • 8 = number of connections accepted
  • 9 = number of closed connections
  • 10 = number of aborted connections
  • 11 = bytes received
  • 12 = bytes sent
  • 13 = duplicate bytes received*
  • 14 = retransmitted bytes*
  • 15 = number of packets received*
  • 16 = number of packets sent*
  • 17 = number of duplicate packets received*
  • 18 = number of packets retransmitted*

* this information is only available under MacTCP.

<-

 

result

 

Longint

 

returned value

   


Example:

maxTCPstrm := ITK_TCPGlobInfo(5) ` max. number of streams
Back to top


CQ/27-May-98