Developing NLMs and NetWare Utilities with HiTecSoft's ManageWare
Articles and Tips: article
Senior Research Engineer
Novell Research
01 Sep 1994
HiTecSoft of Scottsdale, Arizona has produced a unique cross-platform development tool called ManageWare. ManageWare allows you to develop network utilities using a high-level, BASIC-like programming language. When your application is running, you can compile the program to run as a DOS utility, or as a NetWare Loadable Module (NLM).
HiTecSoft's ManageWare
ManageWare is a development language and environment from HiTecSoft Corporation of Scottsdale, Arizona. With ManageWare, you can develop NetWare utilities that run as NetWare Loadable Modules (NLMs), or as DOS executables for DOS v5.0 or above. ManageWare allows you to develop and test your applications in an interpreted environment that runs in Microsoft Windows, then when your application is running, compile it to a DOS executable or NLM.
As the name implies, ManageWare is designed to enable network administrators to build customized network management utilities for NetWare. You can also use ManageWare for rapid prototyping of NLMs, which you will then implement in C or assembly language.
ManageWare allows you to perform the following NetWare functions:
Use IPX/SPX to communicate between clients, servers
Get connection information on logged-in users
Establish and clear connections to file servers
Read and change server date and time
Read server information
Down file server
Create, delete, attach to and detach from queues
Submit and service jobs in queues
Read volume information
Read and modify bindery information
Broadcast and receive messages
Advertise via Service Advertising Protocol (SAP)
Call existing NLM code written in C
Your programs can also:
Create, read, and write files and directories
Open, close, read, write, initialize, and test serial ports
Open, close, write, and test parallel ports
Read and write hardware ports
Display C-worthy style windows and menus
Access DBF-format and Btrieve databases
Call external programs
Manipulate strings
Perform mathematical operations
Example Programs
ManageWare ships with source code for a number of utilities that are useful both as example programs and in the functions they perform. The included utilities are described in the table below.
Utility
|
Description
|
INDEX.NML |
Creates theindex file for a Clipper-compatible database. |
TASKMAN and TASKCON |
Task managerand task console utilities that allow youto schedule programs for later execution. Can run as an NLM to run other NLMs, oras a DOS utility to run other DOS programs. |
PHONE.NML |
Network chat utility. |
NetWare Utilities ATTACH.NML PSERVER.NML CHKVOL.NML SLIST.NML FCNSOLE.NML USERLIST.NML LOGIN.NML VOLINFO.NML |
Replicatesmost of the functionality of the correspondingNetWare utility. |
DOS Utilities CD.NML MD.NML CLS.NML RD.NML COPY.NML REN.NML DEL.NML SET.NML DIR.NML TYPE.NML |
When used withManageWare's interpreter (the Open InteractiveShell), duplicates the functionality of thecorresponding DOS utilities on the NetWarefile server console. |
DEBUG.NML |
Provides aninteractive mode, in which you can run runManageWare utilities and check the valuesof memory variables. |
FILEDUMP.NML |
Shows the contentsof any file in hex and text formats. |
VER.NML |
Shows the NetWareversion, connection information, monitortype, and version number of a specified NLM. |
REGISTER.NML |
Registersyour copy of ManageWare. |
GLIST.NML |
Displays allnetwork users and the groups they belong to. |
Obtaining ManageWare
ManageWare can be ordered directly from HiTecSoft:
HiTecSoft Corporation 3370 N. Hayden Rd., Suite 123-175 Scottsdale, Arizona 85251-6632 (602) 970-1025 Fax: (602) 970-6323
The ManageWare Developer SDK currently sells for $895; the ManageWare DOS and NLM interpreters sell for $295. HiTecSoft charges no royalties on compiled programs that were developed with ManageWare.
Software Development with ManageWare
ManageWare is a language, so it is possible for you to write your programs using a text editor, test and debug them under the ManageWare interpreter, then compile them to executable code from the DOS command line. ManageWare also has an integrated development environment (IDE) that runs on Microsoft Windows that provides many advantages over DOS development, so you will likely want to do all development in the Windows IDE. The IDE, called Visual ManageWare, has online help for all ManageWare functions, and allows you to "drag and drop" blocks of code that you have written (code templates, for example), or that are provided with ManageWare.
The Visual ManageWare user interface is shown in Figure 1.
Figure 1: Visual ManageWare Integrated Development Environment.
The main advantage to Visual ManageWare, however, is that it allows you to go through the code-test-debug cycle more quickly than you could in DOS. And because ManageWare applications can be easily ported from DOS executables to NLMs, you can develop, test, and debug your application in the Windows IDE, then compile it to run on a NetWare file server as an NLM.
Example Program: DOBACKUP
The example program given below, DOBACKUP, shows how easy it is to develop a NetWare utility with ManageWare. DOBACKUP schedules a backup program for later execution. Five minutes before the backup program is to be run, DOBACKUP sends a broadcast message to all attached users, warning them to log out of the file server. Just before running the backup program, DOBACKUP repeats the warning, then waits 30 seconds before disconnecting all users still logged in. DOBACKUP can run either as a DOS application, or as an NLM. When running on DOS, DOBACKUP runs a backup program called BACKITUP.EXE; when running as an NLM, DOBACKUP runs BACKITUP.NLM.
DOBACKUP has the C-Worthy style user interface used with many NetWare utilities, as shown in Figure 2.
Figure 2: DOBACKUP user interface.
Source code for DOBACKUP is shown below.
#define MaxConnection 250 #include "KEY.NMH" Proc Main 'Schedule backup for 3:00 a.m.; give 5 min warning WarningTime = "02:55" BackupTime = "03:00" 'Get default file server connection ID connObj = NET:Connection:Get If connObj.Error != 0 Print("Error getting connection ID") Return EndIf connID = connObj.ID 'Get name of default file server serverName = NET:Server:Name(DATA:Integer(connID)) Message1 = "Server " + serverName + " backup in 5 min, please log out" Message2 = "Server " + serverName + " backup starting, log out now!" 'Set up display WIN:Cursor:Hide WIN:Heading:On("Backup Scheduler","Novell Research") Window = WIN:Define(10,10,16,70) WIN:Title("Waiting... Press ESC to Cancel."); WIN:Show WIN:At(2,2); WIN:Say("Backup Scheduled for : ", BackupTime) WIN:At(3,2); WIN:Say("Current time : ") WIN:At(4,2); WIN:Say("Status : Waiting") 'Wait until 5 min before scheduled backup WaitUntil(WarningTime) WIN:At(4,25); WIN:Say("Sending first warning ") 'Send warning message to all logged users BroadcastMessage(Message1) WIN:At(4,25); WIN:Say("First warning sent ") 'Wait until scheduled backup time WaitUntil(BackupTime) 'Disable login If NET:Login:Disable WIN:At(4,25); WIN:Say("Disabled login ") Else WIN:At(4,25); WIN:Say("Unable to disable login ") EndIf 'Send final warning to all users still logged in WIN:At(4,25); WIN:Say("Sending final warning") BroadcastMessage(Message2) WIN:At(4,25); WIN:Say("Final warning sent ") 'Give them another 30 seconds SYS:Delay(30000) 'Log out everyone except me WIN:At(4,25); WIN:Say("Clearing connections ") connNum = connObj.Number connection = 1 Do While Connection <= MaxConnection< If connection != DATA:Integer(connNum) NET:Connection:Clear(connection) EndIf connection = connection + 1 EndDo WIN:At(4,25); WIN:Say("Connections cleared ") 'Load backup program WIN:At(4,25); WIN:Say("Loading backup program ") WIN:Heading:Off SYS:Call("backitup", "") 'Enable login NET:Login:Enable WIN:Cursor:Show Quit Proc BroadcastMessage connection = 1 Do While connection <= MaxConnection< ConObj = NET:Connection:Info(connection) If ConObj.Error = 0 objName = STR:Sub(ConObj.Name,1,10) If NET:Broadcast:Send(Param(1),connection) WIN:At(4,25); WIN:Say("Message sent to ",objName,"[",connection,"]") Else WIN:At(4,25); WIN:Say("Error sending message ") EndIf SYS:Delay(100) EndIf If KEY:Ready Key = KEY:Read If Key = {KEY_ESC} WIN:Heading:Off Quit EndIf EndIf connection = connection + 1 EndDo Return Proc WaitUntil Do While True 'ESC pressed? If KEY:Ready Key = KEY:Read If Key = {KEY_ESC} WIN:Heading:Off Quit EndIf EndIf 'Get current time timeObject = NET:Server:Date:Get NextTime = STR:Sub(TimeObject.Time,1,5) Time = TimeObject.Time 'Display current time WIN:At(3,25); WIN:Say(Time) 'Compare current time with end time If NextTime = Param(1) Exit EndIf EndDo Return
Obtaining Source Code for DOBACKUP
You can download source code DOBACKUP from Compuserve's NOVLIB forum, Library 11. The file is a self-extracting archive, called DN409A.EXE.
* Originally published in Novell AppNotes
Disclaimer
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.