BPQ32 is an AX.25 and NETROM protocol packet switching system for use in Radio Amateur Packet Networks. The software provides similar functionality to the DOS program BPQCODE.EXE. The switch can run on it's own, as a stand-alone switch, but is more likely to be used to support one or more application programs, such as a Packet BBS, DX Cluster or Chat Server. This document defines the interface provided by BPQ32 to such application programs.
BPQ32 is a port of the 16bit DOS program BPQCODE.EXE to the Win32 environment. Win32 programs are likely to be written in a high level language, such as "C" or Visual Basic, rather than the Assembler usually used with DOS. The DOS API expects most parameters in CPU Registers, which is inconvenient in high level languages, especially Visual Basic. So BPQ32.DLL uses pointers to integers for these parameters. Most Windows API calls map more or less directly onto the corresponding DOS API functions - see BPQHOST.TXT for full details of the DOS BPQHost API. BPQ32 also supports this interface, with 32 bit registers replacing the 16 bit registers used in the DOS version, but this interface is most likely to be of use when porting old 16 bit apps to Win32.
BPQ32 is implemented as a shared data DLL.
Applications are either linked to the DLL, so that the DLL is loaded as part of
the application, explicitly load the DLL using the Win32 LoadLibrary
function, or use the interface provided by the OLE (Active-X) control
BPQCTRL.OCX
. Normally the switch is loaded and
initialised when the first application connects to it, and remains running until
the last application closes. Subsequent applications connect to the same copy of
the switch. For this to work properly, all applications must load BPQ32.DLL from
the same directory. If you want the switch to remain running while your
application is closed and restated, then you can run BPQ32.exe first. This is a
dummy program, who's sole funtion is to hold bpq32.dll in memory.
The
program is a mixture of Assembler and C, and was developed using Microsoft
Visual C++ Version 4.
This document applies to BPQ32.DLL, Version 4.09v.
The BPQ32 switch supports up to 64 simultaneous
connections, called streams in the following text. The application program
(called program from now on, to avoid confusion with the Application definitions
within the switch) interacts with the switch over these streams, and the switch
manages connections with other stations in the network. For normal
communication, the program need not be aware of the physical network
configuration. However, the API does provide a way of sending packets such as
Beacons to individual radio ports.
The switch does not limit the number
of programs that may use it, but only supports 8 that may be connected
to by outside users. Each of these 8 applications may be given their own
callsign and alias, and may be advertised over the NETROM network. If they do
not have their own calls, users access them by connection to the switch, then
sending an appropriate command to the
switch.
A program must allocate a number of streams at
startup in order to receive incoming calls. Normally it calls
FindFreeStream
- it is possible to allocate a particular stream
using
AllocateStream
, but this requires careful coordination
between applications, to make sure two don't try to use the same stream. It then
calls
SetAPPL
to define which of the 8 Applications it is
supporting. The program may also pre-allocate streams for outgoing connects, or
may allocate and deallocate them as required. All streams should be released
(using
DeallocateStream
) before the program
terminates.
The program may poll the switch for connections,
disconnections and messages, but normally it is better to get the switch to post
notifications to the application Window. This is done by using BPQSetHandle
to associate a stream with a Window Handle.
The following are Visual Basic (VB4) declarations for functions not available via bpqctrl.ocx Private Declare Sub WritetoConsole Lib "bpq32.dll" _ Alias "_WritetoConsole@4" (ByVal Buffer As String) Private Declare Function GetPortNumber Lib "bpq32.dll" _ Alias "_GetPortNumber@4" (ByVal portslot As Long) As Long Private Declare Function ChangeSessionCallsign Lib "bpq32.dll" _ Alias "_ChangeSessionCallsign@8" (ByVal Stream As Long, ByVal AXCall As String) As Long Private Declare Function GetMinimizetoTrayFlag Lib "bpq32.dll" _ Alias "_GetMinimizetoTrayFlag@0" () As Boolean Private Declare Function AddTrayMenuItem Lib "bpq32.dll" _ Alias "_AddTrayMenuItem@8" (ByVal Handle As Long, ByVal Label As String) As Long Private Declare Function DeleteTrayMenuItem Lib "bpq32.dll" _ Alias "_DeleteTrayMenuItem@4" (ByVal Handle As Long) As LongJohn Wiseman G8BPQ