// Pup1.decl - Pup level 1 declarations
// Copyright Xerox Corporation 1979

// Last modified May 31, 1979  4:17 PM by Taft


//----------------------------------------------------------------------------
structure PSIB:			// PupSocketInfoBlock
//----------------------------------------------------------------------------
[
// PBI allocations are number allowed, number now remaining.
// The number now assigned must be the right-hand byte in the word.
tAll word = [ maxTPBI byte; numTPBI byte ]	// total pbis
iAll word = [ maxIPBI byte; numIPBI byte ]	// input pbis
oAll word = [ maxOPBI byte; numOPBI byte ]	// output pbis

lev1Status word =		// status bits defined at level 1
   [
   doChecksum bit		// and generate checksums
   blank bit 15
   ]
]
manifest lenPSIB = size PSIB/16


//----------------------------------------------------------------------------
structure PupSoc:		// level 1 raw Pup Socket
//----------------------------------------------------------------------------
[
link word			// link to next socket
psib word lenPSIB = @PSIB	// socket info block
lclPort: @Port			// local port address
frnPort: @Port			// foreign port address
iQ:				// input PBI queue header
   [
   head word
   tail word
   ]
]
manifest lenPupSoc = size PupSoc/16

//----------------------------------------------------------------------------
structure RTE:			// Routing Table Entry
//----------------------------------------------------------------------------
[
net word			// matched against key; rtFreeEntry => invalid
recent bit			// this entry has been updated recently
blank bit 6-size Pup.hopCnt
hops bit size Pup.hopCnt+1	// hop count; 0 => host directly connected
host byte			// gateway host number
ndb word			// -> NDB for immediate destination net
timer word			// timeout for declaring entry obsolete
]
manifest lenRTE = size RTE/16

// invalid value of net word in RTE
manifest rtFreeEntry = -1	// entry is free

// highest legal value of Pup hop count
manifest maxHops = 1 lshift size Pup.hopCnt -1


// The following structure is now misnamed, given that the Pup routing table
// is no longer implemented using a hash table.  It should be called
// "Dictionary preamble" or something.

//----------------------------------------------------------------------------
structure HTP:		// Hash Table Preamble (object)
//----------------------------------------------------------------------------
[
lookup word		// Call0
insert word		// Call1
delete word		// Call2
enumerate word		// Call3
logSize word		// Only if this is really a hash table!
]
manifest lenHTP = size HTP/16


//----------------------------------------------------------------------------
structure String: [ length byte; char↑1,255 byte ]
//----------------------------------------------------------------------------

manifest
[
// Error protocol
typeError = 4

// Sys.errors codes
ecNoSuchSocket = 2220
ecBadAllocation = 2221
ecNoNetworkInterface = 2222
ecPupRTFull = 2223
]