User`s guide

KwikNet Sample Program Architecture
K
A
DAK
E - 1
E. KwikNet Sample Program Architecture
The manner in which the KwikNet TCP/IP Sample Program starts and operates is
completely dependent upon the underlying operating system with which KwikNet is being
used. Operation can be either multitasking or single threaded. All sample programs
provided with KwikNet and its optional components share the common implementation
methodology about to be described.
All KwikNet sample programs are built upon a common framework. The building blocks
are a set of files located in toolset directory TOOLXXX\SAM_COMN where XXX is KADAK's
mnemonic for the particular set of software development tools which you are using. The
common files and the procedures which they contain are listed in Figure E-1.
A quick review of the common sample program files will indicate that most of the
implementation is devoted to the man/machine interface and to the startup process.
These two topics always seem to account for the bulk of any networking example, no
matter how simple the actual network operations may be.
Console Interface
The KwikNet data logging service, message recording service and console driver have
been described in detail in Chapters 1.6 to 1.7 of the KwikNet TCP/IP Stack User's Guide.
If you review that material again, you will note that the procedures referenced in the
description are all present in the common sample program modules listed in Figure E-1.
The sample programs use KwikNet procedure kn_dprintf() to record messages using the
KwikNet data logging service. KwikNet passes each such message to the log function
sam_record() in the Application OS Interface module KNSAMOS.C. This common log
function is specified on the Debug property page of the Network Parameter File provided
with each KwikNet sample program.
The sample programs use console driver procedures knconin() and knconins() for
console input and knconout() and knconouts() for console output.
The sample programs also use a command line parsing service provided by console
driver procedure
kncon_parse(). This procedure parses a command string into its
various tokens according to directions provided by the caller.
The sample programs use a common error message generation service provided by
console driver procedure kncon_error(). This procedure generates an error message on
the console device. The error message is derived from a
KwikNet error code using a
message list provided by the sample program.
Many of the interactive
KwikNet sample programs implement a dump command to display
recorded messages. These applications call console driver procedure
kncon_logdump()
to extract all of the message strings from the recording array using recording procedure
kn_loggets(). The extracted messages are displayed on the console device. Once all
recorded strings have been displayed, the recording list is reset with a call to recording
procedure
kn_loginit().