11 Interface To L3 TCP And UDP Functionality (under construction)

11.1 Preliminaries

11.1.1 Purpose of this Document

This document is addressed to people using the built-in TCP/IP functionality provided by TCP Manager, UDP Manager and Name Server L3 tasks.

The C-Interface for these managers was created as a basis for the development of a socket server for the UNIX emulation project on top of L3. However, they allow usage of networking functions (but without the socket interface).

The functions are still in a pre-release state, since only rudimentary testing was undertaken. In addition, the documentation is currently incomplete and awaits testers.

11.1.2 Related Documents

There is a document describing the network implementation of L3 (in Elan).

11.2 TCP Manager functions

The information contained here is basically from tcpifc.h.

11.2.1 Datastructures

typedef struct { int index; int state; ThreadT thread; } TCPChannelT; TCPChannelT contains the thread owning the connection, an index into a table managed by TCP Manager and the state of the connection (see below).

typedef struct { int IP_Address; WordT Port; } TCPSocketT; This structure (6 bytes) identifies uniquely the communication peer. IP_Address ( 4 Bytes) can be set using the L3_IP_Adress macro (see on top). Port contains the remote port.

Possible connection states

11.2.2 Macros

Some macros are defined in netmacros.h for easier access to the functions provided here.

11.2.3 TCPRead

int TCPRead (TCPChannelT * Channel, int Mode, char *Buffer, int BufSize, int RecvTimeOut);

TCPRead reads data from an existing TCP connection. This can be either blocking or nonblocking, depending on mode. { L3_TCP_BLOCKING,L3_TCP_NONBLOCKING }


  1. A connection must exist.
  2. If the read is blocking (e.g., for normal server operation), one can specify a timeout after which the call comes back (recommended during testing).
  3. You must provide a buffer. If it is too small, multiple reads should get the remaining data.
  4. TCPRead sets the connection state in TCPChannelT variable.

11.2.4 TCPWrite

int TCPWrite (TCPChannelT * C, char *SendMsg, int MessageLength, char *Buffer, int BufSize, int flags);

Writes to an existing TCP connection. The message to be send must be placed in SendMsg.

If an error occured, the error message is placed in Buffer (? needs testing).

Flags can be:

It is not clear to what extend the current L3 implementation supports these flags.

11.2.5 TCPOpen

int TCPOpen (TCPSocketT RSock, int Own_Port, int mode, int timer, TCPChannelT * Channel);


11.2.6 Other functions

int TCPWaitAck (TCPChannelT * ChannelPtr);

MUST be called after an active open.

int TCPClose (TCPChannelT * Channel);

int TCPAbort (TCPChannelT *Channel);

int printChannel (TCPChannelT * Ch);

int TCPAbort(TCPChannelT * Channel);

int TCPGetSocket(TCPChannelT * Channel, TCPSocketT * MySockPtr, TCPSocketT * RSockPtr);

Fills Remote Socket and Own Socket.

int TCPInitTCPServerThreadID (void);

This function must be called before anything else.

11.3 UDP Manager Interface

Information from udpifc.h

11.4 Name Server Interface

Information from nsifc.h

Marion Schalm, Jean Wolter, Michael Hohmuth
26.12.1995 (unfinished)