Installation guide

86 DC 900-1325I
Freeway Server-Resident Application (SRA) Programmer Guide
6.5 Example SRA Filters
The source code for two example filter functions (one which filters messages to the
WAN, and another which filters messages from the WAN) is in
freeway/client/test/sra.
Specifically, the
filter.c file contains the source code for the two filter functions which
implement DOS to UNIX text format conversions (as described in Section 4.2.4 on
page 62).
The example filters make the following assumptions:
The client application is assumed to be a UNIX system, where end-of-line (EOL)
is indicated by a single newline character (an ASCII line feed character).
The remote application on the WAN is running on a VMS or Windows system,
where EOL is indicated by a carriage return/line feed sequence.
Only single-block text messages are being transferred.
The byte ordering in the protocol header is the same as the native byte ordering of
the CPU executing the filters. (If the client program which is sending and receiv-
ing the data also runs as an SRA, then it uses the same CPU as the filters and there-
fore the protocol headers will be in the correct byte order.)
The protocol header command that indicates a data packet (as opposed to a con-
trol packet) is
DLI_PROT_SEND_NORM_DATA.
The function that filters packets coming from the WAN (function Filter_From_WAN)
first checks whether the packet contains data or whether it is a control packet. Control
packets are ignored. Note that the function checks both possible byte orders for the
DLI_PROT_SEND_NORM_DATA command.
The function next determines the amount of data contained in the packet and dumps
the data to the Freeway log file. The sole reason for dumping the data is to give visual
evidence that the filters are indeed performing their functions.