# NetCon/NetConMT Theory of Operation

## NetCon Overview

#### Introduction

The NetCon and NetConMT Client and Server are package software products designed to provide scalable high-performance emulation of NOVELL's NetWare file, print and bindery services along with NetWare client and terminal emulation on standard UNIX and other POSIX compliant platforms.

NetCon provides complete DOS/Windows to UNIX and UNIX to DOS Networking along with high-performance terminal emulation.

The software package is written entirely in the "C" language and has been designed for performance and portability across many UNIX and NON-UNIX platforms. To date NetCon has been ported to SUN OS 4.1, SUN Solaris 2.x SPARC/X86, SCO UNIX/ODT and IBM AIX RS6000.

#### NetCon Multithreading Architecture

The NetCon server consists of a set of user-level processes that communicate with a kernel level IPX/SPX protocol stack through a BSD SOCKETS interface. The NetCon Client is implemented as a loadable virtual file system (VFS) or a SYSTEM V (SYS5) file system depending on the platform. The virtual file system communicates with the network through the IPX/SPX protocol stack and is supported by several user level processes.

NetCon has been designed to take full advantage of the new Multiprocessor systems. Each DOS client connection to the NetCon server or UNIX client connection to a NetWare server is set up as a separate process or thread. On Multiprocessing systems these threads will execute on different processors, thus providing a scalable networking system whose performance can be predictably increased by simply adding processors.

NetCon also provides an extensive set of Client and Server API's and libraries to allow application programmers limitless access to network resources.

This manual provides a general theory of operation and a detailed technical reference of the NetCon implementation along with a support and porting guide plus the complete library reference and programmers guide. The purpose of this manual is to assist end user, technical support personnel, programmers and administrators in installing, configuring, trouble-shooting, porting and modifying NetCon software.

## NetCon Architecture

The NetCon software is designed as a set of loadable Unix kernel modules and user level processes that, when combined, provide a complete set of NetWare compatible services on Unix platforms.

The following diagram provides a general layout of the various NetCon Modules for both Unix and DOS. The following chapters will provide details on the components of each module and their function.

## NetCon Components

The NetCon software package is divided into seven major functional component groups that we call modules. This chapter provides a general description along with distribution contents and function of each module. The "Technical Reference" Chapter will provide more in depth technical details on each module.

### Module I - Kernel level IPX/SPX protocol stack.

#### Description

Provides NetWare compatible IPX/SPX protocol services to NetCon and other UNIX programs. This protocol stack is derived from the 4.3 BSD XNS (Xerox Networking Systems) stack modified for NetWare compatibility. The protocol stack provides a BSD Sockets user level interface and a Streams LLI/DLPI hardware interface and is capable of providing a TLI user interface in the future. This module consists of the following files on the various platforms.

#### Distribution

SCO

"/dev/str_ether" 802.3 Streams device

"/dev/str_ether2" TYPEII Ethernet Streams device

"/dev/str_token" Token-Ring Streams device

"/dev/netcon 1-4" CLIENT module device

"SD, PD, Str" Socket interface, IPX/SPX protocol stack, Streams LII interface

AIX

"/usr/lib/netcon/netcondd"

SUN OS 4.1.3

"/usr/lib/netcon/netconsun4.o" SUN 4

"/usr/lib/netcon/netconsun4c.o" SUN 4C

SUN Solaris 2.x

"/dev/strx_xxxx" Streams devices

"/dev/netcon" Socket device

"/kernel/drv/netc" Socket/System call driver common code

"/kernel/drv/netc.conf" Socket device configuration file

"/kernel/drv/Str" Streams driver common code

"/kernel/drv/Str.conf" Streams devices configuration file

"/kernel/fs/TFS" IPX/SPX protocol stack and TFS file system code.

#### Function

NetCon IPX/SPX protocol stack functions

Receives incoming packets from network adapter.

Verifies packet size and checksum.

Routes packet.

Matches packet to waiting receive requests.

Provides Connection oriented services (SPX).

Wakes-up/Starts sleeping receive functions.

The NetCon IPX/SPX stack receives incoming packets from the network through the operating system's LLI (Link Level Interface) or DLPI (Data Link Provider Interface) Streams interface to network adapter card. Upon receiving a valid packet the IPX/SPX protocol stack first checks the packet size and validates the checksum. The packets destination address is checked against the host broadcast address, host address and packets IPX destination address to determine if the packet is to be received or just routed to another network interface. If the packet is to be received, that is to say the Destination address and IPX destination match this host, then the IPX destination port number is matched against pending client IPX receive requests. If no matches are found in the Client then the Server IPX pending receives are checked and the Server SPX pending receives are then checked. If no matches are found an error may be sent and/or the packet will be dropped. If a match is found in either the IPX Client, IPX Server, or SPX Server pending receives, the incoming packet is queued on the appropriate receive queue and the waiting receive thread or process is started or is awakened.

### Module II - Kernel level Loadable TFS network file system.

#### Description

NetCon's client service is implemented as a loadable/installable Unix style file system. On SCO this implementation is in the form of an "installable file system" the file system entry is installed into the "file system type switch table" (fstypsw[]) during a re-linking of the kernel. On SUN and IBM AIX the implementation is a loadable Virtual File System (VFS), the file system entry in loaded into "virtual file system" switch table (vfssw[]) each time the kernel is booted. The purpose of this file system is to provide transparent access to NOVELL NetWare Servers directly from UNIX operating "system calls". In other words when a user tries to mount a volume on a NetWare server and open and read a file on that volume the NetCon TFS loadable file system will translate these Unix "system calls" into NetWare NCP network request to connect to server, login, mount the NetWare volume, open and read the specified file and return the results to the user. To the users it appears that they are using a local Unix file or directory.

#### Distribution

"/usr/bin/netcpass" UNIX to NetWare user and group mapping.

"/usr/bin/netcmount" Utility to mount NetWare Servers.

SCO

"TFS" File system switch table type.

AIX

Included in "netcondd" VFS file system.

SUN OS 4.1.3

Included in "netconsun4x.o" VFS file system.

SUN Solaris 2.x

"/kernel/fs/TFS" TFS VFS file system and IPX/SPX protocol stack.

#### Function

NetCon TFS file system functions:

Maps Unix system calls to NCP NetWare system calls.

Mounts/Unmounts NetWare Servers/Volumes.

User group mapping.

Client Login security, password encription.

Dynamic connection management.

The NetCon TFS file system, upon loading, registers a set of functions with the Unix operating system. These "TFS" functions are called by the Unix operating system in response to user level programs making system calls on a file system with a type of "TFS". In other words the command "mount -F TFS netware:sys:/ /mnt" would eventually call the NetCon "TFSmount()" procedure which issues the appropriate "NCP" network request to the NetWare server to attach, login, and map/mount the requested NetWare volume as the Unix "/mnt" directory. Once the mount has completed successfully all further system calls made on the "/mnt" directory will be mapped to corresponding "TFS" calls. In other words the system call "open()" on "/mnt/textfile" would be mapped by Unix to "TFSopen()" which would in turn issue the "NCP" open command across the network to the NetWare server and return the results to the user making the request.

The "Technical Reference" chapter of this manual provides details on all the "TFS" file system and file operation (inode and vnode operation). As each Unix user attempts to use this mounted directory a new individual connection is instantly established for her. The user is then logged into the NetWare server with an encrypted password from the user/group mapping database. When the user is finished with the mounted directory his connection is closed. A separate connection is dynamically maintained for each Unix user just like DOS clients to NetWare.

### Module III - User level Client Service.

#### Description

NetCon's user level client services provide utilities that allow the mounting of NetWare servers as Unix directories. Additional features include the mapping of Unix to NetWare users and groups and printing to the NetWare printers. Generally these utilities communicate with the IPX/SPX protocol stack and TFS file system through the Socket library/Interface , ioctl() calls and system calls. NetCon's user level utilities also make NetWare "NCP" Client calls through the use of the NetCon library "libnc.a". This library provides a complete set of functions that allow programs to attach and login to NetWare servers and perform most file, print, bindery or directory operations.

#### Distribution

"/usr/bin/netcmount" Mounts NetWare Server as UNIX file Systems.

"/usr/bin/netcprint" Netcon Network printing utility.

"/usr/bin/netcon" Netcon menu utility.

"/usr/bin/netcpass" UNIX to NetWare user and group mapping.

#### Function

netcmount - This command is the same as issuing the mount() command with the "-F TFS" file system type option. Depending on the Unix version, the "TFSmount()" on "TFSxxx_mount()" file system operation will be called to mount the specified NetWare server and Volume on the specified Unix directory (mount point).

netcpass - The netcpass daemon provides a means to map Unix user to NetWare user and verify the NetWare users password every time the Unix user accesses the mounted NetWare volume. This daemon interfaces and receives verification requests from the kernel and consults with the NetCon servers bindery to arrive at the appropriate user mapping and NetWare password validation. Netcpass also sets up default Unix to NetWare user and group mappings for all NetWare servers found in the NetCon server bindery. This is accomplished by Client making a internal "loopback" connection to the NetCon Server on the same Unix system and the issuing "Scan Bindery Object Requests" for object type (4) "File Server" to that NetCon server. The NetCon server will respond with a complete list of NetWare servers, which netcpass will use to add default user and group mapping entries to the same NetCon bindery. The mapping entries can then be edited and expanded with the "netcon" menu utility. The "netcpass" daemon is also used to start the kernel initialization routines for the NetCon IPX/SPX protocol stack and the NetCon Client. One of the main functions of this initialization is to send out a "Find Nearest Server Packet" and wait for a response. If a response is received the init routine uses the packets IPX destination network number to set the IPX network address and print "New IPX Address" on the system console at boot time. If the New IPX Address has the correct network number and host address this is firm indication that NetCon is installed and functioning properly.

netcon - The NetCon menu utility provides a NetWare "syscon" type of menu system to administer the NetCon Client software.

The menu utility is written in AT&T Curses and SUN OpenWindows. This utility acts as a NetWare Client and connects to the local NetCon server or any other NetWare server to add or change users and groups, add or change mapped users, add mount points etc. or view network information.

netcprint - Netcprint is a utility that allows printing from UNIX to any NetWare printer. This is accomplished by connecting to the named NetWare server based on information contained in the NetCon servers bindery database. The program consults a number of files on the NetWare server to determine the queue and printer configuration, it then creates a new queue file and writes standard input to that file until an end of file is reached.

### Module IV - User level Server Services.

#### Description

The NetCon Super Server provides file, print, bindery, SAP (Service Advertising Protocol) and RIP (Routing Information Protocol) services. The main server process, upon start-up, spawns sub-processes/threads that provide these various services.

#### Distribution

"/usr/bin/netcserv" File, Print, Bindery, SAP, RIP server daemon.

"/usr/bin/netvt" Multiscreen SPX ANSI Terminal server daemon.

"/usr/bin/netcorasql" SQL interface SPX to TCP daemon.

#### Function

The NetCon Server functions;

NCP Compatable file services.

Login security and password encryption.

SAP Services.

RIP services.

Bindery services.

Print services and Virtual terminal services.

The "netcserv" main daemon first sets various configuration parameters, then reads and exports the volumes from the "netcexport" file. It then reads, re-initializes and rebuilds the "BINDERY" shared virtual memory database (object and property). The RIP and SAP server are then started and a print server is started for each Unix print Spooler. The main daemon then enters the "connect loop" to listen on the FILE server port (0x451) for connection requests from NetWare clients.

netcserv File Server - Upon receiving a connection request the main connect loop checks and disconnects any existing connection with the same address and adds a new entry; the shared connection table. Then it spawns a separate process/thread for the new connection. This new process/thread then enters the main server loop to process incoming network requests from the client. Each client has it own private server process/thread to "service" its requests. Once a NCP request is received it is checked, processed and the results are sent as a REPLY to the client.

netcserv SAP Server - The Service Advertising Protocol server listens to the network on the SAP port (0x452) for SAP requests. Upon receiving a request of the appropriate type, the SAP server will send a reply to the requesting client indicating the services available on the NetCon server. If the incoming packet is a reply type, then the service information in the packet is added to the BINDERY database. The Server also sends a SAP packet to the network every 30 or 60 seconds to also indicate the services available on the server.

netcserv RIP Server - The Routing Information Protocol server listens for routing information request or reply packets on the RIP port (0x453). Upon receiving a RIP request packet the kernel routing table is consulted and a RIP reply is sent indicating the networks that are available on this server. If the received packet is a RIP reply from another server then the routing information in the packet will be added to the kernel routing tables if it does not already exist. The RIP server also sends out RIP reply packets every 30/60 seconds to make the network aware of the available networks on this server.

netcserv Print Server - A separate print server process is started for each Unix print spooler. This process sleeps and wakes up every 30 seconds to check the contents and status of the corresponding print queue. If there is a job in the print queue and the status file indicates the job is ready, the job is printed by calling the Unix print spooler "lp" to print the data in the print queue.

netcvt Terminal Server - The NetCon virtual terminal server listens on SPX port 0x83FA for requests from NCTERM.EXE, the NetCon DOS/Windows virtual terminal client program. Upon receipt of a valid connection request, netcvt finds the next available pseudo-terminal (pseudo-tty) and spawns a login process for this connection on that pseudo-tty. The caller is then logged in through the normal Unix login channel, usually /bin/login. Each virtual terminal request has its own netcvt server session consisting of two processes: a reader process and a writer process.

Note that the total number of simultaneous terminal connections is limited by the number of available pseudo-ttys. The number of pseudo-ttys is specified when NetCon is installed.

netcorasql IPX SQL interface -

### Module V - DOS Multiscreen Terminal Emulator.

#### Description

NetCon provides a high-performance multi-screen DOS terminal emulator for DOS/Windows clients. These clients can login to the Unix system over the network as if each client had its own terminal connection. The client works in conjunction with the NetCon virtual terminal server netcvt (described above), to provide this service.

#### Distribution

"NCTERM.EXE" DOS Multiscreen ANSI SPX terminal emulator.

#### Function

NCTERM.EXE is a LAN virtual terminal program for DOS client PCs. It emulatesVT100 and ANSI terminals, and the SCO ANSI console. Using ncterm, DOS andWindows users may be allowed to login to any Unix server on the network that is running netcvt, NetCon's Virtual Terminal server software. Login to the Unix system is through normal Unix channels; the user must supply a login name and a password. Up to three simultaneous sessions are available to each ncterm userunder DOS, more under Windows by running multiple ncterm sessions.

See the ncterm man page for a complete dscription of ncterm's features and operation.

### Module VI - DOS Client utilities.

#### Description

The DOS utilities are provided for stand-alone installations; i.e. no NetWare server is on the network. These are network administration tools that correspond to utilities with a similar function in a NetWare environment. There are utilities to log in and out, map drives, and redirect printer output to the network.

All features provided by these utilities are supplied by the NetWare shell or vlm version currently running.

#### Distribution

"NCLOGIN.EXE" DOS network login utility.

"NCMAP.EXE" DOS drive mapping utility.

"NCAPTURE.EXE" DOS print redirector.

"NSLIST.EXE" DOS server listing utility.

"NCLOGOUT.EXE" DOS logout utility.

#### Function

nclogin.exe - This utility corresponds to NetWare LOGIN. It is used for initial login to a NetCon server, or to login to a different user name. Set the default drive to the network drive (as in: "J:<enter>") before running nclogin. Use ncmap to map additional drives and servers.

#### Distribution

./usr/bin/netcconfig driver configuration

./usr/bin/netclink driver linker

./usr/bin/netcon.rc start stop script

/usr/bin/netcrestart stops/restarts server "netcserv"

#### Function

netcon.rc - The netcon.rc shell script is linked to the "etc/rc2.d/S90netcon" file. This file is executed by the operating system during boot up late in the multi-user mode. This script starts and stops all the NetCon processes/threads and daemons.

netclink - Links the NetCon IPX/SPX protocol stack to the specified Streams LLI/DLPI network card driver. This is accomplished by calling open () on both the driver and protocol stack, then issuing a ioctl (I_LINK) call. Once the driver and protocol stack are linked they can be started and configured with "netcconfigure".

netcconfig - Netcconfig is functionally identical to the BSD "ifconfig()" command. It is used to set the IPX address of the interface to "0" and configure the interface to receive broadcasts and set it to the UP state. Once the interface is UP, "netcpass" will send and receive a SAP request to set the "New IPX/SPX Address".

netcrestart - This utility is used to stop and restart all the server processes.

### Module VII - Utilities

Description

The NetCon utilities provide general and administrative types of services to the NetCon software. These utilities allow the starting of NetCon which includes the linking of the network card driver to the IPX/SPX protocol stack and allows the stack and interface to be configured and started and the servers to be stopped and restarted.

Distribution

./usr/bin/netcconfig driver configuration

./usr/bin/netclink driver linker

./usr/bin/netcon.rc start stop script

/usr/bin/netcrestart stops/restarts server "netcserv"

Function

netcon.rc- The netcon.rc shell script is linked to the "etc/rc2.d/S90netcon" file. This file is executed by the operating system during boot up late in the multi-user mode. This script starts and stops all the NetCon processes/threads and daemons.

netclink- Links the NetCon IPX/SPX protocol stack to the specified Streams LLI/DLPI network card driver. This is accomplished by calling open () on both the driver and protocol stack, then issuing an ioctl (I-LINK) call. Once the driver and protocol stack are linked they can be started and configured with "netcconfigure".

netcconfig- Netcconfig is functionally identical to the BSD "ifconfig"() command. It is used to set the IPX address of the interface to "0" and configure the interface to receive broadcasts and set it to the UP state. Once the interface is UP, "netcpass" will send and receive a SAP request to set the "New IPX/SPX Address".

netcrestart- This utility is used to stop and restart all the server processes.