-- File: XNS.pack - last edit:
-- AOF                  9-Nov-87 19:19:17
-- SMA                 27-May-86 15:47:25
-- MXI                 10-Nov-87 12:25:48
-- Copyright (C) 1985, 1986, 1987 by Xerox Corporation. All rights reserved. 
-- Packager XNS[UnpackedXNS]/m

XNS: SEGMENT =

  BEGIN

  NetworkIdle: CODE PACK =
    BEGIN
    ChecksumsImpl[ENTRY VECTOR, SetChecksum, TestChecksum];
    NetworkStreamImpl[ENTRY VECTOR];
    RouterImpl[
      ENTRY VECTOR, DecapsulateEthernet, EncapsulateEthernet,
      ReceivePacket, DeliveredToLocalSocket, SendPacket, SendErrorPacket,
      EnumerateRoutingTable, FindDestinationRelativeNetID,
      BroadcastThisPacket, FlushCacheEntry, EnqueueCopyOfNewInput,
      GetDelayToNet];
    SocketImpl[
      ENTRY VECTOR, GetPacket, GetSendBuffer, PutPacket, GetPacketBytes,
      BroadcastPacketToAllConnectedNets, Listener, GetBufferPool];
    RoutingTableImpl[
      ENTRY VECTOR, RoutingTableFork, RouterProcess, WaitReqOrCheckTime,
      FindElement, ProcessRoutingInfoPacket];
    END;  --NetworkIdle

  NetworkUtilities: CODE PACK =
    BEGIN
    RouterImpl[
      AssignAddress, AddSocket, AssignDestinationRelativeAddress, Broadcast,
      RemoveSocket, NSStateChange, ReassignUniqueSocket, FillRoutingTable,
      FindMyHostID];
    SocketImpl[
      Create, CreateListen, Delete, GetAssignedAddress, TestAndSetListener,
      GetStatus, LocalAddressFromSocket, SetPacketBytes, SetPacketWords,
      SwapSourceAndDestination, BroadcastAddressFromSocket, SetWaitTime];
    END;  --NetworkUtilities

  IdleStream: CODE PACK =
    BEGIN
    NetworkStreamImpl[
      RequeueProcedure, AcceptablePacket, ExtractRexmt, GetForUser,
      InsertRexmtOrConsume, ProcessSppState, RcvdSppPacket,
      DuplicatePacket, RcvdErrorPacket, Receiver, SystemPacket,
      Retransmitter, SendPacket, SendToLocal, SetTimeout, SetWaitTime,
      SuspendStream];
    END;  --IdleStream

  ActiveStream: CODE PACK =
    BEGIN
    NetworkStreamImpl[
      SendSequencedPacket, InsertAttention, ExtractAttention,
      SendNow, PutBlock, PutByte, PutWord, SetSST, FlushOutputBuffer,
      GetByte, GetWord, GetBlock, GetOutputBuffer, ReturnBuffer,
      SetQuencing, TakeFromUser, SendAttention, WaitAttention,
      FindAddresses, GetSenderSizeLimit, GetWaitTime,
      SetSenderSizeLimit, CATCH CODE];
    NetworkStreamMgr[
      ENTRY VECTOR, FindAddresses, GlobalFrameFromByteStream, NewConnection,
      SetWaitTime, Listen];
    PacketStreamMgr[
      ENTRY VECTOR, DisableChecksums, EnableChecksums, DisableProbes,
      EnableProbes, GlobalFrameFromPacketStream, PacketStreamFromByteStream,
      ByteStreamFromPacketStream, SetSppSpy];
    NewNetworkStreamImpl[ENTRY VECTOR]; 
    END;  --ActiveStream

  StreamCreateAndDelete: CODE PACK =
    BEGIN
    NetworkStreamMgr[
      Create, CreateTransducer, ApproveConnection, Close, CloseReply,
      Delete, CreateListener, DeleteListener, CATCH CODE];
    PacketStreamMgr[
      GetUniqueConnectionID, InsertIntoConnectionTable, ConnectionAlreadyThere,
      InsertConnection, Make, Destroy, RemoveConnection,
      RemoveFromConnectionTable, CATCH CODE];
    NetworkStreamImpl[
      MAIN, StartPacketStreamInternal, StartByteStream, InitializePSObject,
      StartPacketStream, Establish,
      CleanupTable, StopByteStream, StopPacketStream, SanityCheck];
    NewNetworkStreamImpl[Delete, InitializeInternal, InitializeSppState]; 
    END;  --StreamCreateAndDelete


  NegotiatingCreate: CODE PACK =
    BEGIN
    PacketStreamMgr[NewMake];
    NetworkStreamImpl[NewStartPacketStream];
    NewNetworkStreamImpl[
      NewCreate, NewApprove, NewTransducer, NewListen,
      NewReject, NewInitializeSppState, MAIN, CATCH CODE];
    END;  --NegotiatingCreate

  Exchange: CODE PACK =
    BEGIN
    PacketExchangeImpl[
      ENTRY VECTOR, GetBuffer, GetFreeSendPacket, NotifySendCompleted,
      RejectRequest, LostBuffer, SendReply, SendReplyPacket, SendRequest,
      SendRequestPacket, WaitForRequest, WaitForRequestPacket, SetWaitTimes,
      Create, Delete, CreateReplier, CreateRequestor];
    END;  --Exchange

  LocalRouting: CODE PACK =
    BEGIN
    RoutingTableImpl[
      CheckRoutingTableEntries, ProbeINRs, FindLocalNetID, UpdateRoutingTable,
      Transmit, ChangedState, GetRouteInfo, ProcessUsersRequest, GetDelay,
      RemoveElement, RemoveDriver, Enumerate, AddElement, Fill, AddDriver,
      FlushCache, TestAndSet, Expand, AddDriverInternal, RoutingTableCacheFault,
      CATCH CODE];
    END;  --LocalRouting

  Echoing: CODE PACK =
    BEGIN
    EchoServerImpl[
      ENTRY VECTOR, EchoServer, Sequenced, GetCounters, SwatWatcher,
      CreateServer, DeleteServer, CATCH CODE];
    END;  --Echoing

  Miscellaneous: CODE PACK =
    BEGIN
    EchoServerImpl[MAIN];
    RouterImpl[
      SetNetworkID, GetNetworkID, GetRouterFunction, NSRouterOn,
      NSRouterOff, Register, NSPackageMake, NSPackageDestroy,
      PacketHit, EnableNSErrorPackets, DisableNSErrorPackets, SetNSStormy,
      SetNSCheckit, SetNSDriverLoopback];
    RoutingTableImpl [Forward, Start, Stop, GetCurrentFill, TableList];
    SocketImpl[
      GetSource, GetDestination, SetDestination, FixupUnknownSocketNumber];
    ChecksumsImpl[IncrNSTransportControlAndUpdateChecksum,
      SlowlyComputeChecksum];
    END;  --Miscellaneous

  StartOfLife: CODE PACK =
    BEGIN
    NetworkStreamMgr[MAIN];
    PacketStreamMgr[MAIN, PacketStreamsGo, SetWindow];
    NetworkStreamImpl[GetState, SetState, GetTimeout, GetSST];
    PacketExchangeImpl[MAIN, CATCH CODE];
    RouterImpl[MAIN, CATCH CODE];
    RoutingTableImpl[MAIN];
    SocketImpl[MAIN, CATCH CODE];
    ChecksumsImpl[MAIN];
    END;  --StartOfLife

  END;

  IdleFrames: FRAME PACK =
    BEGIN
    XNS.EchoServerImpl;
    XNS.SocketImpl;
    XNS.RoutingTableImpl;
    XNS.RouterImpl;
    XNS.ChecksumsImpl;
    END;  --IdleFrames

  ActiveFrames: FRAME PACK =
    BEGIN
    XNS.PacketStreamMgr;
    XNS.NetworkStreamImpl;
    XNS.NewNetworkStreamImpl;
    XNS.NetworkStreamMgr;
    XNS.PacketExchangeImpl;
    END;  --