BL4S200 User’s Manual
151
The data passed to the callback function are ephemeral since another scan may occur.
Thus, the data need to be used (or copied) during the callback function.
While waiting for user input, it is important to keep the network alive by calling
tcp_tick(NULL)
regularly.
6.2.5 RCM5400W Sample Programs
The following sample programs are in the Dynamic C
SAMPLES\RCM5400W\TCPIP\
folder.
•
PASSPHRASE.C
—This program demonstrates how to perform the CPU-intensive process
of converting an ASCII passphrase into a WPA PSK hex key.
For security reasons, the mapping function is deliberately designed to be CPU-intensive
in order to make a dictionary-based attack more difficult. It can take on the order of 40
seconds to perform the 4096 iterations on the BL5S220. Since this may be an unaccept-
able amount of time to “block” the application program, a method is provided to split
up the computation.
As you compile and run this sample program, there is no network activity. You will
only notice that some information is printed out in the Dynamic C
STDIO
window.
•
PINGLED_STATS.C
—This program is similar to
PINGLED.C
, but it also displays
receiver/transmitter statistics in the Dynamic C
STDIO
window.
Before you compile and run this sample program, change
PING_WHO
to the host you
want to ping. You may modify
PING_DELAY
define to change the amount of time in
milliseconds between the outgoing pings.
Modify the value in the
MOVING_AVERAGE
macro to change the moving average filter-
ing of the statistics. Also review the
GATHER_INTERVAL
and
GRAPHICAL
macros,
which affect the number of samples to gather and create a bar graph display instead of a
numeric display.
Uncomment the
VERBOSE
define to see the incoming ping replies.
•
PINGLED_WPA_PSK.C
—This program demonstrates the use of WPA PSK (Wi-Fi
Protected Access with Pre-Shared Key). WPA is a more secure replacement for WEP.
The implementation in the sample program supports use of the TKIP (Temporal Key
Integrity Protocol) cypher suite.
The sample program uses macros to configure the access point for WPA PSK, specify
the TKIP cypher suite, assign the access point SSID, and set the passphrase.
#define WIFI_USE_WPA // Bring in WPA support
#define IFC_WIFI_ENCRYPTION IFPARAM_WIFI_ENCR_TKIP // Define cypher suite
#define IFC_WIFI_SSID "parvati"
#define IFC_WIFI_WPA_PSK_PASSPHRASE "now is the time"