NetCon Technical Reference

Installing, Loading and Starting of NetCon

Installing NetCon

General

The installation of the NetCon software product is accomplished thought the various installation mechanisms native to the particular operating system platform. In general all the installation procedures accomplish the following tasks.

Provide for repeated clean installation, removal, upgrade and re-configuration in any run level.

Properly register the NetCon software package with the system administration facility.

Transfer the software from the Media to system and un-compress.

Create all required sub-directories .

"/usr/lib/netcon" and required sub-directories.

"/sys" and required sub-directories.

"/netware"

Modify the system start-up procedure to start NetCon late in the multi-user mode.

Add the kernel components to the system.

Set up or modify, if required, the master and slave pseudo terminal devices "/dev/ptty" and "/dev/ttyp".

Selection of network type 802.3. TYPEII or Token-Ring.

Selection of network adapter and quantity.

Edit the "/usr/bin/netcon.rc" start-up file to add the network type and adapter information.

Re-link the kernel on SCO.

NetCon Installation script Pseudo Code

The NetCon install script is run from the systems install mechanism.

Source Location: varies by platform.

INSTALL

PROCEDURE SHELL SCRIPT Install ();
     {install software}
BEGIN
IF /usr/bin/netcon.rc exist
     stop netcon
     remove netcon
ELSE
     IF the directories do not exits 
          create /netware, /sys, /sys/system, /sys/login, /sys/mail, /sys/               public
     get network type, from user
     get number of network adapters, from user
     get network adapter, from user
     edit /usr/bin/netcon.rc add netclink and netcconfig and report      lines
     run system kernel module add functions
     link /usr/bin/netcon.rc to /etc/rc2.d/S90netcon
     add group everyone
     add user supervisor
END;

SUN Solaris 2.x

Installation program; "pkgadd".

Start-up file; "/etc/rc2.d/S90netcon" symbolic link to "/usr/bin/netcon.rc".

Procedures to add kernel components;

"modload /kernel/fs/TFS" Adds all NetCon kernel code TFS VFS file system, IPX/SPX, etc.

"add_drv /kernel/drv/Str" Common code to build DLPI interface devices only /dev/str*_*".

"add_drv /kernel/drv/netc" Common code to build Socket devices only "/dev/netcon*".

Installation scripts;

Source location: scripts/scripts.sun

"pkfinfo" Contains Identification information.

"prototype" Contains distribution contents, location, perms and checksums.

"preinstall" Run before package installed removes NetCon etc.

"postinstall" NetCon install script.

"preremove" Stops NetCon.

SUN OS 4.1.3

Installation program "none" NetCon installation script "/tmp/ncinstall".

Startup file; "/etc/rc.local" calls "/usr/bin/netcon.rc".

Installation script; "/tmp/ncinstall".

Source location: scripts/scripts.sun/install.sh

SCO ODT/UNIX

Installation program "custom".

Startup file "/etc/rc2.d/S90netcon" linked to "/usr/bin/netcon.rc".

Installation Scripts;

Source location: scripts/scripts.sco/netconfig and scripts/scripts.sco

"/etc/perms" Distribution contents, location, perms etc.

"/tmp/init.netcon" Installation scripts stub to call "netconfig" to do real installation.

"/usr/lib/netconfig/info/netcon" Identification information.

"/usr/lib/netconfig/init/netcon" NetCon install script.

"/usr/lib/netconfig/remove/netcon" NetCon remove script.

"/usr/lib/custom/netcon.rmv" Custom removal script.

IBM AIX RS6000

Installation program "installp"

Startup file "/etc/rc.local" calls "/usr/bin/netcon.rc".

Source location: scripts/scripts.aix

See Also

pkgadd(), custom(), installp()

Loading NetCon

Introduction

After the installation is complete the next step in implementing NetCon is to load the kernel level modules. This is accomplished as follows:

SCO

SCO requires that the kernel be relinked to add new kernel modules. This relinking takes place during the installation.

AIX

During the boot process the loadable kernel module "/usr/lib/netcon/netcdd" is loaded.

SUN OS 4.1.3

During the boot process loadable kernel modules "/usr/lib/netcon/netconsun4.o" or "/usr/lib/netcon/netconsun4c.o" are installed with the configuration scripts.

SUN Solaris 2.x

During the boot process the loadable modules "/kernel/fs/TFS", "/kernel/drv/Str" and "/kernel/drv/netc" are loaded into the kernel. The associated devices are built in the "/device/pseudo" directory and linked to the "/dev/" directory.

The NetCon Solaris 2.x version kernel code is implemented as Solaris 2.x DDI/DDK compliant loadable leaf drivers. The Solaris kernel is self-configuring. During the boot the system sets up a kernel-resident device information tree call devinfo. The NetCon Drivers contain a Virtual File System (VFS) entry for the (TFS) NetWare compatible network file system. This requires that the NetCon drivers be loaded into the virtual file system switch table vfssw[] during early boot and before the system enters multiuser mode. When the Solaris system enters multiuser mode the switch table is terminated with a NULL (0) entry and no other valid entries can be added.

The loading sequence for Solaris 2.x is as follows.

NOTE: drivers must have been previously added to the system during the installation process with add_drv() for device drivers and mod_load() for the file system.

1. The system copies the driver into the kernel virtual memory area and calls _init(9e) routine in each module which must call the kernel routine mod_install(9f) to link the driver to the devinfo node entry. The NetCon drivers/file system are;

/kernel/fs/TFS

/kernel/drv/Str

/kernel/drv/netc

2. The system reads the driver's configuration file (xx.conf) and adds information to the drivers devinfo node.

/kernel/drv/Str.conf

/kernel/drv/netc.conf

3. The drivers identify(9e), probe(9e), and attach(9e) routines are then called.

If all the steps complete successfully the devices are now accessible and its open(9e) routine can be called.

Solaris 2.x Boot Pseudo Code

BOOT

PROCEDURE KERNEL CODE boot();
     {Solaris Kernel Boot Strap}
BEGIN
     
     build devinfo
          
          CALL _init() in /kernel/fs/TFS
          CALL _init() in /kernel/drv/Str
          CALL _init() in /kernel/drv/netc
          CALL _info() in /kernel/fs/TFS
          CALL _info() in /kernel/drv/Str
          CALL _info() in /kernel/drv/netc          
          CALL Str_identify()
          CALL  netc_identify()
          CALL Str_attach()
          CALL  netc_attach()
          
          
     ENTER multiuser mode
                    
          
          CALL netcon.rc
END;

For complete details on all the drivers entry points see Module I and Module II. The NetCon startup script netcon.rc is the subject of the next chapter.

NetCon Startup

General

The NetCon software is started during later phases of the boot process by the "/usr/bin/netcon.rc script file. This file was modified during the installation phase and should contain the appropriate network type and network adapter configuration information.

The "/usr/bin/netcon.rc" script provides the following functions;

Load the kernel modules if not already loaded by relinking or during bootup ("/usr/lib/netcon_load").

Links (Streams I_LINK) the network adapter DLPI/LLI driver to the IPX/SPX protocol stack through a minor device indicating the correct network type and interface number ("/usr/bin/netclink").

Configure and start the IPX/SPX protocol stack ("/usr/bin/netcconfigure").

Start the password mapping daemon which also sets the network number and ("/usr/bin/netcpass") prints the "New IPX Address".

Prints the new IPX/SPX configuration ("/usr/bin/netcconfigure").

Starts the server daemons ("/usr/bin/netcserv").

Starts the terminal server daemon ("/usr/bin/netcvt").

Starts the sql interface or netbios ("/usr/bin/netcorasaql", "/usr/bin/netcnblink").

Mounts the indicated NetWare servers.

Stops NetCon during shutdown.

SCO

SUN Solaris 2.x

"/usr/bin/netcon.rc" linked to "/etc/rc2.d/S90netcon".

AIX

"/etc/inittab" "rcnetcon" entry added.

SUN OS 4.1.3

"/usr/bin/netcon.rc" called from "/etc/rc.local".

After the startup of NetCon the following daemon/processes/threads should be running.

/usr/bin/netclink 1 process

/usr/bin/netcpass 1 process

/usr/bin/netcserv 1 server daemon, 2 SAP, 1 RIP, plus 1 for each connection and printer.

/usr/bin/netcvt 1 terminal server daemon plus 2 for each connection.

netcon.rc NetCon Startup Pseudo Code

The NetCon start up script is run only by the system startup and shutdown mechanism.

Source locations: scripts/scripts.xxx/netcon.rc

NETCON.RC

PROCEDURE SHELL SCRIPT netcon.rc (start|stop);
     {Start|Stop NetCon software}
BEGIN
set execution path
SWITCH on first parameter
     CASE start
          load kernel modules if not already loaded
          CALL netclink, link netcon to hardware driver
          CALL netcconfig, configure and start IPX/SPX
          CALL netcpass, password mapping daemon
          CALL netcconfig, report IPX/SPX configurations
          CALL netcserv, start server daemon
          CALL netcvt, start terminal server daemon
          CALL netcorasql, start sql interface
          CALL netcmount mount netware servers
     CASE Stop
          find all netcon daemons and kill then
END;

At this point NetCon is fully functional and ready to provide network file, print and terminal services to DOS/Windows clients and NetWare file and print services to Unix users. The next 7 chapters will provide the details on how each module functions and how they interact and combine to provide these services.

Technical Reference

NetCon Kernel Modules and Entry Points

Overview

Unix Operating Systems, both AT&T and BSD, are designed from the ground up to support many different types of network operating systems in very standard ways. This networking support comes in many forms ie:

i) User level network libraries and interfaces (AT&T TLI/Streams, BSD Sockets/Mbuf). ii) The ability to add NEW kernel level device drivers for network adapters (Ethernet, Token-Ring, FDDI). iii) The ability to add NEW kernel level protocol stacks (TCP/IP IPX, OSI). iv) The ability to add NEW kernel level network file systems (NFS, DFS, RFS, TFS). NetCon was designed to take advantage of all of these features. That is to say NetCon supports AT&T Streams, BSD Sockets, loadable IPX protocol stack and drivers and loadable TFS Network file systems.

The following chapters will discuss the details of NetCon implementation of these standards based features.

Unix/Posix Device Drivers, Protocol stacks and File Systems

NetCon implements its kernel modules as Unix/POSIX device drivers and file systems. AT&T Unix system device drivers and file systems share a common method of adding new members. That is they add new members to an array of structures called device or file system switch tables. These member structures contain device information and more importantly pointers to functions required by Unix devices or file systems. The index number of the structures entry into this array is the devices MAJOR number, in the case of a file system it is the file system number and or name. Device minor numbers are for the devices own internal use only and are not in any way used by the Unix system.

There are currently two methods in general use for adding AT&T drivers and file systems, NetCon uses both. The first is AT&T System V release 3.2 style used by SCO and the second is AT&T system V release 4.0 used by SUN, AIX, UnixWare etc. The main differences between these two versions, as far as NetCon is concerned, is that the older 3.2 version uses a kernel that requires you to Re-link the binaries to add new devices or file systems. The 4.0 release supports loadable drivers and file systems. Also, the 3.2 version utilizes a "file system type" (fssw[]) switch table, the 4.0 version uses a more modern Virtual File System (VFS, vfssw[]). Both versions support AT&T Streams and NetCon provides BSD 4.2 SOCKET support to systems that do not provide their own, natively.

Unix drivers and file systems both have a pre-defined set of required entry points. Each new driver or file system, as it is loaded or linked to the system, must provide pointers to these required functions and may provide pointers to the optional functions.

NetCon has TWO (2) kernel level modules;

The NetCon software consists of TWO (2) kernel levels. Module I is a IPX/SPX protocol stack and Module II is a file system. Both modules can be either linked or loaded depending on the operating system.

Module I is the IPX/SPX protocol stack which has two devices associated with it. The first device is the upper User level Socket interface which is a character device "/dev/netcon". The second device is the lower hardware LLI/DLPI interface which is a Streams device. Character and Streams devices provide a different set of entry points. Character devices provide the traditional open, close, read, write and ioctl functions and a NULL for the "streamtab" structure pointer. While streams drivers have NULL pointers for the open, close, read, write and ioctl function and a valid pointer to a streamtab structure containing pointers to Streams open and close functions as well as the Stream queue put and service procedure. The put and service procedures are the primary entry points in Streams drivers or modules. The Streams open and close procedure are only used to link the driver to the hardware device or other streams modules.

Module II is the NetCon TFS (Tony's Fast Network File System) file system module which consists of a linkable fstypsw or loadable vfssw file system depending on the platform.

How The Unix Kernel Works

The Unix kernel, upon receiving a system call from a user process, first checks the FILE system type, if the call is on a regular file the corresponding "File System Operations" are called. Otherwise if the system call is on a Special device file (protocol stack or device driver) then the "Device's Operations" are called.

Example 1 System calls on Special Device Files

The Unix kernel upon receiving a system call on a special device file first determines if the device is a streams device or a regular device by whether the device has a valid pointer to a streamtab structure or valid pointers to regular device entry points (open, close, read, write, ioctl). Both streams and regular devices have both common and administration entry points.

Example 2: System calls on regular files

The Unix kernel, upon receiving a system call on a regular file, dispatches that call to the appropriate file system or vnode operation.

In the case of SCO the procedures in "fstypsw" are called. These include both "file System" and "file" operations. Solaris has separate structures for "file System" operation "vfops" and file operations "vnodeops".

NetCon Module Entry Points Solaris 2.x called at Boot time

Entry points call by the system during boot.

Entry Point Module Source

_init() II TFS kernel/sockets/machdep/tfs_sun.c

_init() I Str kernel/sockets/machdep/Strsun.c

_init() I netc kernel/sockets/machdep/netcsun.c

Str_identify() I Str kernel/sockets/machdep/Strsun.c

Str_attach() I Str kernel/sockets/machdep/Strsun.c

netc_identify() I netc kernel/sockets/machdep/netcsun.c

netc_attach() I netc kernel/sockets/machdep/netcsun.c

NetCon Module Entry Points Solaris 2.x called at Startup

Programs and Kernel Entry points called during startup.

Program Entry Points Module Source

netclink VII etc/netclink.c

STR1open() I kernel/sockets/if/if_str.c

Str_top_put() I "

Str_bot_pu() I "

netcconfig VII etc/netcconfig.c

netc_open() I kernel/sockets/sys/ pd_driver.c

netc_ioctl() I "

ifioctl() I kernel/sockets/net/if.c

netcpass III etc/netcpass.c

netc_open() I kernel/sockets/sys/ pd_driver.c

netc_ioctl() I "

NETC_init() II kernel/netnetc/netcinit.c

NETC_admin() II kernel/netnetc/ netcadm.c

NetCon Module Entry Points Solaris 2.x called during normal operation

Programs and Kernel Entry points called during normal operation.

Program Entry Points Module Source

netcserv IV server/serv/main.c

netc_open() I kernel/sockets/sys/ pd_driver.c netc_ioctl() I "

Str_bot_put I kernel/sockets/if/if_str.c

netcvt/netcorasql IV server/serv/spxvt.c

netc_open() I kernel/sockets/sys/ pd_driver.c netc_ioctl() I "

Str_bot_put I kernel/sockets/if/if_str.c

netcmount III etc/netcmount.c

netc_open() I kernel/sockets/sys/ pd_driver.c

netc_ioctl() I "

NETC_admin() II kernel/netnetc/ netcadm.c

netcon VII menus/menu.c

netcprint III nprint/netcprint.c

Module I - Kernel level IPX/SPX protocol stack.

Introduction

The NetCon IPX/SPX protocol stack is derived from the BSD 4.3 XNS (Xerox Network System) protocol stack with modification to accommodate NetWare.

NetCon has one (1) regular character device that is used as the User level entry point for ALL NetCon processes. This device is never seen or accessed directly by any user programs but instead it is accessed indirectly by making BSD SOCKET system calls from the NetCon socket library "libsock.a". This device "/dev/netcon" is referred to as our PESUDO SOCKET DEVICE and provides the means for all communication between the NetCon User Level daemon/processes/programs and the kernel level NetCon IPX/SPX protocol stack and thus the network. This communication between the NetCon kernel and user processes utilizes the ioctl() system call on the "/dev/netcon" device.

Before the IPX/SPX protocol stack can be used it must be initialized this is done at boot time by the "netcpass" daemon. User level processes have access to the IPX/SPX stack through BSD socket system calls (libsock.a). Before a program can use the network a socket of address family AF_NS type SOCK_DGRAM (IPX) or SOCK_STREAM (SPX) must be opened and bound to a valid IPX/SPX port number and optionally a IPX address if no address is supplied the hosts network number and address are used. After the socket is open and bound to a address then a Socket send() call will send a packet to the network and a socket recv() will post a receive and sleep until awakened by a packet received from the network addressed to the correct IPX port number.

IPX/SPX protocol Pseudo Code

Incoming (Received) Packets

Posting a socket receive Pseudo Code

PROCEDURE USER CODE recv()

(open a socket, bind port number and receive a packet from the network)

     BEGIN
          CALL socket(), Open a socket AF_NS, SOCK_DGRAM, STREAM
          CALL bind(), bind socket to a IPX/SPX port number
          
          
          CALL recv(), post a pending receiver
     END

PROCEDURE KERNEL CODE  recv()
     (post a pending receive in the kernel to receive a packet)
     BEGIN
          CALL copyin, copy uio structure from user to kernel space
          CALL receivit(),
          CALL soreceive(), to post receive to socket
          CALL  sleep(), wait to be awoken by incomming data
          CALL copyout(), copy  receive data to user
     END

Receiving a data packet Kernel Pseudo Code

PROCEDURE KERNEL CODE STR_bot_put();
     (Stream module entry point called from network card driver, putnext())
BEGIN
     IF M_DATA 
          drop 14 byte Ethernet header form RAW 802.3 packet
          CALL putq(), queue packet on read queue
          return
SWITCH (PRIMITIVE) {
     CASE DL_UNITDATA_IND:
          call putq()
     
     
}
END

PROCEDURE KERNEL CODE STR_bot_srv();
     (Stream module read queue service routine scheduled after a putq())
BEGIN
     LOOP
          dequeue packet with getq()
          call STR_recv()
END

PROCEDURE KERNEL CODE STR_recv();
     (Stream module packet receive routine)
BEGIN
     check interface is running
     adjust token-ring packet
     CALL mutex_enter() 
     add mbuf wrapper to mblks
     CALL nsinput()
     CALL mutex_exit()
END

PROCEDURE KERNEL CODE nsinput();
     (IPX/SPX input routine)
BEGIN
     check for runt packets
     get IPX packet length
     check for ODD packet length and adjust to correct IPX packet length
     process IPX checksum
     IF packet is a broadcast and should be routed
          CALL idp_forward()
     IF packet is NOT our packet
          CALL idp_forward()
     CALL NETCinput(), Client packet input 
     IF Client packet 
          return
     CALL nspcblookup(), lookup pending IPX/SPX receives
     SWITCH(packet type)
          CASE IPX receive pending for port number
                CALL idp_input()
                return
          CASE SPX receive pending for port number 
               CALL spp_input()
               return
     free packet
END

PROCEDURE KERNEL CODE idp_input()
     (IPX server input routine called from nsinput)
BEGIN
     drop IPX header
     CALL sbappendaddr(). queue data on pending receive queue
     CALL sorwakeup(), wakeup receive queue
     return
END

PROCEDURE KERNEL CODE spp_input()
     (SPX server input routine called from nsinput)
BEGIN
END

Outgoing (Send) Packets

Outgoing Send packets Pseudo Code

PROCEDURE USER PROCESS send()
     (send a IPX/SPX data packet to the network)
BEGIN 
          CALL socket(), open a socket
          CALL bind(), bind socket to a port number
          CALL send() or sendto(), to send the packet
END

PROCEDURE KERNEL CODE send()
     (send a data packet to the network)
BEGIN
          CALL copyin(), copy uio structure from user to kernel
          CALL sosend()
END

PROCEDURE KERNEL CODE sosend()
     (send a data packet to the network)
BEGIN
     check state, connection and free buffers
     LOOP(data to send)
          CALL allocb(), allocate a packet buffer for the data (mblk_t)
          CALL uiomove(), copy data from user space to mblk_t
          CALL pr_usrreq(), ipd_usrreq for (IPX) or spp_usrreq for (SPX), req = PRU_SEND.
END

PROCEDURE KERNEL CODE idp_usrreq()
     (process IPX user request)
BEGIN
     check for rights and connection
     SWITCH(request)
          CASE PRU_SEND
               CALL idp_output()
          
          
          
END

PROCEDURE KERNEL CODE idp_output()
     (send IPX data packet)
BEGIN
     CALL allocb(), allocate mblk_t for IPX header, fill in add to front of data mblk_t
     allocate and fill out a routing structure for packet
     CALL ns_output()
     Determine the hardware interface on which to send packet from route
     CALL allocb(), allocate mblkt_t and fill with MAC header add to front of IPX header.
     CALL allocb(), allocate mblk_t and fill with LLI/DLPI header add to front of MAC header.
     CALL putnext(), calls the hardware drivers write put routine to write the packet to the network
     IF MAC address equals broadcast or our address
          CALL nsinput(), loopback client to server
END

Streams Functions

STR1open()

STR1close()

STR_top_put()

STR_bot_srv()

STR_bot_put()

Socket Function

sockets()

bind()

send(), sendto()

recv(), recvfrom()

accept()

connect()

setsockopt()

Module I IPX/SPX Entry points

Boot Time, initialization (Administration) Entry Points Solaris only.

Structure dev_ops <sys/devops.h>

/dev/str*_* /dev/netcon

_init _init _init

_fini _fini _fini

getinfo Strgetinfo netc_getinfo

identify Stridentify netc_identify

probe Strprobe -

attach Strattach netc_attach

detach Strdetach netc_detach

RunTime

Structure; Solaris cb_ops <sys/devops.h>

SCO cdevsw <sys/conf.h>

streamtab, qinit <sys/stream.h>

open - netc_open

close - netc_close

read - netc_read

write - netc_write

ioctl - netc_ioctl

streamtab STR1info

Stream Write (To Network, outgoing control or packets)

put STR_top_put -

service - -

open STR1open -

close STR1close -

Stream Read (From Network, incomming packets)

put STR_bot_put -

service STR_bot_srv -

open - -

close - -

Module II - Kernel level Loadable TFS network file system.

Introduction

The NetCon TFS file system is implemented in two ways. The first is the older AT&T system V release 3.2 "file system type switch table" which utilizes the inode abstraction to describe files and directories. The second is the newer VFS virtual file system developed by SUN and UC at Berkeley and now a part of AT&T System V release 4. The VFS file system uses vnodes rather than inodes to describe files and directories. The main difference between inodes and vnodes is the OS allocates and maintains the network vnodes and passes a pointer to them with each call while the TFS file system must allocate and maintain its own inodes.

The TFS file system operations are too numerous and complex to attempt to describe in this document. For details on any of the TFS procedures refer to the source code using the Entry points shown in their chapter as a guide. We will, however, attempt to describe the general procedure for mounting a NetWare Server volume as a Unix directory and what occurs when a Unix user attempts to use the mounted NetWare directories..

Module II TFS file system Entry points

Structures; Solaris vfsops <sys/vfs.h>, vnodeops <sys/vnode.h>

SCO fstypsw <conf.h>

Procedure SCO Solaris AIX NETCcall

mount TFSmount TFSvfs_mount TFSaix_mount

unmout TFSumount TFSvfs_umount TFSaix_umount

root - TFSvfs_root TFSaix_root

statvfs - TFSvfs_statfs TFSaix_statfs

init TFSinit -

iput TFSiput TFSsun_remove

iupdate TFSiupdate -

readi TFSreadi TFSsun_rd

writei TFSwritei TFSsun_wr

truncate TFSitrunc -

statf TFSstatf

namei TFSnamei

openi TFSopeni TFSsun_open

closei TFSclosei TFSsun_close

update TFSupdate -

access TFSaccess - TFSaix_access

getdirentries TFSgetdents TFSsun_readdir TFSgetdents

allocmap TFSallocmap - TFSaix_map

freemap TFSfreemap - TFSaix_unmap

readmap TFSreadmap -

setattr TFSsetattr TFSsun_setattr TFSaix_setattr

notify TFSnotify -

fcntl TFSfcntl -

fsinfo TFSfsinfo -

ioctl TFSioctl TFSsun_ioctl TFSaix_ioctl

security TFSsecurity -

select - TFSsun_select, TFSaix_select

getattr - TFSsun_getattr, TFSstatf

lookup - TFSsun_lookup, TFSaix_lookup

create - TFSsun_create, TFSaix_create

link - TFSsun_link, TFSaix_link

rename - TFSsun_rename, TFSaix_rename

mkdir - TFSsun_mkdir, TFSaix_mkdir

rmdir - TFSsun_rmdir, TFSaix_rmdir

getdents - TFSgetdents, TFSgetdents

symlink - TFSsun_symlink, TFSaix_symlink

readlink - TFSsun_readlink, TFSaix_readlink

fsync - TFSsun_fsync, TFSaix_fsync

rele - TFSsun_rele, TFSaix_rele

fid - TFSsun_fid, TFSaix_fid

rwlock - TFSsun_rwlock,

rwunlock - TFSsun_rwunlock,

seek - TFSsun_seek,

cmp - TFSsun_cmp,

frlock - TFSsun_frlock,

space - TFSsun_space,

realvp - TFSsun_realvp,

getpage - TFSsun_getpage,

putpage - TFSsun_putpage,

map - TFSsun_map, TFSaix_map

addmap - TFSsun_addmap,

delmap - TFSsun_delmap, TFSaix_unmap

poll - TFSsun_poll,

dump - TFSsun_dump,

pathconf - TFSsun_pathconf,

pageio - TFSsun_pageio,

ctl - TFSsun_ctl,

Mounting a NetWare Volume as a Unix Directory

Mounting a NetWare volume is accomplished by issuing a "netcmount" command.

Example:

# netcmount netware:sys:/ /mnt

This command will issue a mount() system call for a "TFS" file system with the correct syntax for the particular operating system which in turn will call the "TFS" mount entry point. The following Pseudo Code is an example for a VFS file system, the file "system type" is similar.

Mounting a NetWare Volume Pseudo Code

PROCEDURE KERNEL CODE TFSvfs_mount()
     (mount a TFS file system)
BEGIN
     CALL mutex_enter(), mutual exclusive lock text/executable
     TEST user is root
     TEST mount point is a directory not a file
     TEST valid mount data structure
     CALL copyin(), to copy the mount data structure from user the kernel space
     CALL TFS_cmount()
     CALL mutex_exit(), unlock text
END

PROCEDURE KERNEL CODE TFS_cmount()
     (mount a TFS file system)
BEGIN
     TEST that TFS file system is started/initialized
     LOCATE the TFS_fsinfo structure,
     CALL copyin(), copyin mount point and remote server, volume, dir
     CALL NETC_mount(), TFS_fsinfo->nf_mount() yet another switch table
END

PROCEDURE KERNEL CODE NETC_mount()
     (mount a NetWare volume)
BEGIN
     GET server name, volume and directory
     CALL TFSgetfreei(), get network inode SET ops to TFSsun_vnodeops
     CALL NETC_gen_dir_inum(), get a unique vnode number
     CALL NETC_init(), initialize if netcpass did not
     CALL NETC_getconnbyname(), connect and login to NetWare server
     CALL NETC_create_dir_handle, map a netware volume
     fill in vnode structure and directroy point ISROOT
     CALL makedevice(), new major, minor for mount dir
END

Changing Directory to a NetWare Directory.

Changing Directory to NetWare Pseudo Code

PROCEDURE KERNEL CODE  access()
     (change dircctory to a mounted a NetWare volume vnodeops "access" is called)
BEGIN
     CALL TFSsun_access(), called by O/S from "access" entry in TFSsun_vnodeops
END

Module III - User level Client utilities.

Introduction

The NetCon client utilities provide the essential services required for a Unix system to perform as a NetWare client. As with DOS most of the important data structures required by the NetCon client reside in the kernel code. These data structures are the Server, Connection and User table. The "netcpass" daemon provides a means to update the tables from the user space that is to say the NetCon Servers BINDERY database. The "netcmount" utility allows mounting/mapping of a NetWare volume and netcprint will print to a NetWare printer. Details of the use of each of the utilities are provided in the "Users Guide" and the "Command Reference" manuals.

Password Mapping daemon "netcpass" Pseudo code

PROCEDURE USER CODE netcpass main()
     (map Unix uid to NetWare Object id)
BEGIN
     Process options;
     -a      Turn OFF automatic default users and groups for each Server
     -d     Turn on debugging print out
     -f     First time netcpass run to skip restart and run netcinit()
     -o     Old use "/usrl/lib/netcon/netcpasswd" file not BINDERY for mapping
     IF NOT -f option
          KILL currently running netcpass
     IF -f option
          BEGIN
          CALL netcinit(), Initialize kernel & send SAP, if not initialized
          SLEEP 30 seconds, Wait for all SAP replies to be received
          END
     CALL netcinit(), No affect if -f option
     SLEEP 2 seconds
     OPEN /usr/lib/netcon/.TFS_LOG, fifo file for interprocess communication
     IF -o Old mapping file THEN
          BEGIN
          Read and Parse Old password mapping file "netcpasswd"
          FOR each line parsed:
               Make a connection to named server
               Get User/Group Objid/uid from Bindery/getuid
               Add entry to Kernel Mapping table.
          END
     ELSE
          BEGIN
          IF NOT -a option, auto mapping enabled THEN
               BEGIN
               Make a loopback connection to our server
               WHILE (Reading Servers Objects (4) from BINDERY)
                    Create 3 MAPPED_USER Property for each Server, user, group, world default mapping IF none exist
               END
          Make a loopback connection to NetCon server
          Get User/Group Objid/uid from Bindery/getuid
          ADD entry to Kernel Mapping table, if not already there
          Disconnect from NetCon server
          END
LOOP FOREAVER:
     BEGIN
     WAIT for signal SIGINT IF received THEN: 
          Read from pipe fifo file, mapping entry
          Make a loopback connection to NetCon server
          Get User/Group Objid/uid from Bindery/getuid
          ADD/UPDATE entry to Kernel Mapping table
          Disconnect from NetCon server     
     WAIT for Request from Kernel IF received THEN:
          Read from Kernel mapping entry
          Make a loopback connection to NetCon server
          Get User/Group Objid/uid from Bindery/getuid
          UPDATE  entry to Kernel Mapping table
          Disconnect from NetCon server     
     END
END

NetWare Server:Volume mount utility "netcmount" Pseudo Code

PROCEDURE USER CODE netcmount main()
     (Mount NetWare Server:Volume as a Unix directory)
BEGIN
     Process options
          Must have at least Three arguments program, remote directory, local directory
          Must have Two colons ":" in remote directory string
          -r     Read Only
     Remove leading "/" slashes and convert to Remote to Upper case
     BUILD a mnt structure
     GET File-System number for type "TFS"
     CALL mount(), for type "TFS" 
     UPDATE "/etc/mnttab"
END
     

NetCon NetWare print utility "netcprint" Pseudo Code

PROCEDURE USER CODE netcprint main()
     ()
BEGIN
     Process options
          -d      Debugging output on to STDOUT
          -s [server_name}     NetWare Server name required
          -q [queue_name]     NetWare Printer/Queue name Required
          -j [job_name]     Jobname
          -t [title]     Title     
          -n [copies]     Numbers of Copies
          -u     Quit no output
     Create a connection to Netware Server
     Login to NetWare server using mapping entries
     Check "/SYS/MAIL/USER_OBJECTID/PRINTCON.DAT" if exist use printer configuration
     Check "/SYS/PUBLIC/NET$PRN.DAT" if exist get printer defintion
     GET printer initialization/reset sequence
     GET form name
     GET queue ID
     GET Print server name
     FILL in JOB and FORM structures
     MAIN LOOP WHILE  GET ARGUMENTS (files to print)
          BEGIN
               CREATE a print queue JOB entry on the server, set to NOT_READY
               CREATE/OPEN a print queue file on server
               Write local file on STDIN to print queue file on server
               CLOSE print queue file on server
               SET print queue JOB entry on server to READY
          END
END

NetCon menu utility "netcon" Pseudo Code

PROCEDURE USER CODE netcon main()
     ()
BEGIN
     Process options
END

Module IV - User level Server Services.

File and Bindery Server Daemon Pseudo Code

PROCEDURE USER CODE netcserv main()
     (NetCon file and bindery server Daemon )
BEGIN
     Process options
          -c     Caching OFF
          -d     Debugging on
          -s     Turbo-Write OFF
          -w {SAP_wait_time] Wait time in sec for SAP reply
          -a [Device]     Turbo device
          -t [queue_timeout]     Print queue timeout 600sec
          -r     RIP broadcast OFF
          -p     Printing OFF
          -o [Oracle_port]     Oracle SQL SPX port number for SAP
          -i [internal_net_number]     Internal Network Number default 0xaaff
     SET umask 000
     SET signals 
     INITIALIZE connection list
     READ volumes to export for "/usr/lib/netcon/netcexport"
     OPEN BINDERY read into SHARED VIRTUAL MEMORY, "/usr/lib/netcon/*.dat
     IF NOT -p option THEN
          CALL lpstat -t read printers Set up Print servers and Print Queues
     REBUILD Bindery from Unix users and groups
     CALL RIP(), Start RIP Daemon
     CALL SAP(), Start SAP DAEMON
     CALL PSERVER(), Start a Print server for each Unix Spooler
     CALL setpgrp(), Set new process group
     FORK(), parent exits child continues
     CALL socket(AF_NS, SOCK_DGRAM, 0), Open a IPX socket
     CALL setsockopt(DONT_ROUTE), send directly to interface
     CALL bind(), Bind to Net INTERNAL_NET_NUMBER, Host 0, Port 0x451
     CALL setsockopt(), Get Socket header on input
     MAIN LOOP CONNECTION REQUEST: Forever
          BEGIN
               CALL recvform(), WAIT to receive a CONNECTION request from network
               IF SIZE OK and CONNECTION request THEN:
                    BEGIN
                    GET ROUTING and IPX HEADER
                    SET connection table
                    FORK parent CONTINUES
                    CHILD CALL server(), file/bindery server
                    END
               ELSE
                    SEND error, CONTINUE
     END
END

PROCEDURE USER CODE server()
     (Main File/Bindery server LOOP)
BEGIN
CALL socket(AF_NS, SOCK_DGRAM, 0), open a new socket
CALL connect(), Set Kernel connection table with Remote Client Address/Local Address associated.
CALL setsockopt(), set DEFAULT_HEADERS, DONT_ROUTE, Buffer to 32K
CALL getsockname(), Get the local address
CALL bind(), Bind to Net:  Internal_net_number, Host: 1, Port: 0x451
SET up connection table
SET up Request/Reply Structures
OPEN RAW DEVICE for TURBO writes
CALL MakeDirectoryHandle(), Set up SYS:LOGIN
CALL conn_reply(), Send connection reply
MAIN SEVER LOOP FOREVER:
     BEGIN
     CALL recvfrom(), WAIT for request for Client
     Check packet size, Drop if small
     IF Sequence Number = last Sequence Number Then
           SEND error reply, continue
     SET New Sequence and Task Number
     IF PACKET TYPE 0x2222 REQUEST THEN:
          BEGIN
          CALL Request(), Process NCP request
          CALL Reply(), Send Reply to Request Back to Client
          CONTINUE
          END
     ELSE IF PACKET TYPE 0x5555 or 0x1111 THEN: Disconnect or new Connect 
          EXIT
     END
END

SAP Server Pseudo Code

PROCEDURE USER CODE sap()
     (Service Advertising Protocol Server Daemon)
BEGIN
SET Signals
CALL socket(), Open a socket
CALL ioctl(), Get interface address
GET Internal Net Number
CALL add_fileserver_to_bindery(), Add file Server Name and Address to BINDERY
CALL setsockopt(), Set BROADCAST, DONT_ROUTE
CALL bind(), Bind to SAP port 0x452
     FORK A NEW PROCESS
          CHILD MAIN LOOP FOREVER:
               BEGIN
               CALL setpgrp(), Set process group
               CALL recvform(), WAIT to receive a SAP request
               SWITCH SAP TYPE;
               CASE RESPONSE:
                    CALL add_fileserver_to_bindery()
               CASE QUERY:
                    CALL send() ,Send SAP reply.
               END
     PARENT MAIN LOOP FOREVER:
          BEGIN
          CALL add_fileserver_to_bindery(), ADD/Update entry
          CALL send(), Send SAP packet
          CALL send(), Send RIP packet
          SLEEP 30/60 seconds
          END
END

RIP Server Pseudo Code

PROCEDURE USER CODE rip()
     (Routing Information Protocol Server Daemon)
BEGIN
SET Signals
CALL socket(), Open a socket
CALL ioctl(), Get interface address
CALL setsockopt(), Set BROADCAST, DONT_ROUTE
CALL bind(), Bind to RIP port 0x453
MAIN LOOP FOREVER:

BEGIN

CALL recvfrom(), WAIT to receive a RIP packet

          SWITCH RIP TYPE;
               CASE RESPONSE:
                    Add routing entry to Kernel routing Table
               CASE QUERY:
                    CALL send() ,Send RIP reply.
          END
END

Print Server Pseudo Code

PROCEDURE USER CODE pserver()
     (NetCon Print Server Daemon)
BEGIN
     CALL serpgrp(), Set Process group
     WHILE READ READ UNIX Printers from BINDERY
          BEGIN
          CALL fork(), FORK a CHILD PROCESS for each Printer
          END
     Parent process Exits
     CHILD MAIN LOOP FOREVER:
          BEGIN
          CALL open(), OPEN printer Status file
          WHILE READ Jobs in Printer Status File
               CALL service_queue(), Service print queue
          SLEEP 30 seconds
          END
END
PROCEDURE USER CODE service_queue()
     (Print server queue service routine)
BEGIN
CALL GetBinderyObject(), Get Print queue object id
CALL open(), Open queue status file "/sys/system/objid.qdr/qstatus.sys"
CALL read(), Read queue status file get JOB NUMBER
IF PRINT JOBS PENDING THEN
     BEGIN
     CALL MakeJobDescriptionFile(), Make a file name "/sys/system/QUEUE_OBJID.qdr/JOB_NUMBER.job"
     CALL open(), Open Job File
     CALL read(), Read Job header
     IF JOB is NOT_READY THEN
          IF JOB IN QUEUE UNDER 10 minuts
               EXIT
     IF JOB NOT FOR THIS SERVER 
          EXIT
     DECREMENT JOB COUNTER
     DELETE Job Description File
     CALL system(lp), Execute lp on job file
     SLEEP 5
     DELETE Job File
     END
END

Terminal Server Pseudo Code

PROCEDURE USER CODE netcvt main()
     (SPX terminal Server Daemon)
BEGIN
     Process options
          -d     Debugging output to STDOUT
          -s [Start numbert}     Start Out Pseudo TTYS at this number
     FORK A NEW PROCESS, Disassociate for controlling terminal
     PARENT Exits
     CALL socket(), Open a SPX socket AF_NS, SOCK_STREAM, 0
     CALL bind(), Bind to Port 0x85fa
     CALL listen(),  To listen for a SPX Connection request on this Port
     MAIN LOOP FOREVER:
          BEGIN
          CALL accept(), Wait for a connection request on Port
          FORK WRITER, Start a Writer process
          END
     WRITER:
     CALL get_ptty(), Get the Next free Pueudo tty
     CALL execl(/bin/ogin) on pseudo tty
     FORK READER, Fork a Reader process/thread
     PARENT WRITER LOOP WHILE recv() FROM NetWork
          CALL write(), Write data from Network to Pseudo tty
     CHILD READER LOOP WHILE read() FROM Pseudo tty
          CALL send(), Send data read for Pseudo tty to NetWork
END

SQL IPX/TCP Interface Pseudo Code

PROCEDURE USER CODE netcorasql main()
     (SQL SPX/TCP/IP Interface Daemon)
BEGIN
     Process options
     FORK A NEW PROCESS
          CHILD MAIN LOOP FOREVER:
          BEGIN
          END
     PARENT MAIN LOOP FOREVER:
     BEGIN
     END
END


       
      





Module V - DOS Multiscreen Terminal Emulator


DOS Virtual Terminal Emulator ncterm Pseudo Code

PROCEDURE  DOS CODE ncterm main()
        (DOS Network Terminal Emulator)
BEGIN
        Load color configuration data, if any (file: ncterm.cfg).
        Determine video and keyboard types.
        Process command-line options:
                -v              Show version.
                -x DebugMask    Turn on debug display.
                -1              Single-session only; no multi-screens.
                -e Emulate      Select startup emulation (default = ANSI).
                -m MouseFile    Mouse-translation file.
                Server          Name of terminal server.
                UserName        Login name.
                Password        Login password.
        Check mouse availability and initialize, if -m request.
        Verify SPX installation.
        Open IPX socket.
        IF command-line server supplied,
                Connect to server.
        IF command-line username and password supplied,
                Login to server.
        IF now connected to a server,
                Set menu-selection to Terminal Mode.
        ELSE
                Display menu.
        MAIN LOOP until user requests termination.
        BEGIN
                (Process user menu selections.)
                CASE menu-selection
                        Terminal Mode:
                                Call term() - terminal emulator function.
                                IF NOT program-exit return from term(),
                                        Save terminal screen.
                                        Display menu.
                        Emulation:
                                Cycle to next available emulation.
                                Call emulation initialization function.
                        Capture:
                                IF capture is OFF
                                        Prompt for pathname of a capture file.
                                        Save subsequent terminal input into
                                        this file.
                                ELSE (capture is ON)
                                        Stop saving terminal input to capture
                                        file.
 Display menu.
        MAIN LOOP until user requests termination.
        BEGIN
                (Process user menu selections.)
                CASE menu-selection
                        Terminal Mode:
                                Call term() - terminal emulator function.
                                IF NOT program-exit return from term(),
                                        Save terminal screen.
                                        Display menu.
                        Emulation:
                                Cycle to next available emulation.
                                Call emulation initialization function.
                        Capture:
                                IF capture is OFF
                                        Prompt for pathname of a capture file.
                                        Save subsequent terminal input into
                                        this file.
                                ELSE (capture is ON)
                                        Stop saving terminal input to capture
                                        file.
                                        Close capture file.

                        Call DOS:
                                Spawn a DOS command.com shell. Any                                    terminal
                                sessions are suspended but not disconnected.
                                Type EXIT at the DOS prompt to return to the
                                ncterm session.
                        Hangup:
                                Close the terminal session in the
                                currently selected multi-screen.
                        Quit:
                                Cleanup and exit ncterm.
                ENDCASE
        END
END

PROCEDURE DOS CODE ncterm term()
        (Terminal Emulation function)
BEGIN
        Display terminal screen.
        Prompt for server if not connected.
        LOOP WHILE NOT terminal-mode exit request
                Send network input to emulator for display.
                Keyboard input received from emulator is output to network.
                Process terminal-mode keyboard commands:
                        ^Home           Exit terminal mode, display menu.
                        ^PrintScreen    Toggle printer ON/OFF.
                        ^S/^Q           User XON/XOFF request.
                        <Alt>1,2, or 3  Switch to another multi-screen.
                        <Alt>H          Hangup current session.
                        <Alt>Q          Quit ncterm, closing all sessions.
        ENDLOOP

     Close the terminal session in the currently selected multi-screen.
Quit:
     Cleanup and exit ncterm.
ENDCASE
     END
END

PROCEDURE DOS CODE ncterm term()
     (Terminal Emulation function)
BEGIN
     Display terminal screen.
     Prompt for server if not connected.
     LOOP WHILE NOT terminal-mode exit request
          Send network input to emulator for display.
          Keyboard input received from emulator for display.
          Process terminal-mode keyboard commands:
               ^Home          Exit terminal mode, display menu.
               ^PrintScreen     Toggle printer ON/OFF.
               ^S/^Q          User XON/XOFF request.
               <Alt>1,2 or3     Switch to another multi-screen.
               <Alt>H          Hangup current session.
               <Alt>Q          Quit ncterm, closing all sessions.
     ENDLOOP
END

Module VI - DOS Client Utilities


NCLOGIN>EXE Pseudo Code

PROCEDURE DOS CODE nclogin main()
     (DOS Login to NetCon Server)
BEGIN
     Verify brand
     Process options:
               -d               Turn on debug display.
               Server          Name of server to login to.
               UserName     Login name.
               Password          Login password
          IF no user specified,
               Prompt for login name.
          Get default connection id from netware driver.
          IF a server was specified,
               Attach to server.
               IF already attached,
                    Get connection id for this server.
               Set preferred connection id to id just obtained.
          Login to server.
          IF login failed (0xff) and we have a password,
               Convert password to uppercase.
               Login to server.
          IF login failed,
               Exit program.
          IF default connection id not same as current connection id,
               Detach from server on default id.
               Set Primary and Preferred connection id to current id.
          FOR all local drives with a directory handle,
          Deallocate directory handle.
          Set current drive to network drive (if the current drive is a                local drive, the local drive will be hidden until the network                drive is unmapped or logged out).
END

NCMAP.EXE Pseudo Code
PROCEDURE  DOS CODE ncmap main()
        (DOS Drive Mapping to NetCon Server)
BEGIN
 Save preferred connection id.
        Process options:
                x               Turn on debug display.
                d:=[server/]pathname    Map drive d: to server/pathname.
                DEL d:          Unmap drive d:.
        IF no command-line arguments,
                SHOW current mapped drives.
        ELSE IF this is a DEL (delete mapped drive) request,
                FOR each mapped drive specified,
                        Deallocate the associated directory handle.


ELSE
                FOR each drive mapping requested,
                        Call NetWare to ADD the drive mapping.
                        Get user's login info and log user in, if necessary.
        Restore preferred connection id.
END

NCAPTURE.EXE Pseudo Code

PROCEDURE  DOS CODE ncapture main()
        (DOS Printer Redirector to NetCon Server)
BEGIN
        Process options and arguments:
                S=server        Server name.
                Q=queue         Queue name.
                L=num           LPT number: 1, 2, or 3.
                SHow            Display current printer redirection status.
             Off=num|ALL     Stop redirection of specified LPT# or all.
                T=time-out      Set time-out seconds from 1-1000, or 0 = off.

NCSLIST.EXE Pseudo Code

PROCEDURE  DOS CODE ncslist main()
        (DOS NetCon/NetWare Server List)
BEGIN
MAIN LOOP - Scan bindery for file servers.
        FOR EACH file server found in bindery,
                Print server name, network address, and connect status.
        END FOR
END

NCLOGOUT.EXE Pseudo Code

PROCEDURE  DOS CODE nclogout main()
        (DOS Logout of NetCon Server)
BEGIN
        IF no command-line arguments,
                Call NW LogOut() - Log out from all logged-in servers.
        ELSE FOR EACH file server named on the command-line,
                Call NW LogOutFromFileServer() to log out of server.
END