| # ITK Programmer's Guide
Table of contents | Intro | General | TCP Low Level | TCP High Level | UDP | DNS | PPP Encoding/Decoding | Internet Config | Goodies | Cryptography & SSL | Appendix
Appendix
Chapter contents: | Tables Table#1: Filtering flags Table#2: state of connection (as returned by ITK_TCPStatus) Table#3: error codes returned by MacTCP or ITK Bibliography and references Technical support
About this chapter... | This chapter provides a list of constants or error codes returned by ITK routines. It also provides links to bibliography and references to Internet Protocols and specifications.

##
Tables

### Table#1: Filter flags

Filtering flags can help you apply filters on the data you send or receive. This encoding is possible when using the following functions: ITK_ TCPSend , ITK_TCPRcv , ITK_TCPSendFile , ITK_TCPRcvFile , ITK_TCPSendBlob , ITK_TCPRcvBlob .

You can use one or more filter by adding the following constants (ex: Mac->ISO + CR->CR/LF = 1 + 4 = 5).
Filters are applied in the list order.

1 | convert Mac text to ISO 8859-1 (see ITK_Text2ISO )
2 | convert ISO 8859-1 to Mac text (see ITK_ISO2Text )
4 | convert CR to CR/LF
8 | convert CR/LF to CR
16 | convert Mac text to HTML, same as ITK_Text2HTML (text;0)
32 | convert HTML to Mac text (see ITK_HTML2Text )
64 | convert Mac 8bit text only to HTML, same as ITK_Text2HTML (text;1)
128 | convert Mac text to Base64 (see ITK_Text2B64 )
256 | convert Base64 to Mac text (see ITK_B642Text )
512 | convert Mac text to Quoted-Printable (see ITK_Text2Quoted )
1024 | convert Quoted-Printable to Mac text (see ITK_Quoted2Text )

### Table#2: Values and corresponding meanings for TCP stream status

Each TCP stream can be in a particular state at a given time. To each state corresponds a specific value in the following table.

To obtain the status for a given stream you can use ITK_TCPStatus . To wait for a given status on a given stream, you can either have a loop repeatedly calling ITK_TCPStatus or use ITK_TCPWaitConn .

0 | Closed | no connection exists on this stream
2 | Listen | listening for an incoming connection.
4 | SYN received | incoming connection is being established
6 | SYN sent | outgoing connection is being established
8 | Established | connection is up
10 | FIN Wait 1 | connection is up; close has been issued
12 | FIN Wait 2 | connection is up; close has been completed
14 | Close Wait | connection is up; close has been received
16 | Closing | connection is up; close has been issued and received
18 | Last ACK | connection is up; close has been issued and received
20 | Time Wait | connection is being broken

Status 8 and 14 are the most commonly checked.
A status value of 8 means that the connexion is fully established and that data can be exchanged between to 2 extremities.
A status value of 14 means that the other side has acknowledge the request to close the connexion (end of HTTP request, for example).
The status value of a given stream can only increase over time, except if an error occurs, in which case a negative value will be returned as described in table 3.

### Table#3: error codes returned by MacTCP or ITK

This table list the error codes that can be returned by MacTCP and their corresponding meanings.

-1 | badStreamRef | The stream ref is unknown or generic error.
-23000 | ipBadLapErr | Unable to initialise the local network handler
-23001 | ipBadCnfgErr | The manually set address is configured improperly
-23002 | ipNoCnfgErr | A configuration resource is missing.
-23003 | ipLoadErr | Not enough room in the application heap (Macintosh 512K enhanced only).
-23004 | ipBadAddr | Error in getting an address from a server or the address is already in use by another machine.
-23005 | connectionClosing | A TCPClose command was already issued so there is no more data to send on this connection.
-23006 | invalidLength | The total amount of data described by the WDS was either 0 or greater than 65,535 bytes.
-23007 | connectionExists | The TCP or UDP stream already has an open connection.
-23008 | connectionDoesntExist | This TCP stream has no open connection.
-23009 | insufficientResources | 64 TCP or UDP streams are already open.
-23010 | invalidStreamPtr | The specified TCP or UDP stream is not open.
-23011 | streamAlreadyOpen | An open stream is already using this receive buffer area.
-23012 | connectionTerminated | The TCP connection was broken; the reason will be given in a terminate ASR.
-23013 | invalidBufPtr | The receive buffer area pointer is 0.
-23014 | invalidRDS or InvalidWDS | The RDS refers to receive buffers not owned by the use, OR The WDS pointer was 0.
-23015 | openFailed | The connection came halfway up and then failed.
-23016 | commandTimeout | The specified command action was not completed in the specified time period.
-23017 | duplicateSocket | A stream is already open using this local UDP port or a TCP connection already exists between this local IP address and TCP port, and the specified remote IP address and TCP port.
-23032 | ipDontFragErr | The packet is too large to send without fragmenting and the Don't Fragment flag is set.
-23033 | ipDestDeadErr | The destination host is not responding to address resolution requests.
-23035 | icmpEchoTimeoutErr | The icmp echo packet was not responded to in the indicated timeout period.
-23036 | ipNoFragMemErr | Insufficient internal driver buffers available to fragment this packet on send.
-23037 | ipRouteErr | No gateway available to manage routing of packets to off-network destinations.
-23041 | nameSyntaxErr | The hostName field had a syntax error. The address was given in dot notation (that is, W.X.Y.Z) and did not conform to the syntax for an IP address.
-23042 | cacheFault | The name specified cannot be found in the cache. The domain name resolver will now query the domain name server and return the answer in the call-back procedure.
-23043 | noResultProc | No result procedure is passed to the address translation call when the resolver must be used to find the address.
-23044 | noNameServer | No name server can be found for the specified name string.
-23045 | authNameErr | This domain name does not exist.
-23046 | noAnsErr | None of the known name servers are responding.
-23047 | dnrErr | The domain name server has returned an error.
-23048 | outOfMemory | Not enough memory is available to issue the needed DNR query or to build the DNR cache.

##
Bibliography & References

MacTCP Technical Note #550
  This document is a collection of Q&A related to MacTCP.

### Internet RFC... (published by the IETF )

  Complete list , or search .
  Main RFCs
  - Standards RFCs
  - email: SMTP , POP3 , mail headers , MIME
  - FTP
  - WWW: HTTP , HTML 2.0 , HTML Tables
  - Newsgroups: NNTP

  See also on Yahoo .

### WWW related topics...

  The World Wide Web Consortium promotes the Web by producing specifications and reference software. W3C is funded by industrial members but its products are freely available to all. The Consortium is run by MIT LCS with INRIA acting as European host, in collaboration with CERN where the web originated.
  That's the place where you can find HTTP (which is also defined by RFC#1945 and RFC#2068 ) and HTML specifications.

##
Technical Support

> Before submitting a question to technical support, please have a look at this programmer's guide and the RFCs . A lot of the questions we receive are answered in these documents.

> When submitting a question to technical support, please specify at least the following details:

> - Version of Internet ToolKit you're using
> - Operating system and version
> - Version of 4th Dimension

> You can contact ITK's tech support by email: support@internet-toolkit.com

> You can also use ITK's mailing list to get help from other ITK users, this mailing list is also read by ITK Technical Support.

CQ/2-Feb-1999