CSI32 Configuration

Introduction

Configuration is held in a conventional Windows "ini" file. The location and name of this file is different depending on the type of system in which CSI32 is deployed - this is a hang-over from the different versions of CSI from which CSI32 is derived.

The table that follows describes what the configuration file is called and where it is located - this list is in order of priority. i.e. if the V4 environment variables are present then this path will be used in preference to the V3 or V2 path.

System | File | Path
V4 | bncs_system.ini | %CC_ROOT%\%CC_SYSTEM%\config\system
V3 | csi.ini | ConfigPath specified in "c:\bncs_config.ini"
V2 | csi.ini | Windows directory (usually c:\windows for Windows XP or c:\winnt for Windows 2000)

Optimum csi.ini/bncs_system.ini file

The trouble is....with so many settings it's hard to define what's the "best config". Here's the (author's version of the) best settings: bncs_system.ini

Changing Configuration

CSI32 has a menu item (Config->EditConfig) to open the default editor for the "csi.ini" or "bncs_system.ini" file. Which file is opened is dependent upon the system type detected.

Configuration changes almost always require a restart of CSI32, though some parameters are available as menu items which may be changed on the fly without a restart and which also modify the appropriate configuration file.

Configuration Parameters Defined

Section / Entry / Default | Description
[Window]
Xpos=0 | The last saved X position of the maximised CSI main dialog box. This is saved every time the dialog box is moved.
Ypos=0 | The last saved Y position of the maximised CSI main dialog box. This is saved every time the dialog box is moved.
[Network]
Workstation=0 | The workstation number for this machine for V2/V3 systems. V4 based system have workstation number as an environment variable
DefaultAdapter=0 | Netbios adapter number
Channel=0 | Sets CSI to use the indicated channel. This can be used to isolate BNCS systems running on the same network. Channel numbers 0 to 99 are valid.
NetworkEnable=1 0 = CSI will run but not attach to the network. A loop back adapter is force on.
1 = CSI will attach to the network as usual. This is the default value.
CSIEnable=1 | Prevents CSI from operating. This is a security function manipulated by the Network Manager application
SessionEnable=1 | If set to 1 sessions are enabled. if set to 0 they are disabled. This item can be toggled from the CSI menu bar.
ClientEnable=1 | If set to 1 CSI will allocate network buffers for receiving revertive information and permit clients to connect to it. if set to 0 network control blocks are freed and clients are denied access This item can be toggled from the CSI menu bar.
DriverEnable=0 | If set to 1 CSI will allocate network buffers for receiving command information and permit drivers to connect to it. if set to 0 network control blocks are freed and drivers are denied access This item can be toggled from the CSI menu bar.
ClientBuffers=20 | The number of network control blocks to be assigned for revertive messages.
DriverBuffers=4 | The number of network control blocks to be assigned for command messages to drivers.
SessionBuffers=8 | The number of network control blocks to be set aside for session purposes
Note: ClientBuffers + DriverBuffers + SessionBuffers should not exceed 32. The total is checked at startup and will flag an error if more than 32
SecBuffEnable=1 | REDUNDANT - CSI32 hasn't got (and doesn't need) secondary buffering.
TerBuffEnable=1 | REDUNDANT - CSI32 hasn't got (and doesn't need) secondary buffering.
LoopbackEnable=0 | If set to 1 it allows CSI to see revertives form its local machine if that machine has been detached from the network and as a consequence windows has disabled the network adapter.
HWMBufferFlush=1 | REDUNDANT - CSI32 hasn't got (and doesn't need) secondary buffering.
HWMCacheFlush=1 | REDUNDANT - CSI32 hasn't got (and doesn't need) secondary buffering.
HangUpDelay=1500 | Session hang up delay timer (mS)
V1Compatibility=0 | If set to 0 it prevents CSI from sending V1 compatible message packets out by default. This cuts down the loading on the network if V1 messages are not used. V1 messages are not picked up on CapLog so you may not be aware of them being generated and hence loading your network. V1 packets will always be received and decoded if they are present on the network.
TempFilePath=C:\csi_temp | The path to be used for storing temporary files used during sessions
KeyFilePath= | Path to use for the bncs_key.dat licence file. If this path is not specified then the working directory of CSI32 is used
SendPacketSerialNumbers=0 | Whether to send "revertive" packet serial numbers.
SendCommandSerialNumbers=0 | Whether to send command packet serial numbers
ClearCacheOnNetClose=0 | Whether to clear the revertive cache on a driver closing (and sending NC message).
ClearCacheOnPacketError=0 | Whether to clear the cache if we detect that we've missed packets from a particular workstation and cannot rely on cached data for devices that workstation hosts.
DistributeBBC_NETTXRXSTATUS=1 | Whether to distribute the internal message BBC_NETTXRXSTATUS to all clients on reception of a network 'N' message. If you don't use this (ApplCore line 32400 handling) then turn it off. Distributing 'N' message notifications to all clients even if none are interested is inefficient. Even with this distribution disabled by this setting you can still selectively register using BBC_NETTXRXSTATUS_REG
DistributeBBC_NETMSGUPDATE=0 | Whether to distribute the internal message BBC_NETMSGUPDATE to all clients on reception of a network 'N' message. Distributing 'N' message notifications to all clients even if none are interested is inefficient. Since ApplCore doesn't use this the default is zero. Even with this distribution disabled by this setting you can still selectively register using BBC_NETMSGUPDATE_REG
HeartbeatEnable=0 | Whether to send heartbeat messages - heartbeats contain workstation information (uptime) and driver information (txrx state).
HeartbeatTimeout=60 | How often in seconds to send heartbeat messages. Heartbeats are sent both to clients and to drivers and this value is the total period to send to either. Messages sent to clients/drivers are interleaved so for a machine with clients and drivers enabled the effective period is half this value.
StatusChannelEnable=1 | Whether to send status channel messages - these are 6 packets/minute usually picked up by the BNCSSTAT application. If you don't use BNCSSTAT or are using heartbeat monitoring instead then you can disable status channel
[Cache]
CacheEnable=1 | If set to 1 then caching is enabled. If set to 0 it is disabled
CacheSize=8192 | This is the largest amount of RAM in KB that CSI will allow to be allocated for a cache. A value of 8192 permits all devices to be cached. A value of 1024 (the old default for this setting) only allows only 100 of the 999 devices possible to be cached.
CacheLife=10 | This is the life in minutes that the cache for a driver Id within CSI will remain valid without a "revertive" message being received for that Id. A value of zero sets cache life to be infinite (i.e. never expire).
CacheFilePath=C:\ | The InfoDriver cache is stored on the hard disk to conserve RAM. This parameter sets the path to the files
PeerPollRefresh=0 | Whether we decode and interpret poll responses meant for another workstation. The received value is compared against any cached value and if different passed up to our clients as if it were change of state. Turning this feature on also generates logs since differences between received values and cached values can indicate a fault.
UseMemoryCache=1 | Whether infodriver cache is written to disk (UseMemoryCache=0) as it always was or stores infodriver revertives only in memory (UseMemoryCache=1)
[LogFile] | The facility was removed in version 1.16.07 when CapLog was introduced
LogFileEnable=0 | If set to '1' the logging function will be enabled the next time CSI is started
LogFile=C:\CSI_LOG.TXT | The path and filename to the log file
MaxLogFileSize=5 | This the maximum size in MB for the log file. If writing to the log file would cause the file size to be exceeded it will be closed and no further writes will take place
[TimeServer]
TimeServerEnable=0 | If set to '1' the time server function will be enabled the next time CSI is started.
TimeServerPeriod=60 | This is the period in minutes between messages sent from the server to clients.
[Diagnostics]
DiagMode=0 | If set to 1 then the CSI didialog boxields are enabled and will update once per second. If set to 0 the fields will be grayed out and will not update. This item can be toggled from the CSI menu bar.
DiagModeExtend=0 | If set to 1 then a lilist boxppears below the normal dialog box showing files waiting to be transferred to remote workstations. This item can be toggled from the CSI menu bar.
DebugMode=0 | If set to 1 then extra debugging information is sent to the console. This item can be toggled from the CSI menu bar.
[Misc]
ClosedownDelay=0 | This delay (in seconds) will allow CSI time to close down cleanly. The CSI window will disappear immediately but CSI will still be active for the period set.
WatchDogComPort=0 | This tells CSI which port the BNCS WatchDog is attached to. The WatchDog is a piece of hardware made by BNCS that talks to CSI periodically, if CSI doesn't respond the WatchDog restarts the PC.
DisableWatchDogOnExit=0 | If set to 1 it prevents the Watchdog restarting the PC if CSI is closed down properly (Available from CSI version 1.20.09)
TxRxRetryPeriod=60 | This is CSI's background polling delay in seconds for devices on its machine. After the delay period set (default 60) CSI polls a device and if it responds CSI issues a NA message with the device number and the workstation number eg NA 800 041, device 800 is present on Workstation 41. Note that CSI cycles through its devices one per TxRXRetryPeriod. So for 10 devices and a period of '60' it will take 10 minutes to announce all devices. This is designed to keep network traffic down to a minimum. If a driver is shut down properly then it will be announced immediately.
MaxClients=1024 | The maximum number of clients used to restrict the number of ApplCore panels running to protect system resources
CompileHighOrderDBs=0 | Whether to read and create temporary cache files for the "upper" databases db2 to db9. This has no effect if UseMemoryDatabaseOnly is enabled
[SelectiveCache]
Index_XXX=1 | Allows you to selectively turn the cache on (1) or off (0) for a given device number where XXX is the device number (between 1 and 999).
[PacketRecovery]
TxRecoveryWindow=100 | How many messages this workstation should remember for possible retransmission
MaxRecoveryMessageHoldoff(ms)=2000 | Timer that runs to send packet recovery requests.
SimulateUnreliability=0 | The trouble with development networks is that they are too reliable for testing - this flag (and the following parameters) set CSI32 to be unreliable to prove packet recovery works (or not)
UnreliabilityTxRate=10 | How many packets to send without error
UnreliabilityTxCount=2 | The number of consecutive errors
UnreliabilityRxRate=11 | The number of packets to receive without error
UnreliabilityRxCount=2 | The number of consecutive receive errors
Enable=0 | Whether the packet recovery feature is enabled
MaxRecoveryRequests=5 | How many times to send packet recovery requests before giving up
RecoveryRequestRepeatRate(ms)=2000 | Minimum time between retrying packet recovery requests the initial request is sent within MaxRecoveryMessageHoldoff(mS)
MaxRecoveryPacketsPerTick=2 | Maximum number of recovery packets to send each timer tick (100mS)
[Status]
DeviceInfodriverId=124 | Internal infodriver which delivers device status information to CSI clients. See information on Status Infodrivers
WorkstationInfodriverId=123 | Internal Infodriver which delivers workstation status information to CSI clients.
StartupDelay(secs)=61 | How long after CSI startup the internal infodrivers will display "starting". This value must be non-zero and should be the same as the longest HeartbeatTimeout setting (see above) on the system - typically 60 seconds (+1 ensures that there's no chance of coincident startup delay/heartbeat timer showing false status).
[Database]
UseMemoryDatabaseOnly(no_V1_support)=0 Whether to use alternative database functions that load database files into memory on the fly and do not require to either create, load, or use CDF files. There is no support for little used V1 database names
With memory databases enabled "Router Index" (name to numerical index) is available on all levels
With memory databases enabled you can have up to 65536 (0 to 65535) database levels
[WindowsMessaging]
HWND_BROADCAST_NETSTATUSMSG=1 | Whether to broadcast BBC_NETSTATUSMSG messages when the network fails/returns. Turn this off unless you use it
HWND_BROADCAST_CSICLOSEWARNING=1 | Whether to broadcast BBC_CSICLOSEWARNING messages as CSI is closing. Turn this off unless you use it
HWND_BROADCAST_APPREADY=1 | Whether broadcast BBC_APPREADY messages when CSI has started. V3Launch requires this enabled - V4.5 does not

David Yates. © Copyright Atos 2011


CSI / CSI32 Credits

Simon Dowson

The original versions of CSI, V2CSI, V2.5CSI, V3CSI and V4CSI.

David Yates

CSI32 - a merged V3CSI and V4CSI with other enhancements (such as this help).

This documentation was taken from the original material on the website by Simon, with additional material and corrections by me.


CSI32 Dependencies

CSI32 has the following direct dependencies:

csi32fix.exe | Microsoft compiler-built applications cannot receive certain ranges of internal messages. csi32fix.exe is a simple Borland application simply passes on the messages it knows CSI32 can’t hear. It doesn’t intercept, pass on or otherwise interfere with application to CSI messaging. This application should exist in the same directory as CSI32.EXE
bbcnb32.dll | Network DLL that CSI32.EXE needs. This is similar (but different!) to the existing BBCNB32B and BBCNB32M DLLs. This should exist somewhere windows can find it (i.e the windows directory, the “windows\lib” directory in a V4 system or elsewhere in “the windows path”.
bwcc32.dll | Part of usual V3 distribution CSI32.EXE needs for its dialog. This needs to be “in the path” or the system directory pointed at by the V3 "bncs_config.ini"
csi32.chm | Integrated help file. This needs to be in the same directory as csi32.exe.

Packet serial numbers are invisible to most existing BNCS modules, but to filter and display properly the following is required:

V3caplog.exe V3.7.1 or later understands and displays the packet serial numbers.

The following are not direct dependencies of CSI32 but are a consequence of using it.

inf32fix.exe | Required by V4INFDRV.EXE. This application fundamentally does the same as csi32fix.exe but for infodrivers. This functionality was previously part of V4CSI and was not migrated to csi32.
info32fix.dll | Supporting DLL for inf32fix.exe.


CSI32 Dialog

This document describes:

  • Main Dialog
  • Client/Driver List Dialog

Main Dialog

The main dialog is split into different sections - each one is shown and described below.

Sessions
Sessions | This is the number of currently active sessions whether for device control or file transfer
Mx | This is the number of messages transmitted from this workstation across a session
Tx | This is the number of packets transmitted from this workstation across a session
Rx | This is the number of packets received by this workstation across a session
Ix | This is the total number of sessions that have ever occurred involving the workstation since CSI was started
NCBs | The number of Network Control Blocks assigned to the Sessions

Drivers
Drivers | The number of drivers hooked into CSI - this number may not be exactly the same as the number of devices hosted
Mx | The number of "revertive" messages transmitted - messages may be combined into the same packet
Tx | The number of packets transmitted - packets may contain multiple messages
Rx | The number of packets received - packets may contain multiple command messages
Dx | The number of command messages relevant for this workstation i.e. where this workstation is hosting the device
Devices | The number of devices hosted by this CSI. This might not be the same value as Drivers since one driver might host multiple devices
NCBs | The number of Network Control Blocks assigned to Drivers

Clients
Clients | The number of clients currently connected to CSI
Mx | The number of messages transmitted by this workstation. Messages may be combined into multiple packets
Tx | The number of command packets transmitted by this workstation. Packets may contain more than one message
Rx | The number of "revertive" packets received by this workstation.
Sx | The number of relevant "revertive" messages received by this workstation. i.e. messages received that were passed on to interested clients
Cx | The number of poll requests that have been satisfied out of the cache.
NCBs | The number of Network Control Blocks assigned to Clients

Receive Buffers
InUse | The number of messages received from the network, and currently buffered and awaiting decoding. This is of infinite size.
HWM | The maximum value (high water mark) the "RxBuffs: In Use" value has ever got to.

Revertive Cache
Disk | The amount of disk memory (KB) used for caching "infodriver" revertives. Each infodriver uses approximately 1 MB. This field is disabled if UseMemoryCache is enabled.
RAM | The amount of RAM used (kB) - each device uses 8KB.
Eff. | This shows the efficiency of the cache. It is calculated from the number of polls or queries received by client applications that can be satisfied by the cache, divided by the total number of poll or query commands.

Transmit Buffers
TxBuffers: In Use | The number of transmit buffers that have sent data and now pending deletion
HWM | The maximum count (high water mark) that the TxBuffs:In Use has ever got to
Errors | The number of errors detected when trying to transmit data

Revertive Serial Number Errors
Serial NumErrs The number of errors where revertive packets have been received with out of order serial numbers

Packet Recovery Statistics
Unr. Errs | The number of errors which could not be recovered by the packet recovery process.
RcvdPkts | The number of packets which have been recovered.
Superseded Msg | The number of individual revertives from recovered packets which were found to have been superseded by later data
HeartbeatsRx | The total number of heartbeat messages that have been received.

Client / Driver List Dialog

This dialog shows a complete list of the clients and drivers that CSI is hosting. The number of entries in each list corresponds directly to the Clients and Drivers counts described for the main dialog.

The main purpose of this dialog is to determine the IPC mechanism in use. The example below shows a mix of different clients and drivers, their window class name and the module that owns that window.

These lists are maintained dynamically - when clients/driver connect/disconnect these lists will update automatically.

Occasionally CSI will retain a registration for a client/driver that has crashed. In this case the window class name and module name cannot be determined and the entry will show as "Invalid Window". Such information is NOT updated automatically, but only when the dialog is opened. CSI has it's own mechanism for detecting loss of client/driver. If CSI detects a client/driver has gone then it will automatically be removed from this list.


Help on help

Introduction

These help files are designed to be clear and simple, and not too weighed down in fussy formatting.

You can always get back to the first page by using the Home button in the toolbar above.

Use Forward and Back to navigate up and down your navigation history.

Pages are context linked where appropriate links appear like this text.


CSI32 Documentation

CSI32 Application Documentation

Please note: This is not a complete guide as to what BNCS is or what CSI does - but a reference for the CSI32 application.

Click on the lines below. Help is available for:

Dialog A guide to the dialog - what do all those counters mean?
Configuration Those things you can set, shouldn't fiddle with, or were once able to but not now!
Logging Those things that are logged...and where it's logged to
Internal Status Infodrivers Internal status infodrivers (similar to "BNCSStat" or "V3Status") introduced in version 1.1.10
Packet Recovery Information on the packet recovery features of CSI32 introduced in version 1.1.2
Interfacing ...or rather no information on Interfacing (but at least the reason why)

Also included is:

Full Version History As lodged with the source code. Note that this is an internal document and may be useful but is not a polished, user-friendly document.
Redundancy Guide to redundancy messages
Credits
Help On Help A very short guide to this style of help file


CSI32 Interfacing / API

CSI32 Interfacing

Driver and client interfacing information and APIs are not defined here for two reasons:

  • This information is usually only available to developers who have done driver training
  • There are considerably better ways of interfacing than using the raw messaging. These "other ways" (ccClient, extclient, ccInfodriver, extinfo etc.) are already documented elsewhere


CSI32 Logging

CSI32 maintains various logs of its activities.

These can be found in:

System Type | Log Path
V1 / V2 / V3 | c:\bncslogs\csi32
V4 | %CC_ROOT%\%CC_SYSETM%\logs\csi32

Events Logged

Logs are either appended to a single CSI32 log or create dated daily logs.

The filename of the daily log is simply the date in year/month/day order so that logs sort properly. For example:

20090309.log

It's anticipated that the things logged to csi32.log will never get to an unmanageable size - even if you start/stop CSI several times a day the resulting logs are not likely to ever grow to an unacceptable size even during the whole lifetime of the workstation.

The following events are logged by CSI32:

Event | Where Logged | Notes
Startup | csi32.log | Logs that CSI was startup with the version number
Closedown | csi32.log | Logs that CSI was shutdown - also logs the statistics usually visible on the UI
Crash | csi32.log | Logs the crash address and other information so that errors can be traced
Peer Poll Error | Daily log
Serial number error | Daily log
Cache cleared | Daily log | Following a packet serial number error may appear this log which indicates which devices may have been affected
Send Error | csi32.log | Rarely seen log that greater than 9999 messages have been sent without the application having an opportunity to delete the network resources


The BNCS Network

BNCS Network

Introduction

BNCS uses NetBIOS - a legacy Microsoft network API (chosen at a time a TCP network was a chargable extra on Windows 3.1).

Note I say "network API" and not "network protocol" since it isn't - NetBIOS is a means of machines communicating and specifies the service that they will support rather than how they should do it.

BNCS currently runs on NetBIOS/IP (aka NBT) as well as the legacy NetBIOS/NetBEUI - it can also run on NetBIOS/IPX though it's not thought that any systems do.

BNCS messaging is pretty simple - most control messages are passed as broadcast (in the network sense) messages so that they are received by every machine on the network. Whilst network professionals frown on such techniques it's actually very efficient at point to multipoint message delivery. BNCS has been used for systems with hundreds of workstations - there are the same overheads delivering messages to 1000 workstations or just 1.

Use of broadcast networking also simplifies the configuration of a system in that the sending node doesn't need to know the configuration of the network or require any broker or directory to use services of the network (e.g. any of the many BNCS drivers).

Whilst broadcast messaging (in the network sense) is an "unreliable" messaging technique (as defined for a network protocol) it's actually proved extremely reliable on the stand-alone networks on which BNCS has been deployed.

Latterly BNCS has added a proprietary packet recovery mechanism to address the issue of network broadcasts as an "unreliable protocol".

NetBIOS services

NetBIOS provides various services -

  • naming (both individual machines and groups)
  • directed messages
  • broadcast messages
  • sessions

NetBIOS names

BNCS uses the following NetBIOS names. Some of the names are different depending upon whether there is a channel number used for that system.

Note:

  • V1 has no notion of channel numbers
  • STATUS_CHANNEL does not have a channel number because it works across multiple channels
  • WORKSTATION does not have a channel number either - though it's inconvenient since it restricts what workstations can be run on a network otherwise segmented by BNCS channel number. This is rarely a problem on production systems but is a limitation on development networks.
  • The "name with channel no." version of the name is used for channel numbers > 0
Name / Name
with channel no. 		Type Version Use
CSI
CSIn 		Group V1 & V2 Messages from drivers to clients
n is the channel number (no leading zeros)
DEVICE_CONTROL
DEVICE_CONTROLn 		Group V2 Messages from clients to drivers
n is the channel number (no leading zeros)
STATUS_CHANNEL | Group | V2 | Messages about workstation status
WORKSTATIONxx | Unique | V1 & V2 | Where xx is the workstation number (1 leading zero). The means by which unique workstation IDs are enforced as well as a named end-point of session (v2)
BNCSRECOVERY
BNCSRECOVERYn 		Group Extn. Messages relating to packet recovery
n is the channel number (no leading zeros)
Packet recovery is an extension to V2 networking - works between packet-recovery-enabled workstations, and doesn't upset the operation of legacy workstations.
ID_xxx | Unique | V1 | Message from client to Information driver xxx
GPID_xxx | Unique | V1 | Message from client to GPI driver xxx
GRD_xxx | Unique | V1 | Message from client to router driver xxx

For NetBIOS/IP (NBT) you can monitor what names you have registered by using the following command line command:

nbtstat -n

Note this command will also list a few "system" names such as the workstation name and workgroup not just the BNCS names.

Differences between V1 BNCS network messages and V2

We have to be careful here with the version numbers. "V1" BNCS network messages refer to clients/drivers before 1997 - "V2" BNCS network messages refers to pretty much everything since (whether a system is defined as a headline V2, V3, V4, V4.5 BNCS system - the underlying network messaging is still "V2").

V1 drivers register individually with the network - if you want to send a message to that driver then you send it to that named resource on the network. In V2 a message for a driver is just sent to "a driver" and it's the receiving end determines whether it's interested in the message.

V1 drivers are strictly one packet per driver - "revertive" messages are packed efficiently (more slots per packet). Command messages are sent point-to-point, "revertives" are broadcast.

V2 allows packing of different drivers into one packet per workstation. Messages are less efficiently packed but in practice being able to pack multiple devices into a single packet outweighs the disadvantages. Messages are broadcast - each driver must receive the message and determine if it contains relevant infomation.

LANA Number

As noted at the beginning NetBIOS is an API not a protocol. That API may be presented as all the different protocols on multiple network adaptors. Which one should BNCS use? NetBIOS/IP on the wired Ethernet or NetBIOS/NetBEUI on the wireless adaptor? NetBIOS enumerates these different combinations and gives them a number - the LANA number.

You can use the Microsoft utility lanacfg.exe to list all the possible combinations of protocol and adaptor or there is a BNCS utility setlana.exe that wraps it up and allows setting the LANA number from the UI in it's "usual" locations.

Client to driver messages

This includes command messages (IW, RC, GS, IP, RP etc. etc.) and revertive messages. These are sent as broadcast datagrams commands sent to NetBIOS name DEVICE_CONTROL. Revertives are sent to NetBIOS name CSI. It's these names that allow the NetBIOS layer to filter incoming messages and only pass to interested parties.


New Page 1

CSI32 Overview

BNCS is a collection of individual applications which connect together on a network to provide a Broadcast control solution.

It's CSI that connects the applications together via the network as well as providing other services.

CSI32 is the current 32 bit release of CSI.

CSI32:

  • is an interfacing module that connects an IT network to BNCS driver and client applications. It receives and processes network messages converting between internal Windows inter-application messages to other applications
  • provides name-lookup "database" services - key/value pairs (numeric key, string value).
  • is a dual personality module - it both provides an interface to the network for device drivers, as well as providing an interface for clients to utilise the parameters on these drivers.

Networking is simple - broadcast messaging where every message sent is received by every workstation on the network. This makes for very efficient delivery of messages to many clients as well as simplifying system configuration by clients requiring no knowledge of the configuration of the system to which they interact.

What CSI does

  • network messaging
  • file transfer
  • application messaging/IPC
  • clients
  • drivers
  • licencing

Networking

Features:

  • paths
  • cache (peer poll)
  • database
  • buffering
  • stats/logging
  • serial numbers
David Yates. © Copyright Siemens IT Solutions and Services Ltd. 2009


CSI32 Configuration

Packet Formats

Introduction

This document describes the packet formats used in CSI.

Packets are in network byte order - so (for Windows) a DWORD is stored in memory in the opposite order in which it comes off the network.

These packet formats are not a user API and are here for reference only. They are subject to change without notification.

Heartbeat

Byte Offset | Type | Use
0 - 2 | String | Null terminated string "HB" (for heartbeat!)
3 | Byte | Heartbeat header size - currently 36 (was 32 before version 1.1.11)
4 Byte packet number (should be rarely anything other than 0)
Top bit indicates if more packets follow - last packet will always have this at zero. e.g.
0x80 - first packet - more follow
0x81 - second packet - more follow
0x02 - third and last packet
5 - 6 WORD
(16 bits) 		workstation number
7 | Byte | heartbeat interval in seconds
8 - 11 DWORD
(32 bits) 		last revertive serial number
12 - 15 | DWORD | csi up time in seconds
16 - 19 | DWORD | current workstation time of day (in seconds since Jan 1st 1970)
20 - 23 | DWORD | earliest packet that can be recovered
24 - 27 | DWORD | packet checksum
28 - 31 | DWORD | unrecoverable error count
32 - 35 | DWORD | recovered packet count (from version 1.1.11)
36+ WORD device number & redundancy flags (see below).
bit 15 is set if driver is in TXRX
bit 14 is set if a driver is RxOnly but wishes to be TXRX
bit 13 is the device close flag
bit 12 is not used - reserved for NO function ("Network Objection" redundancy switching)
bits 0-11 are the device number (0 - 4095 max)

Bits reserved for device number mirror the number of bits reserved in the "Universal Revertive" packet structure

Bits 13/14/15 have the following states

Bit 15 | Bit 14 | Bit 13 | Notes
0 0 0 Device RxOnly Broken
Equivalent to NB message
0 1 x Device RxOnly
Equivalent to NI message
1 0 x Device TxRx
Equivalent to NA message
1 | 1 | x | Not valid state
0 0 1 Device Closing
Equivalent to NC message

After the header there is none or more WORDs which is a list of the drivers currently running on this workstation and their status.

From CSI 1.2.35 heartbeats allow for status of all 999 drivers (previously only 238). This requires that multiple heartbeat packets are sent (see flag in byte offset 4). For the full 999 devices 5 packets required (999/238 = 4.19)

Packet Recovery Request / Error Response

There are two packet types on the packet recovery "network channel".

  • One is a standard universal revertive (UR) packet.
  • The other is as defined below
Byte Offset | Type | Use
0 - 2 String Null terminated string:
"PR" for Packet Recovery
"PE" for Packet (recovery) Error
3 | Byte | header size - currently 16
4 - 5 | WORD | originating workstation number
6 - 9 | DWORD | packet checksum
n+0 | WORD | workstation
n+2 | DWORD | start packet ID to be recovered
n+6 | DWORD | end packet ID to be recovered

where n starts at the header size and can continue in 10 byte blocks to the end of the packet (max 49 requests)

The same packet format is used for packet recovery requests and packet recovery error responses.

Configuration Change

CSI 1.2.42 introduces a configuration change message to distribute simple config change messages. Overall packet length makes this of limited use - you wouldn't choose to update a lot of things using it, but the odd nip and tuck of config. is useful

Byte Offset | Type | Use
Header 0 - 2 String Null terminated string:
"CC" for Config Change
3 - 4 | WORD | originating workstation number
5 | Byte | Number of separate changes in this packet
Type | n+0 | DWORD | change type
Filename | n+4 | Byte | Length of filename field
n+5 | String | filename (not null terminated)
Key n | n+5+flen | Byte | Length of key field
n+6+flen | String | Key (not null terminated)
Parameters | n+6+flen+klen | Byte | Number of param/value fields
n+7+flen+klen | Byte | Length of param/value field
n+8+flen+klen | String | Param/value pair (not null terminated)

Key and param/value can be 255 characters - this is fixed by the length field which is (deliberately) a single byte to allow best packing on a limited size packet size.

"Change type" has the following definitions

Change ID | Description | Filename | Key | Param(s)
1 | ini file change - configuration folder | filename - including extension | ini file section | param value pairs are the individual entries
2 | ini file change - system folder | filename - including extension | ini file section | param value pairs are the individual entries
3 | V4.5 "instances" | instances (extension is implied) | Key contains the id of the entry to change - this follows the bncs_config convention of dotted notation for hierachal elements with id attributes | Param/value pairs are <attribute>=<value>

Example (fragment of V4.5 instances.xml):

<?xml version = '1.0' encoding = 'UTF-8'?>
<instances>
<instance composite="yes" id="SBI_DbyDecShuff_11" type="GRB100_DBD18" alt_id="sShuff 11" >
<group id="GRB100" instance="SBI_DbyDecShuff_11_GRB100" />
<group id="DBD18" instance="SBI_DbyDecShuff_11_DBD18" />
</instance>
<instances>

to change the instance of the group GRB100 the key would be:

SBI_DbyDecShuff_11.GRB100

(note dot to indicate nested elements) and the param:

instance=myNewInstance


CSI32 Packet Recovery

This feature is available in CSI32 version 1.1.2.xx or later.

Before CSI32 version 1.2.33 packet recovery used AF_NETBIOS socket type - support for which has been dropped on 64 bit operating systems. This meant that packet recovery did not work on those OSs. From 1.2.33 however packet recovery just uses the same packet recovery mechanism as the reset of CSI and so works the same.

Description

BNCS uses unacknowledged broadcast datagrams for normal in-band message delivery. This is very efficient for point to multi-point data delivery, and usually doesn't suffer significant reliability problems.

For commands that initiate an action there is a return value, however where data is generated spontaneously by devices (e.g. status like "input fail") there has been no means of correcting if any values have been missed.

Tests have proven there is a very very low level of packet loss on a network but any packet loss at all may cause discrepancies between displayed data and reality.

CSI32 introduced packet serial numbers to detect errors and these have now been extended to recover lost packets.

Packet recovery is for "revertive" data only.

General Overview

CSI32 borrows concepts from the PGM (Pragmatic General Multicast) protocol. The gist of which is that whilst packets are being received in order, without anything missing "listeners" sit silently happily consuming the data. On missing data however listeners generate NAK (Not AcKnowledge) messages back to the sender to say "pardon?"

A network storm of "pardon?" messages is prevented by a variable hold-off preventing all listeners asking at once, and by listeners receiving each others messages so one knows it doesn't have to ask if someone else already has. On a large network where a packet is lost at source this may still result in several near simultaneous requests for the same thing.

PGM itself is not used because BNCS continued use of NetBIOS, but there are other factors too such as delays in recovering packets.

BNCS must remain a responsive control system - to recover packets in strict order they were sent introduces delays - perhaps considerable delays (10s of seconds). Such delays are not appropriate for most BNCS systems so a mechanism has been written to allow for immediate delivery of current data but delayed recovered data is checked for relevance.

For example - imagine a parameter regularly toggling states with no other traffic on the network. If a packet is missed the process to recover it begins. Whilst this happens the data continues to change. When the packet is recovered it's no good just passing this direct to the client - what it contains will in this case have been superseded. So a check is made to see if a later packet than the one recovered contained information for the same parameter and this recovered data is discarded.

Heartbeats

As noted above listeners happily consume data silently until they detect a discontinuity in the sequence of packets. This is all very well whilst data is being regularly generated from the driver. It wouldn't be known to a listener if the last 100 packets have been lost until the 101st arrives and that discontinuity is detected.

Heartbeats are a guaranteed regular "pulse" that contains information on the last packet sent.

Heartbeats have the other benefit that they can be used to determine the health of the system from any workstation that has been running for greater than the maximum heartbeat period.

Unrecoverable Errors

Errors are flagged from CSI when there are unrecoverable errors. With the packet recovery feature off every serial number discontinuity is flagged as an error.

With the packet recovery feature on only those errors that truly cannot be recovered after the specified timeouts and retries are flagged as an error.

The notification however is the same in both cases - it's just when it's generated that is different.

Testing

The trouble with modern networks is that actually they are staggeringly reliable - certainly measured values in excess of 99.997%. This makes it difficult to test the packet recovery mechanism very easily so CSI32 has unreliability settings to deliberately lose messages outgoing and incoming.

In development & testing packet loss of 40% was used along with induced unreliability into the recovery path too.

Packet Formats

Packet formats are described here:

Configuration

Configuration options are described in the PacketRecovery section here:


Driver Redundancy

Redundancy

Description

It is desirable to have main and reserve drivers on a BNCS network so that in the event of a PC or driver failure the reserve driver could automatically take over the function of the main driver.

This is achieved by having active drivers in transmit receive (TXRX) and non-active drivers in receive only (RXONLY). The non-active drivers still receive and can process and store messages from the network but are unable to transmit data back to the network.

This document is a description of the inter-application messages used to control the TXRX and RXONLY status of BNCS drivers. This is not complete driver / infodriver interfacing documentation.

This documentation refers to CSI version 1.18.02 or later and Infodriver V2.02.02 or later.

It is the CSIs on the network that handles driver redundancy, passing messages between each other and to the driver applications, to negotiate the TXRX state of each of the drivers. This messaging also ensures that there can be no more than one instance of a particular device number.

Redundancy gained an extra feature "Redundancy Master" from CSI32 version 1.2.44.

Normal Driver Operation

Consider a single Infodriver on a network.

Network Inquiry Message

When this driver starts up it sends a network inquiry message. This appears on CapLog and is of the format:

NI <device number> <workstation>

e.g.

NI 123 009

This example is an inquiry for workstation 9 to have device 123 in TXRX mode on the network.

Network Objection Message

If there is another driver of this device number running an objection message of the format:

NO <device no> <w/s requesting new instance> <w/s with existing active instance>

e.g.

NO 123 011 009

This example is an objection from workstation 9's to workstation 11's request to register device 123 as TXRX.

Network Attention Message

For active drivers CSI regularly sends out message to the network informing all other devices on the network that this device is active. This message can be seen on CapLog and is of the format:

NA <device number> <workstation>

e.g.

NA 123 009

This example shows that device 123 is active on workstation 9.

The NA message is identical to an NI message in terms of possible responses. Lets say we have device 123 active on workstation 9, and device 123 active on workstation 11 (this is an unusual situation but can happen if you start these drivers up without the PCs connected to the network). The first to send out a NA message will get an NO message from the other active driver. This will cause the driver that generated the NA message to go RXONLY.

Network Close Message

When a driver in TXRX mode shuts down it sends a closing message to the network. This is to tell other drivers of this device number that there is an opportunity to go TXRX. The closing message is of the format:

NC <device number> <workstation>

e.g.

NC 123 009

This example shows that active device 123 is being closed down on workstation 9. This gives other drivers in RXONLY an opportunity to try and go TXRX.

Network Broken Message

This slightly misnamed message is for indication only - no action results as a result of receiving it. It was meant to indicate a driver in RxOnly that does not want to request to go TxRx. The word "broken" used because it was initially used for a driver in RxOnly that was in no fit state to become TxRx (because of failed device comms for example). It shows the driver as alive but in trouble.

The message is of the format:

NB <device number> <workstation>

e.g.

NB 123 009

This example shows that RxOnly device 123 on workstation 9 is alive but does not wish to go TxRx.

Drivers which use multiple devices may use a single device to control TxRx - the other devices not wishing to control their own TxRx state may send "Net Broken" messages. This doesn't mean they're broken necessarily but that they don't want to independently request to go TxRx.

Redundancy Master

There are significant issues with redundancy messaging described above:

  • cycle time is dependent upon the number of devices running on a workstation. With default 'N' message send time of 60 seconds a driver hosting 100 devices would take over three hours to change then all over.
  • BNCS devices are independent, but some drivers use multiple devices for a single function - this leads to issues ensuring TxRx state tracks across all devices. Some drivers have explicit code to do this - it's an overhead that shouldn't be required.
  • there is a single 'N' message per packet - which leads to many packets on the network - this is particularly significant with drivers that host a very large number of devices (e.g. FABIAN) especially on closedown when individual NetClose "NC" messages are sent.

CSI 1.2.44 introduces the idea of "redundancy master". This is where a single device is nominated to be the master for a group and it alone controls the TxRx state of all its slave devices. The slave devices simply track the master and only the master device need talk to the network. For a FABIAN with 50 drivers this reduces the cycle time from 50 messages to just 1.

Configuration

It's anticipated that this may be configured on-the-fly by extension of the existing APIs - for the moment it's available as static configuration in the usual CSI configuration file:

Redundancy master can be configured in csi.ini/bncs_system.ini:

[RedundancyMaster]
11=13-15
101=101,102,103,104

The above configuration specifies that:

  • device 11 is the master for itself and devices 13,14,15 (the dash indicates a range).
  • device 101 is the master for itself and devices 102, 103, and 104 (devices explicitly listed)

Notes

  • Redundancy master does not completely disable the normal 'N' message functionality - for the above example of devices 101-104 in a group, you should never see any 'N' messages for devices 102-104. If however a stand-alone device 104 were to be started on the network then the normal Network Objection "NO" message will still be sent by the redundancy master.
  • Slave devices get no choice whether they are TxRx or not - the return value to BBC_REQDEVGOTXRX is ignored.

External Driver Messaging

The following messages are used to control the TXRX status of a device.

These messages are defined in BBC_MXC.H

Message | Use | Notes
BBC_REQDEVGORXONLY CSI to Driver Request to go RXONLY.

This message is sent to a driver when a NI message is received from another driver PC.
The return value to this message specifies whether a NO message is sent to the network.

wParam
not used
(from CSI 4.01)
Workstation requesting TXRX
lParam
Device Number
Return
FALSE - Refuse to go RXONLY by sending a NO message
TRUE - OK to go RXONLY don't send a response to the network
BBC_DEVICEIDINUSE CSI to Driver This device ID already in use on the network

This message is sent to a driver when an NO message is received objecting to the driver on this machine.
This is notification that this driver has been set to RXONLY.

wParam
not used
lParam
Device Number
Return
not used
BBC_REQDEVGOTXRX CSI to Driver Sent to the external just before going TXRX wParam
not used
lParam
Device Number
Return
TRUE - OK to go TXRX
FALSE - Refuse to go TXRX
BBC_INQDEVGOTXRX CSI to Driver Inquire go TXRX.

This message is sent before this workstation issues an NI message to the network. If this driver does not want to go TXRX it can choose not to send the NI message

wParam
not used
lParam
Device Number
Return
TRUE - Send NI to network
FALSE - Don't' send NI to network
BBC_IDGETTXRXMODE Driver to CSI Get the TXRX state of this infodriver.

This message is only used from Infodriver external to infodriver

wParam
not used
lParam
not used
Return
Value can be one of the following parameters:
IFMODE_NONE
Device not registered on this w/s
IFMODE_RXONLY
Device in RXONLY
IFMODE_TXRX
Device in TXRX
BBC_GETDEVTXRXMODE | Driver to CSI | Get the TXRX state of this driver | As per BBC_IDGETTXRXMODE above except that lParam contains the device number
BBC_SETDEVTXRXMODE Driver to CSI Set the TXRX state of this driver wParam
Mode (see below)
lParam
Device Number
Return
Not used

IFMODE_RXONLY
Set mode to RXONLY by sending a NC message to network
IFMODE_TXRX
Try to set mode to TXRX by sending NI message to network
IFMODE_FORCETXRX
Force mode to TXRX by sending NO message to network
Note: This message sets the mode direct (and sends an NA message) and does not issue a BBC_REQDEVGOTXRX

Using these interface messages

It depends upon how the device is connected to the driver as to how to use the redundancy switching.

One common feature that is important, no matter how an external device is connected into the system, is whether the driver has communications with that device.

If a driver has good comms with the device then this driver is available as a reserve - if the device does not have comms there is no point in offering this driver as a reserve.

Therefore most of the TXRX / RXONLY switching decisions are made on a comms. fail flag.

Sample code

This assumes that there is a comms fail flag called fCommsFailSystem. This is TRUE in the comms fail state. The Comms. fail state is determined by each implimentation but is assumed to be something like a number of consecutive missed messages.

This is the code required in the Windows procedure:

case BBC_REQDEVGORXONLY:
// don't go RXONLY if we have active comms (dual ported solutions may wish to just concede TxRx state)
return fCommsFailSystem;

case BBC_REQDEVGOTXRX:
// this is our notification of going TXRX (if we approve it) show it on the dlg
if( !fCommsFailSystem )
SetDlgItemText( hDlg, ID_TXRXMODE, "TXRX");

// only go TXRX if we have active comms
return !fCommsFailSystem;

case BBC_INQDEVGOTXRX:
// don't ask to go TXRX if we can't offer a reserve
return !fCommsFailSystem;

case BBC_DEVICEIDINUSE:
// this device is in use - we're read only - show on dlg
SetDlgItemText( hDlg, ID_TXRXMODE, "RXONLY");
return 0;

The following fragment shows how to get the initial state of the redundancy (this is for Infodriver external - GRD the same, direct CSI messaging similar):

switch( SendMessage( m_hInfo, BBC_IDGETTXRXMODE, 0, 0 ))
{
case IFMODE_TXRX:
SetDlgItemText( hDlg, ID_TXRXMODE, "TXRX");
break;

case IFMODE_RXONLY:
SetDlgItemText( hDlg, ID_TXRXMODE, "RXONLY");
break;

default:
SetDlgItemText( hDlg, ID_TXRXMODE, "Unknown");
break;
}


CSI32 Status Infodrivers

Introduction

CSI32 introduced the idea of "heartbeat" messages with packet recovery. Their primary purpose is to generate regular updates of current serial packet serial numbers so that packet loss may be detected. A regular message sent to the network may of course also be used to hold other status information.

Heartbeats contain information about the workstation status - such as up-time, as well as information about drivers hosted on that workstation including the redundancy status not available directly via any other single means.

Each heartbeat is received by every machine on the network - this means that every machine can quickly get an accurate idea of the status of all other workstations and drivers on the network.

BNCSStat (V3Status) uses a similar idea for network status, but then has the curiosity of representing this data back onto the network. Segmented networks, or VPNs make this approach undesirable.

Status Infodrivers

There are two "virtual" infodrivers that CSI uses to pass workstation and driver information back up to clients. These do not exist as true devices on the network, but are locally generated in each CSI32. This mechanism ensures that any version of BNCS client can readily use this new status information without having to implement a new API.

There are two settings in the CSI configuration file (csi.ini or bncs_system.ini):

[Status]
DeviceInfodriverId=124
WorkstationInfodriverId=123

These are the two device numbers of the virtual Infodrivers. These are read-only devices, may be polled and spontaneously generates change of state revertives if devices/workstations appear or disappear.

The data in these internal Infodrivers is only valid after a short period - usually a minute:

  • If you poll the workstation status during the startup period you'll get valid data (if it's arrived) or else the value "starting".
  • If you poll the device status device during the startup period you'll get the string "starting" followed by the available data. e.g. "starting,123T,456R"

To ensure that a client doesn't have to worry about repolling data after the startup period it is automatically repolled once the startup period is over.

A cache test for these two Infodrivers always returns valid except during the startup period.

Workstation Status Infodriver

There is one slot per workstation - where slot 1 is workstation 1, and slot 999 is workstation 999.

For an active workstation each slot contains a comma delimited list of:

  • up-time
  • current time
  • unrecoverable error count

Slots for inactive workstations are empty

For example:

0,02,05,51,2010,01,19,20,13,46,0,2,2010,01,01,17,20,44

Each entry is of the format:

<uptime days>,<hours>,<minutes>,<seconds>,<current year>,<month>,<day>,<hour>,<minute>,<second>,<unrecoverable error count>,<recovered packet count>,<csi start year>,<month>,<day>,<hour>,<minute>,<second>

So you can determine that this sample entry this workstation has been up for 2 hours 5 minutes and 51 seconds. It's current time is 20:13:46 on 19/1/2010 and hasn't got any unrecoverable errors and two recovered packets, CSI has been up since 17:20:44 on 01/01/2010

Unrecoverable error count mirrors that as shown on the CSI dialog - and is cleared when the CSI counters are cleared.

That same information in more easily digested form (maybe!):

Field offset | Info
0 | Days
1 | Hours | Uptime
2 | minutes
3 | seconds
4 | year | Current workstation clock
5 | month
6 | day
7 | Hour
8 | Minute
9 | Second
10 | Unrecoverable Error Count
11 | Recovered Packet Count
12 | year | CSI start time
13 | month
14 | day
15 | hour
16 | minute
17 | second

Device Status Infodriver

There is one slot per device - so slot 1 is device 1 and slot 999 is device 999.

For each driver each slot contains a comma delimited list of the workstations hosting that driver with an indication of the driver state.

For example:

011T,022R,033B

Entries are zero padded to three characters for ease of decoding.

This indicates that this driver is TXRX on workstation 11, RxOnly on workstation 22 and RxOnly and broken on workstation 33 (not all drivers support this state). This would perhaps be an unusual entry on a real system since most drivers would only have 1 "main" in TXRX and 1 reserve RxOnly - this example just shows all three states.

The perhaps misnamed "RxOnly Broken" state was originally designed to indicate a running driver but one that did not want to go TxRx - perhaps because it lost comms with its device and was in no fit state. The "RxOnly Broken" state can also be used by multi-device drivers when TxRx state is controlled by a single master device and the slave devices should not attempt to negotiate their own TxRx state.


/******************************************************************************
* CSI.EXE : Control System Interface - (c)BBC 1993-2006 : Author Simon Dowson *
******************************************************************************/

/******************************************************************************
*	Version 1.00 - 	16/12/93	- Development commenced                         *
*                 	04/01/94 - Added GPI driver commands                     *
*  Version 1.01 - 	29/01/94 - Added InfoDriver commands                     *
*                    	        Now uses ApplCore INI file                    *
*	Version 1.02 -		31/01/94 - Added Booking System support						*
*	Version 1.03 -		21/02/94 - Increased message queue size 						*
*							25/02/94 - Now closes down gracefully							*
*	Version 1.04 - 	10/03/94 - Added database functions								*
*							16/03/94 - Added 'Licence' and 'About' menu					*
*							22/03/94 - Database bug fix										*
*							28/03/94 - Added 'Network Attention' mechanism		 		*
*	Version 1.05 - 	11/04/94 - Added CSHost support									*
*  Version 1.06 -		22/06/94 - First speed optimisation								*
*										  Clear added to menu bar								*
*	Version 1.07 - 	29/06/94 - Router revertives now take names from local	*
*										  database													*
*	Version 1.08 - 	01/07/94 - Cache for router status								*
*										  Timer for status updates								*
*										  Net Restart command added							*
*							29/07/94 - Database change notification facility added	*
*							04/07/94 - Cache defaults to OFF									*
*										  Message queue increased to maximum				*
*										  Hooks for CSLink added to replace CSHost		*
*	Version 1.09 - 	03/01/95	- Minor bug fixes to Network Manager functions	*
*										  and router control device range					*
*	Version 1.10 - 	14/04/95 - Speed enhancements to router datagrams			*
*										  Reduced max clients to 32							*
*									 	  Diagnostic switch added								*
*	Version 1.11 - 	25/06/95	- Generic 'Device Control' datagrams replace    *
*                 	           CSLink specific messaging.							*
*	Version 1.12 - 	25/08/95	- Bug fix to cache mechanism							*
*										  Reduced maximum clients to 24					   *
*	Version 1.13 - 	22/01/96 - Recompiled to test BBC_NBIF.DLL instead of		*
*										  NETBIOS.DLL for Windows 95 compatibility		*
*	Version 1.14 - 	31/03/96	- Added more protection to cache routines			*
*										  Tidied network messaging								*
*	Version 1.15 - 	11/01/97 - Bug fix to router cache routines					*
*							12/03/97 - Added CSRemote messaging								*
* 	Version 1.15.01 	28/04/97	- Destination 0 no longer causes cache to GPF	*
*	Version 1.15.02	06/05/97	- Bug to cache validity routines						*
*	Version 1.15.03	20/05/97	- BBC_GETCSIHWND now send WS Id in lParam 		*
*  Version 1.15.04	16/10/97	- Bug fix to database routines						*
*	Version 1.15.05	02/12/97 - Increased max registrations to 128				*
*	Version 1.16.00	19/12/97 - Added command buffering								*
*				 						  Added Message counters to diagnostic window	*
*							 			  Extended diags box now appears on startup		*
*										  Session dir routines now use temp filepath		*
*										  Client cmds ignored if client mode disabled	*
*										  Drivers cmds ignored if driver mode disabled	*
*										  'DEV_xxx.INI' generic type add						*
*										  Auxilliary database handler added					*
*										  Changed database rouines to work direct to CSI*
*										  Added version information resource				*
*										  CreateProfile() makes 'Name' entry in [Device]*
*										  Added 'Queue Clear' Session menu					*
*										  Added 'Session Clear' options to Session menu	*
*							 			  WS Id now sent in lParam of BBC_HWNDCSI msg	*
*										  Added client cache enable/disable functions	*
*										  Added Device_GetData() function					*
*										  Added Device_Index() function						*
*										  Added Cache_Flush() function						*
*										  Cache files now deleted on closedown				*
*										  Added system messaging								*
*										  Added selective registration 						*
*										  Added packet mode revertive support				*
*										  Added database change notify for V2 drivers   *
*							Rev. F     For V1 drivers now sends commands singularly	*
*							Rev. G	  Added BBC_QUERYCACHEMODE handler					*
*							Rev. H	  Bug fixes to client registration routines		*
*							Rev. I	  Bug fixes to client unregistration routines	*
*							Rev. J     Bug fix to GPI Revmessage							*
*										  Changed default Client buffers to 20				*
*										  Changed default Driver buffers to 4				*
*							Rev. K	  Bug fix to allow Tx to increment					*
*							Rev. L	  Bug fix to tertiary message decode 				*
*							Rev. M	  Bug fix to prevent mem leak on client dereg	*
*  Version 1.16.01	11/02/98	  Bug fix to allow 16 character database names	*
*										  Mex secondary buffers reduced to 256				*
*										  Max clients raised to 48								*
*										  Auto off added for tertiary buffering 			*
*										  Auto off added for secondary buffering			*
*	Version 1.16.02	02/03/98	  Bug fix to check slotsize from V1 InfoDrivers *
*	Version 1.16.03	11/03/98	  Bug fix to client Tx message box					*
*										  Added CSMain_GetDeviceProperties()				*
*	Version 1.16.04	17/03/98	  Added BBC_CSICLOSEWARNING handlers				*
*	Version 1.16.05	27/03/98	  Bug fix to give default type 0 to V2 drivers	*
*	Version 1.16.06	30/03/98	  Bug fix to prevent TerBuf_Decode() stalling 	*
*	Version 1.16.06A	21/05/98	  CSNDI_SendToDriver() tmp string size now 513	*
*						B	21/05/98	  CSNDI_Revertive() acStr size now 513          *
*						C	22/05/98	  Packet size checking added to all functions	*
*										  Stacksize increased to 4096							*
*										  Log functions removed since CapLog does it		*
*						D	01/06/98	  D'base funcs enabled if client mode is off    *
*						E	01/07/98	  Bug fix to tertiary buffering protection		*
*						F	15/07/98	  Bug fix to  CSReg_GetClientDevIdx()				*
*	Version 1.16.07	12/08/98	  consolidates bug fixes to 1.16.06					*
*                    28/08/98   Now sends BBC_DATABASEPOLL message to drivers *
*						A	19/10/98   Sends system messages on client msg errors    *
*						B	28/10/98	  Bug fix to RI command with 16 character names	*
*  Version 1.16.08   10/12/98   consolidates bug fixes to 1.16.07					*
*                    12/12/98   Bug fix to protect CSDbase_SaveGRDEntry()     *
*  Version 1.16.09   19/01/99   Bug fix to CSNDI_Revertive()						*
*                    21/01/99   Added CSNDI_SendVerbatimMsg()						*
*  Version 1.16.10   17/02/99   Bug fix to CSDbase_GetDbaseName()					*
*  Version 1.16.11	01/06/99	  Now only objects if hosted driver is in TX/RX *
*							03/06/99   Now handles RD commands for v2 drivers        *
*  Version 1.17.00	22/10/99	  32 bit message packers and crackers added		*
*										  BBC_REGCLIENT substituted for BBC_REGAPPLCORE *
*                               Added 32 bit flag to device driver flags      *
*  Version 1.17.01	18/11/99   Router Modify now works after DP command		*
*  Version 1.17.02	09/01/00   Added the 'network channel' options				*
*                    14/01/00   Now allows source -1 for V2 GRD revertives    *
*	Version 1.17.03	08/02/00   Now creates own temp dir for cache files		*
*	Version 1.17.04	11/02/00   Now transmits CSI status messages					*
*                    21/02/00   Added BBC_TXREVPACKET for raw packet Tx       *
*                    22/02/00   Added CSNDI_RegAllDeviceIds()                 *
*                    25/02/00   Main message window result code now long      *
*                               Reponse to BBC_GETCSIVERSION changed          *
*                               Commas now allowed in V2 databases 0 and 1    *
*                               Implemented up-time counters                  *
*                               Max secondary buffers reduced to 200          *
*                               Clients not sent hWnd if ClientMode disabled  *
*                    06/03/00   Bug fix to CSCmd_NetObject()                  *
*                               Added boot time to status message					*
* Version 1.17.05    04/04/00   Modified 32bit message routines to V4         *
*                               Max clients reduced to 44                     *
* Version 1.17.06    09/05/00   Bug fix to 16 bit version of V4 msg cracker   *
*                    15/05/00   Now transmits Tx packet counts in status msg  *
* Version 1.17.07    08/08/00   Began adding serial port watchdog functions   *
*                               Bug fix to CSNetSes_Send()                    *
*                    14/08/00   Now updates RAM dbase with mapped DEV files   *
* Version 1.17.08    22/08/00   Completed watchdog functions                  *
* Version 1.17.09    30/08/00   Added BBC_GETMAPPEDDEVID function             *
* Version 1.17.10    15/09/00   Added BBC_REQDEVGORXONLY to CSCmd_NetInquire()*
* Version 1.17.11    20/09/00   D'grams with no header can be sent by clients *
* Version 1.17.12    11/10/00   Network objections sent and handled by acNDI  *
* Version 1.18.00    08/11/00   Implements automatic driver Tx\Rx assertions  *
* Version 1.18.01    05/01/01   Active drivers no longer sent GOTXRX message  *
* Version 1.18.02    09/01/01   Modified TXRX to enable force changeovers     *
* Version 1.18.03    22/01/01   Default Tx/Rx retry period now 60 seconds     *
* Version 1.18.04    25/01/01   Bug fix to void CSCmd_RtrModify()             *
* Version 1.18.05    26/01/01   Max Clients reduced to 32                     *
* Version 1.18.06    04/05/01   Small fix to CSNDI_RegDeviceId()					*
* Version 1.18.07    10/05/01   BBC_GETDEVPROPERTIES now returns database list*
* Version 1.18.08    13/08/01   Libraries now freed after message loop quits  *
* Version 1.18.09    21/08/01   Now broadcasts BBC_APPREADY message when ready*
* Version 1.19.00    05/12/01   Added local loop back for locally hosted Id's *
* Version 1.19.01    11/12/01   Five secondary buffers processed per 55ms     *
* Version 1.20.00    21/02/02   Added standalone, no network option to INI    *
* Version 1.20.01    13/06/02   Reinstated BBC_CSICLOSEWARNING handlers       *
*                               Removed debug data to reduce program size     *
* Version 1.20.02    13/08/02   CSMain_TxPostDirectMessage now uses PostMsg   *
*                               BBC_DATABASEPOLL in CSCmd_RtrModify now posted*
*                               MIN_USERS added so the WS range can be used   *
* Version 1.20.03    04/09/02   Added EnableLoopback to INI file. Default = 0 *
* Version 1.20.04    23/10/02   Bug fix to CSCache_GetData() for GPI srce 0   *
*                               Bug fix to CSReg_UnregClient() flags now moved*
* Version 1.20.05    23/10/02   BBC_CLNETMSG now sent sent in loopback too    *
* Version 1.20.06    29/10/02   Mod to CSNDI_SendRevPacket() for loopback mode*
* Version 2.00.00    01/02/03   Supports both 32 bit messaging schemes        *
*                               Requires bncs_license.key file                *
*                               Uses bncs2nbif.dll for networking             *
*             B01    26/02/03   Added Cmd_NetModify for updating any INI files*
*             B02    29/02/03   Removed redundant debug messages              *
*             B03    01/03/03   Created common source for V2 & V3 CSIs        *
*             B04    05/03/03   Reduced compiler warnign messages by casting  *
*             B05    10/03/03   Bug fix to CSNDI_SendToDriver()               *
*             B06    11/03/03   CBDATA_SIZE_POINTER now 513b on WM_COPYDATA   *
*             B07    12/03/03   Bug fix device array to allow device 999      *
*                               Key data decode returs error codes            *
*             B08    18/03/03   Bug fix to error reported by key decoder      *
*             B09    20/03/03   V3 responds via WM_COPYDATA to BBC_GETHWNDCSI *
*             B10    21/03/03   Supports 32bit messaging for FBCSlink/CSServer*
*             B11    25/03/03   Added max drivers and devices from license    *
*                               No longer tries to delete NCBs twice on close *
*                               Lock file implemented in 32 bit version       *
*                               Now adds status channel name to name table    *
*             B12    27/03/03   Bug fix to name number of the status channel  *
*             B13    02/04/03   Bug fix to driver number checking in license  *
*             B14    14/04/03   Now supports 32 messaging for CSClient        *
*             B15    22/04/03   Bug fix to driver range checking              *
*             B16    30/04/03   Minor bug fix to BBC_FBMSGSCHEME handler      *
* Version x.00.01    09/05/03   Fix to internally loopback buffered commands  *
* Version x.00.02    14/05/03   Added KeyFilepath to CSI.INI                  *
* Version x.00.03    16/05/03   Added DisableWatchdogOnExit to CSI.INI        *
*                               APP_READY message now PostMessage()           *
*                               NULL removed from CSCmd_TimeService()         *
* Version x.00.04    22/05/03   Bug fix to numeric parser BNCS32ReceiveMessage*
* Version x.00.05    28/05/03   TxRx/RxOnly timer re-enabled                  *
* Version x.00.06    02/07/03   V2CSI no longer resets network layer          *
*                               No longer sends ODM if already in Rx Only     *
* Version x.00.07    24/07/03   Now creates csi_temp dir before decoding key  *
* Version x.00.08    17/09/03   Fix to loopback string length in CSMain_TxCmd *
* Version x.00.09    07/20/03   Converted to .cpp files, V4 directives added  *
*                               Added resgistration for name of client app    *
* 										  Max clients now 999                           *
* Version x.00.09    04/02/04   Removed some redundant debug information      *
*                               Now set to minimise on start up               *
* Version x.00.10    20/02/04   CSI Closing messages now work in V4           *
*                    01/03/04   Added Tools->Reset Network option to menu     *
*                               Now update clients with N series messages     *
*                    02/03/04   Recompiled with Qt3.2.3                       *
* Version x.00.11    25/03/04   BBC_APPREADY now SendMessage()                *
*                               V2V3 Window positioning restored              *
* Version x.00.12    01/04/04   Re-enabled the time service for V4CSI         *
*                    05/04/04   BBC_CC.DLL no longer loaded in V2CSI          *
* Version x.00.13    06/06/04   Replaced strtok() with bncs_strtok()          *
* Version x.00.14    09/06/04   Added b_strtok as part of project             *
* Version x.00.15    16/06/04   Now detects network failure and resets        *
* Version x.01.00    20/01/05   CacheSize parameter in CSI.INI has min of 8192*
*                               Selective caching added                       *
*                               Cache menu toggle now flushes cache files     *
*                    16/01/05   INI file allows buffer flush on exceeding HWM *
*                    17/01/05   INI file allows cache flush on exceeding HWM  *
*                    23/01/05   static chars in CSDbase for returned strings  *
*                    24/01/05   Bug fix to SecBuf_In() Terbuff toggling on HWM*
*                               TERBUFF_AUTO_OFF reduced to 150               *
*                    25/01/05   V1 compatibility switch added to CSI.INI      *
* Version 3.01.01    28/02/05   Bug fix top improved NDI filtering            *
*                    29/03/05   Bug fix to CSNetSup_NetSendDG()               *
* Version 3.01.02    30/03/05   Removed compiler warnings                     *
*                    01/04/05   Raised MAX_CLIENTS	& MAX_REGISTRATIONS to 999 *
*                               Rasied REGMEMORYALLOC to 524288               *
* Version 3.01.03    18/07/05   Reinstated BBC_FBMSGSCHEME & BBC_CLMSGSCHEME  *
* Version 3.02.00    15/11/05	  Added Device Status messaging                 *
*										  BBC_NETTXRXSTATUS added to CSCmd_NetInquire() *
*										  Fix to CSCmd_NetInquire() & CSCmd_NetObject() *
*										  After NO the 'reverting to Rx Only' is only   *
*										  written to the network once                   *
*										  NetBroken message added to reflect device fail*
*                               CSCmd_NetClose() generates BBC_NETTXRXSTATUS  *
*                               Bug fix to CSCache_GetFileHandle()            *
*                               Supports BBC_DEVCOMMANDMSG & BBC_DEVSTATUSMSG *
*                               Added Net Status handler                      *
*                               Added MaxClient limit to CSI.INI              *
* Version 3.02.01    07/12/05   MaxClient entry in CSI.INI forced to be 1024  *
* Version 3.02.02    14/12/05   Destination zero now allowed in UR revertives *
* Version 3.02.03    27/01/06   CSMain_(S)GetDevTxRxMode() allows device 999  *
* Version 3.02.04    30/01/06   Boot time vars set before first status call   *
* Version 3.03.00    03/03/06   Now uses GetConfigDirectory in bncs_gcd.cpp/h *
*                               NetReset functions added                      *
*                               Session timeout now 60 seconds                *
*                               Bug fix to CSCache_GetFileHandle()            *
*                               CSCache_DeleteOldFiles() now uses constants   *
*                    06/03/06   CSCmd_NetModify() now uses 32 bit messaging   *
*                    06/03/06   CSCmd_NetStatus() now uses 32 bit messaging   *
* Version 3.03.00    09/03/06   All BNCS_V4 #ifdefs removed                   *
*                    14/03/06   GetConfigDirectory() GetBNCSConfigDirectory() *
* 						   22/03/06   Added GetBNCSSystemDirectory()          *
*                               NULL term fix to Cbncs_strtok::Tokenise()     *
* Version 3.03.01    20/04/06   Device check added to CSDbase_GetDatabaseName *
*                               Device check added to CSDbase_GetDbaseName    *
* Version 3.03.02    24/04/06   Cache file path now in bncs_config.ini        *
*                    25/04/06   Bug fix to point all profile entries on path  *
* Version 3.03.03    09/05/06   Fix to out of range in CSDbase_GetDatabaseName*
* Version 3.03.04    16/05/06   Turned of debug from CSDbase_GetDatabaseName  *
* Version 3.03.05    30/05/06	  strlen+1 fix to CSMain_RxPostDirectMessage() *
                                          Modification to CSMain_RxPostDirectMessage and*
*                               CSMain_TxPostDirectMessage to pack size and   *
*                               switch in wParam for when network enable off  *
* Version 3.03.06    15/06/06   If NetworkEnable=0 then LoopBack is enabled   *
* Version 3.03.07    14/07/06   Fix to V1 revertives in CSCmd_RtrRevertive()  *
*                               and in TerBuf_DecRtr()                        *
* Version 3.03.08    29/08/06   All database names now come from cached files *
* Version 3.03.09    29/09/06   NA messages now handled if client mode is off *
* Version 3.04.00    07/02/07   Build from CVS after Simon's handover	      *
* Version 3.04.01    07/02/07   Fix to prevent re-entrant sendmessages to     *
                                cause a crash	      						  *
* Version 3.04.02    13/02/07   Fix to stop crashing on no name in v1 device databse *
*								Removed case sensativity over v1 device file names	 *
* Version 3.04.03    07/08/07   Steve Jensen -- changes from test versions    *
*                               3.03.09 and 3.03.10 - MAX_SESSIONS restored   *
*                               to 4, was set to 1  (had been disabled for    *
*                               West 1 ref. Version 3.03.00)                  *
*                               Correction for DL command error, was limiting *
*                               reports on devices to 998 instead of 999.     *
*                               Correction for no ID command revertives       *
* Version 3.04.04    17/03/08   Correction for Sessions issues. Changed       *
*                               MAX_SESSIONS set to 8, was set to 4.          *
*                               Changes to CSNetSes_SessionClosed().          *
* Version 3.05.00    27/05/08   Rationalised session management down to one   *
*                               queued pipeline                               *
*                               Added session layer checks to remove aborted  *
*                               sessions to CSNetSes_TimeoutChk()             *
* Version 3.05.01    25/06/08   HANGUP_DELAY 100 --> 500 change for sessions  *
*                               interactions with V1CSI sessions              *
* Version 3.05.02    25/06/08   HANGUP delay now INI file parameter           *
* Version 3.05.03    09/07/08   BBC_DATABASEPOLL messages now sent with the   *
*                               value of the revertive switch flag in lParam  *
* Version 3.05.04    12/09/08   Corrected InfoGet bug by rationalising sessions *
* Version 3.05.05    25/11/08   Corrected for a memory leak bug in sessions   *
* Version 3.05.06    02/12/08   Enhancements to data bases loading function   *
                CSDbase_GetDBList()supporting Fabian ADP.     *
                Notes from Simon: The function checks for the *
                presence of the high order database sections  *
                dynamically, ie it does not require a restart *
                if CSI to enable a change to be visible to the*
                Fabian Server.  It works by searching the files *
                pointed to by CSI and checking for the presences *
                of a [Database_x] section.  The mere presence *
                of the section header is sufficient for CSI   *
                to report that the database exists.           *
* Version 3.05.07   13/02/09	Adds peer poll refresh feature

******************************************************************************
******************************************************************************
* Copy taken at this point and merged with V4
******************************************************************************
******************************************************************************
1.0.0.2		02/03/09	first recorded csi32 version
1.0.0.3     03/03/09    corrects V3 file paths, loads correct DLLs (doesn't
                        need bncs_cc.dll)
1.0.0.4		05/03/09	uses sizedBuffer which by default has additional null
                        character (doesn't
                        add to the returned buffer size but ensures that buffer
                        is 	null terminated if used directly as a string)
1.0.0.6		06/03/09	adds csi config file (csi.ini or bncs_system.ini)
1.0.0.7		08/03/09	adds serial numbers to packets (set by SendSerialNumbers
                        in ini file)
1.0.0.8		10/03/09	hex version number now returns 0x03000000 or 0x04000000
                        depending
                        upon the environment type - this is for the odd driver
                        that uses this to determine where to get its config from
1.0.0.9		10/03/09	Nasty one this....a bit of sign extension going on with
                        the serial number checking meaning that every 256th
                        packet was being interpretted as an error
1.0.0.10	12/03/09	Fixes minor problem in reception of serial numbers so
                        that startup of either this ws or another won't flag as
                        an error
                        Introduces array of "device hosted on ws...." This is
                        set by reception of any revertive.
                        Can now flushe cache for all the devices hosted by the
                        errored ws when a packet error is detected - this
                        feature just has to run through the "device hosted on..."
                        array
1.0.0.11	12/03/09	Puts menu items for "send packet serial numbers" and
                        "clear cache on network error".
1.0.0.12	12/03/09	Adds routine to close down inf32fix.exe
1.0.0.13	13/03/09	Changes default for sendserialnumber and
                        clearcacheonpacketerror to off
1.0.0.14	17/03/09	Puts a send buf high water mark and current (number of
                        undeleted buffers)
                        if this hits 10,000 then I don't think they'll get
                        deleted any more
1.0.0.15	17/03/09	Against my better judgement.....added ClearCacheOnNetClose
                        flag
1.0.0.16	19/03/09t	Adds simple check of the number of network buffers that
                        is configured (max of 32)
                        Adds NN (network number) commands to the output command
                        string - this is command packet serial numbers
                        fixes network reset - this just bats the error back to
                        the original code
                        adds ongoing count of netsend errors and puts to the display
1.0.0.17    23/03/09    implements last missing function from V3 - remote
                        directory listing.
                        COMPATIBILITY WARNING - there is code that was faulty in
                        V3 that I got working for csi32
                        V3 and csi32 therefore work differently. I've left it so
                        that a test between V3CSI and CSI32
                        return the SAME results (not necessarily what the code intended)
1.0.18.xx	26/03/09	changes version numbering so last digit is the build number
                        fixes small bug in cache code (no real impact - instead of
                        failing on assigning memory it'll fail trying to lock it)
                        changes cache peer poll errors to hourly rather than single log
                        adds version number to startup log message
                        changes yet another couple of instances of file path
                        length != MAX_PATH
                        adds single character to cache-get buffer size - this gets
                        null terminated by cache calls
1.0.19.xx	30/03/09	Remove static array for async processing of poll commands
                        (when satisifed from the cache)
                        and now uses a queue. In testing I could get this up to
                        200-odd (previous limit was 32)
1.0.20.xx	31/03/09	Adds checking of existing driver window handle before rejecting
                        a new request - this enables crashed drivers
                        to be restarted without having to restart CSI (it usually
                        complains it's already got one).
                        Very minor tarting tidying the source for cscache investigating
                        peerpollcache problems when no serial number errors have been
                        detected
1.0.21.xx	31/03/09	adds dump of stats on exit to log file
                        adds running total of serial number errors (for logging purposes
                        only)
1.0.22.xx	31/03/09	disables all the relevant controls on the dialog when dianostics
                        are disabled
1.0.23.xx	09/04/09	adds registration for notification of packet serial number events
1.0.24.xx	17/04/09	adds ability to query CSI for the extent of an individual device
                        registration - this can be used to repoll after packet error
1.0.25.xx	21/04/09	Great twonk Yates.... Now logs serial number errors using HEX
                        rather than decimal so that CapLog and CSI32 at least report the
                        same numbers...
1.0.26.xx	23/06/09	corrects <MAXDEVICES to <=MAXDEIVCES for NC message
1.0.27.xx	06/07/09	changes defaults for ClearCacheOnNetClose and PeerPollRefresh
                        adds config->edit option
                        adds config->view option
1.0.28.xx	16/07/09	Adds help
1.0.29.xx	20/07/09	adds ability to generate packet errors from menu item
1.0.30.xx	07/09/09	correction to V1 infodriver revertive handling code to ensure it
                        doesn't read past end-of-buffer
1.1.0.xx	29/09/09	changes non-time critical, numeric, returnless SendMessages to
                        PostMessage
                        adds heartbeats
                        adds packet recovery tx buffer
                        adds packet recovery network channel
                        adds packet recovery request messages
                        recovers lost packets
1.1.1.xx	27/10/09	adds packet revertive memories to deal with out of order packet
                        recovery responses
1.1.2.xx	30/10/09	Version for release with packet recovery, packet ordering correction
1.1.3.xx	30/10/09	status infodrivers off heartbeat messages
1.1.4.xx 	02/11/09	more tidying up, removal of historic code and rationalising header
                        files some more.
                        Now should packet recovery properly with router and gpi types too (oops).
1.1.5		19/12/09	Release candidate for W1
                        corrects mS to ms for those that are troubled about these things
                        changes shellexecute from "edit" to "open" for the Edit Config.
                        changes to docs to include Heart beat enable and timeout
1.1.6		21/12/09	does logging of unrecoverable errors in the right place
1.1.7		18/01/10	adds workstation status monitoring - uptime, current time and
                        unrecoverable error count
                        removes redundant "csi version signature"
1.1.8		01/02/10	adds device status monitoring
1.1.9		02/02/10	changes workstation and device monitoring code to do cleanup in
                        thread to ease burden on main thread and timer callback
1.1.10		05/02/10	adds status channel enable flag (for when using heartbeats - for
                        100 workstations saves 10 packets/second)
1.1.11		22/02/10	silly fix to supseded memories not remembing values in the packet
                        that triggered serial number err
                        adds relevant recovered packets to the heartbeat and status infodrivers
1.1.12		25/02/10	changes workstation number in internal device status infodriver slot to
                        be 3 digit zero padded (for ease of decoding in functionally challenged
                        clients)
                        adds explicit logging of network fail/ok messages
                        now does not reset memory of incoming serial numbers on network fail
1.1.13		05/03/10	Adds separate distributeTxRxStatus flag instead of inferring this
                        setting from the heartbeat enable
                        Adds protection around the pollQueue - bits of it became threaded a few
                        versions back
                        removes trailing comma from internal infodriver device status messages
                        removes some of many random debug messages
1.1.14		16/03/10	Another CM triumph.....1.1.13 did not have consistent version numbering
                        (still said 1.1.12 on the titlebar) so this version rebuilt
                        Sets heartbeat to timeout in 2 seconds when a new driver is registered
                        (sends both heartbeats so as to not upset the timeouts of usually
                        out-of-phase driver/client heartbeats)
1.1.15		22/03/10	Adds databaseMgr/database classes to use as optional alternative to
                        pre-loading/compiling database files
1.1.16		22/03/10	Small fix to not compile to disk high order databases if the memory
                        option is set
1.1.17		30/03/10	Moves the point that database load ducks out when using memory databases
                        - this ensures the database size is set
1.1.18		24/05/10	Removes spaces from the end of loaded (bncs)database entries - makes
                        equivalent to ReadPrivateProfileString
1.1.19		03/09/10	Fix to reuse of variable in net inquire code
1.1.20		10/09/10	Fix to fix to reuse of variable in net inquire code
1.1.21		15/09/10	Support for new "capability" questions: BBC_GETMAXDESTS,
                        BBC_GETMAXSOURCES, BBC_GETMAXSOURCENAMES, BBC_GETMAXDESTNAMES
                        Little has changed except that memory databases allows for
                        BBC_GETMAXSOURCENAMES and BBC_GETMAXDESTNAMES to be 4096 (memory names
                        off) or 65535 (memory names on)
1.1.22		21/09/10	Fix to CSNDI_UniPollRevertive where filename in automatic variable was
                        reused between calls - now made static
1.1.23		14/10/10	Adds unload button to overview screen to clear loaded databases (next
                        database call will start load-on-demand again)
1.1.24		04/11/10	Fix to CSMain_TxCmd to range check device number (crash)
1.1.25		09/11/10	Change to database/databaseMgr classes (not relevant to csi32)
1.1.26		18/11/10	Fix to 1.1.24 - range checking did not split off top bit
1.1.27		07/12/10	range checking in cacheclear function of device number (and logging of
                        out of range values)
1.1.28		20/01/11	error in when to check for serial number errors - was not remembering
                        incoming zero serial number (ws restart) so next packet would always
                        generate an error
1.1.29		19/05/11	fix to last version so that packet recovery doesn't try to correct
                        errors from "out or order" recovered packets upsetting the "current"
                        serial number
                        also adds some more meaningful debug to the superseded memories
1.1.30		16/05/11	fix so that dialog enables appropriately when packet recovery is enabled
1.1.31		20/05/11	small typo fix to log message so it says "recovered packet after n
                        attempts" where n is the retry count + 1
                        network close message added to heartbeats - this'll briefly show as
                        "network broken" on old caplogs/CSI
                        device status internal infodriver now updates within 2 seconds on
                        device starting or cleanly closing (unclean close still has to timeout
                        but that's kinda how it is)
                        minor updates to packet recovery docs
1.1.32		23/05/11	fix to 1.1.31 for posted poll on internal workstation infodriver
1.1.33		11/07/11	fix for device profile so database size/type is set correctly for
                        memoryOnlyDatabases
                        now allows DG on internal status infodrivers
                        has new "send queued commands/revertives now" interface constants
                        BBC_SENDQUEUEDCOMMANDS and BBC_SENDQUEUEDREVERTIVES
                        fix to CSCmd_RtrModify to not crop db0 and db1 when using memory databases
                        debug string output when trying to send messages > 256 - such as RM
                        commands with long database names by preference CSI32 now uses RM
                        notification from the driver side which does not suffer the limitation
                        of the uni-revertive message length
1.2.0		19/07/11	Multi-standard build - VC6 and VS2010
1.2.1		20/09/11	Arse. NC equivalent in heartbeats was simply deleting the whole device
                        hosts class rather than just removing the current host
1.2.2		22/09/11	Fix to 1.2.1 to delete the information for the incoming ws number not
                        our ws number
1.2.3		   11/11	Range check to registration function fix (not independently released)
1.2.4		03/11/11	CSCache_Test now traps internal infodrivers
1.2.5		08/11/11	BBC_NETMSGUPDATE now optionally sent (ini file flag) rather than just
                        batted out regardless to all clients
                            NOTE: default for this value is OFF (because ApplCore doesn't use it)
                        Adds case BBC_NETMSGUPDATE_REG / BBC_NETMSGUPDATE_UNREG /
                        BBC_NETTXRXSTATUS_REG / BBC_NETTXRXSTATUS_UNREG to allow for
                            selective registration of these message rather than just blast-all
1.2.6		10/11/11	Tidies registration functions for above new constants and cleans
                        registrations down properly when client closes or is otherwise lost
                        Adds "starting" response to internal infodrivers
1.2.7		03/01/12	Pragmatic if not ideal fix to not delete driver registration
                        automatically if SendMessage return value is zero. This can happen when
                        IPC breaks down (as well as when a driver disappears). Instead this state
                        is also trapped by IsWindow call to see if that handle is valid.
1.2.8		09/01/12	Same as 1.2.7 but for CLIENTS
1.2.9		19/01/12	Flush revertive buffer before sending NC to the network
1.2.10		03/02/12	Now uses absolute reference for up time rather than counting (rather
                        inaccurate) "1 second" ticks
1.2.11		16/02/12	Ooops.....hours have 3600 seconds in them not 3660 - incorrect calculation
                        of uptime for heartbeats
1.2.12		27/02/12	Changes HWND_BROADCAST messages to SendMessageTimeout
                        Adds configuration options to send/not send HWND_BROADCAST messages at
                        all - none of them are required for V4.5
1.2.13		27/02/67	Small slip with section name of new config options
1.2.14		28/02/12	Ineffective tinkering (tidying original code) to try and fix slightly
                        odd startup behaviour on Windows 7 where selecting icon during startup
                        results in small runtime dialog.
1.2.15					There is no version 1.2.15
1.2.16		20/03/12	adds client/driver list diagnostic dialog - shows window handle, IPC
                        type, class name and (if it's available) the module name
                        NOTE that the client module name shown for clients is a raw Windows
                        name which does not include the driver letter but a lower-level Windows
                        name.
                        These process-related calls are tricky anyway, but more particularly
                        not supported on all Windows platforms. If the name cannot be determined
                        then this column will show blank
1.2.17		21/03/12	Small fix to application name in the client/driver listing diagnostics
                        window
1.2.18		21/03/12	Changes orientation of client/driver listing window
1.2.19		25/03/12	Simple hooks to allow early POC testing for external alarms module
1.2.20		04/05/12	makes memory databases consistent with "old fashioned" databases - this
                        means ignoring leading/trailing whitespace
                        also writes database entries with quotes if required - this was faulty
                        for both old and new database writing code
1.2.21		22/06/12	Memory database code couldn't cope with single digit names (fault
                        introduced in 1.2.20 in whitespace-cleaning code)
                        Range checks the value returned by cache for router - otherwise a valid
                        Infodriver cache entry can be Router polled as value 65521 which is the
                        cache valid flag
1.2.22		22/06/12	Memory database was incorrectly rejecting zero-length names and returning
                        --- instead
1.2.23		26/06/12	When sending out heart beat to notify of driver closing the packet
                        was malformed sending out the wrong packet serial number
                        Handles heartbeats driver-side - speeds device/workstation detection
                        as well as making it work for workstations with only drivers enabled
                        Adds CSI start time to internal status infodriver - NOTE THIS ADDS 6
                        FIELDS TO THIS VALUE
                        Removes some irritating heartbeat debug messages
1.2.24		29/06/12	Tiny fix to ensure buffer is big enough to return router revertives when
                        the db0 name is >16 characters
1.2.25		09/07/12	Fix to registration function that with all 999 registrations would overwrite
                        over the end of memory
1.2.26		17/09/12	Doh....silly cut and paste error with the value sent for NB by
                        BBC_NETTXRXSTATUS
1.2.27		03/12/12	Now updates the network with heartbeats to both client and driver side
1.2.28		04/12/12	...fixes to 1.2.27 - now sends on TxRx change overs too
1.2.29		21/02/13	rebuilds for consistent version number 1.2.28 was also labelled 1.2.27
1.2.30		25/02/13	Now closes grd fix as well as infofix on CSI closedown
1.2.31		26/02/13	Recursively creates temp directory
                        actively sets the infodriver cache value to null so that cache get can't return duff values
1.2.32		04/03/13	checks return value of file functions in reading cache values
1.2.33		15/10/13	reworks packet recovery to use NetBIOS not AF_NETBIOS socket so that it works on 64 bit OSs (this
                        was eroneously built but not released with title bar version of 1.2.32)
1.2.34		12/11/13	now has memory cache functions using same code as memory databases
1.2.35		12/11/13	hard won change to ensure that heartbeats are sent out for all registered devices even when
                        there are 999 of them. For a driver that registers all 999 devices this means the internal
                        infodrivers for status show all 999 devices running on that workstation
1.2.36		14/11/13	Tiny tweak to not parse all of the heartbeat messages when there are multiple sent
                        Now only sends "Request to register device xxx from driver hWnd 0xHHHH" messages to the
                        network when CSI has debug mode enabled
1.2.37		26/11/13	Makes buffer for NetDisable big enough to hold the caption data
1.2.38		06/12/13	Updates database functions to be the same as those just optimised for bncslink
                        cache function now returns the correct value on not reading a cache entry (though it absolutely
                          should manage to read it - there are checks further upstream that should ensure it's there...)
1.2.39		070113		tiny fix to disable packet recovery NCBs when diagnostics are disabled
1.2.40		100113		fix to packet recovery code to trap out-of-range workstation numbers (this should not be a problem...but....)
1.2.41		140314		adds generic config change message for CSI clients
1.2.42		170314		fix to iterator for config change notification
1.2.43		240414		minor changes to existing source to allow for VS2010 build (new messaging mechanism!)
1.2.44		020514		Adds redundancy master feature
1.2.45		150514		fix to redundancy master feature to only flop devices in the same group to rxonly not every device
1.2.46		230514		minor change so that BBC_DEVICEIDINUSE is not sent on reception of NO message if the device is already RxOnly
                        - this only goes to reassert the current state
1.2.47		201014		now writes CSI handle to shared-memory DLL so that you don't have to broadcast for it
                        adds BBC_NOTWPARAM (WM_BNCS+400) as sanity check that this window handle is CSI without relying on class name
1.2.48		301014		allows for BBC_CONFIGCHANGE clients that are not normal (revertive) clients by defaulting to BBC_COPYDATA IPC
1.2.49		090315		adds support for 65536 databases
1.2.50		090315		changes default filename for databases (not previously used before 1.2.49) to DEV_nnn.DByyyy (i.e. zero padded
                        four character database name)
1.2.51		310315		No functional changes - now uses shared version of database support files rather than local ones (so the joy
                        can be shared wider with the database code)
1.2.52		010515		changes icon to new style
1.2.53		260615		adds new feature to client/driver diagnostics to measure time taken for IPC
1.2.54		020715		no code changes - merely optimises the definitions of MAX_DEVICES and a couple of others into a single place
1.2.55		040715		adds BBC_NETTXRXSTATUS_BROADCAST_ENABLED to programatically get the state of DistributeBBC_NETTXRXSTATUS ini file setting
                        adds BBC_NETMSGUPDATE_BROADCAST_ENABLED to programatically get the state of distributeNetMsg ini file setting
1.2.56		060715		all standard profile/file functions should now resolve environment variables
1.2.57		171215		adds "deaf to self" setting so that CSI32 can be used as a gateway interface
1.2.58		040216		adds BBC_SETREDUNDANCYMASTER new API feature so that redundancy mastering can be set on the fly by drivers that understand it
1.2.59		050216		fix to redundancy mastering when receiving a NC (net close)
                        scope fix to BBC_DATABASECHANGE notification in case someone comes along and changes something synchronously
                        removes message to network about master device change since this info can be picked up in heartbeats and kinda misses the point of
                        generating lots of traffic when such status changes
1.2.60		060216		revertive messages now set target workstation in wParam (previously hard-coded tozero) so that you can tell if this was a poll
                        response or change of state
1.2.61		120416		When setting the TxRx state of a device don't bother the network with a change of state when the state hasn't actually changed.
                        This is important for requesting rxonly when already in rxonly state - otherwise you send out an NC message which implies Tx driver going rxonly
1.2.62		140416		fix to 1.2.60 - poll responses satisfied from cache now contain this workstation's number to distinguish these poll responses from change of state
1.2.63		210416		Fix to 1.2.61 to re-assert txrx states when it's needed
******************************************************************************/