ComAddr and ComDataA message is always made up of some basic elements. The following structures represent the address of a creature, and the data field of a datagram.
typedef struct {
I32s ranID;
I32s cellID;
I32s soup;
I16u portnb;
I32u node;
} ComAddr;
This address structure is used to identify uniquely one creature in the network of Tierran nodes. A creature is known through its IP address and protocol port number (node and portnb), its soup (in case Tierra runs more than one soup, as would be the case on a parallel machine), and its cellID, which is actually the address of the creature in the soup.
A ranID field had to be added to locate a creature in time.
Communications, especially over such a slow network as the Internet can be, can introduce very large delays. It is then possible for a message meant for a creature to arrive long after the recipient is dead. If a creature is identified only by its address in the soup, this message will be received by the new "inhabitant" of this particular memory space. The ranID value, which is chosen at random for every new-born creature, allows Tierra to detect such problems.
typedef struct { /* structure for communications data */
I32s len; /* length of message */
I8s *d; /* array for data communications */
} ComData;
The data field of a message will be stored in such a structure (dynamic array).
IOs and IObTierran creatures communicate to gather information about their surroundings. This information (such as the data sent as a reply to a tping request) must somehow be handed to the creature. The data is stored in the soup, and the IOS and IOb structures where created to allow Tierra to manage these data spaces (for example to know where to put the data previously requested by a specific creature).
typedef struct { /* structure for IO for communication */
ComData d; /* data */
ComAddr s; /* source address */
ComAddr e; /* destination address */
I32s t; /* tag for type of message */
} IOS;
typedef struct { /* IO structure (communications buffer) */
I32s ipi; /* current index into mapfile */
I16s siz; /* currently allocated size of IOS buffer */
I16s nio; /* index of next free IOS for incoming message*/
IOS *io; /* pointer to IOS buffer; 0 struct for outgoing,
1 to (siz - 1) for incoming */
} IOb;
The ipi field was introduced to allow a creature to search for addresses in the mapfile. This way, instead of playing around with real IP addresses, creatures can only refer to an address in the mapfile.
As an advantage, they do not have to specify a 32-bit IP address plus a 16-bit port number, but only the 32-bit index in the file.
Furthermore, as can be seen above and under, each creature has its own pointer. This allows every creature to go through the whole file at its own pace, thus gathering more or less comprehensive information about the different nodes.
CpuA
typedef struct { /* structure for cpu array */
I16s ib; /* instruction bank */
I32s n; /* number of allocated cpus */
I32s ac; /* number of this active cpu */
I8s sync; /* sync flag for this cell */
Cpu *c; /* pointer to currently active cpu */
Cpu *ar; /* pointer to array of cpus */
InstDef *d; /* pointer to current InstDef structure for parsing */
#ifdef NET
IOb io; /* IO buffer for network communications */
#endif /* NET */
} CpuA;
The necessary pointer to the I/O buffer was added to the CpuA structure.