Helper functions

Handling network addresses and encryption keys. More...

Functions

kvrStatus kvrGetErrorText (kvrStatus error, char *buffer, uint32_t buffer_size)
 
uint16_t kvrGetVersion (void)
 
kvrStatus kvrStringFromAddress (char *buffer, uint32_t buffer_size, const kvrAddress *address)
 
kvrStatus kvrAddressFromString (int32_t address_type, kvrAddress *address, const char *address_string)
 
kvrStatus kvrWlanGetSecurityText (char *security_string, uint32_t security_string_size, uint32_t capability, uint32_t type_wpa, const kvrCipherInfoElement *wpa_info, const kvrCipherInfoElement *rsn_info)
 
kvrStatus kvrNetworkGenerateWepKeys (const char *pass_phrase, char *key64_1, char *key64_2, char *key64_3, char *key64_4, char *key128)
 
kvrStatus kvrNetworkGenerateWpaKeys (const char *pass_phrase, const char *ssid, char *key)
 

Detailed Description

Handling network addresses and encryption keys.

Function Documentation

◆ kvrAddressFromString()

kvrStatus kvrAddressFromString ( int32_t  address_type,
kvrAddress address,
const char *  address_string 
)

Convert a C string into a kvrAddress.

Examples:

Parameters
[in]address_typekvrAddressType_xxx to convert into.
[out]addressReturned address.
[in]address_stringC string to convert into a kvrAddress.
Examples:
example/c/kvrConnect.c.

◆ kvrGetErrorText()

kvrStatus kvrGetErrorText ( kvrStatus  error,
char *  buffer,
uint32_t  buffer_size 
)

Convert a kvrStatus errorcode to a text.

Parameters
[in]errorThe error code to convert.
[out]bufferBuffer to receive error text.
[in]buffer_sizeBuffer size in bytes.
Examples:
example/c/kvrConnect.c.

◆ kvrGetVersion()

uint16_t kvrGetVersion ( void  )

Return the version of the kvrlib DLL. The most significant byte is the major version number and the least significant byte is the minor version number.

C#
static Int16 kvrGetVersion();
Delphi
function kvrGetVersion: Word;
Returns
version number of kvrlib32.dll

◆ kvrNetworkGenerateWepKeys()

kvrStatus kvrNetworkGenerateWepKeys ( const char *  pass_phrase,
char *  key64_1,
char *  key64_2,
char *  key64_3,
char *  key64_4,
char *  key128 
)

Generates four 64-bit and one 128-bit WEP keys.

All generated keys are returned as ASCII hexadecimal C strings.

Parameters
[in]pass_phraseThe pass phrase as a C string.
[out]key64_1Generated 64-bit WEP key 1 (10 + 1 bytes).
[out]key64_2Generated 64-bit WEP key 2 (10 + 1 bytes).
[out]key64_3Generated 64-bit WEP key 3 (10 + 1 bytes).
[out]key64_4Generated 64-bit WEP key 4 (10 + 1 bytes).
[out]key128Generated 128-bit WEP key (26 + 1 bytes).
Returns
kvrOK on success or any other kvrStatus on failure.

◆ kvrNetworkGenerateWpaKeys()

kvrStatus kvrNetworkGenerateWpaKeys ( const char *  pass_phrase,
const char *  ssid,
char *  key 
)

Generates a WPA key.

Parameters
[in]pass_phraseThe pass phrase as a C string.
[in]ssidSSID as a C string. Maximum length is 32 bytes.
[out]keyThe WPA key, 256 bits as a an ASCII hexadecimal C string (64 + 1 bytes).
Returns
kvrOK on success or any other kvrStatus on failure.

◆ kvrStringFromAddress()

kvrStatus kvrStringFromAddress ( char *  buffer,
uint32_t  buffer_size,
const kvrAddress address 
)

Convert a kvrAddress to a text string. The output format depends on the kvrAddressType_xxx. buffer_size must be the maximum lenth for each type. i.e. kvrAddressType_IPV4 must have lenght at least 16.

Parameters
[out]bufferThe converted string as a C string.
[in]buffer_sizeSize of buffer.
[in]addressThe address to convert.
Examples:
example/c/kvrConnect.c.

◆ kvrWlanGetSecurityText()

kvrStatus kvrWlanGetSecurityText ( char *  security_string,
uint32_t  security_string_size,
uint32_t  capability,
uint32_t  type_wpa,
const kvrCipherInfoElement wpa_info,
const kvrCipherInfoElement rsn_info 
)

Returns a C string in human readable format from the security information gathered with kvrWlanGetScanResults()

Example output: "WPA2: G-TKIP (PSK) P1-AES P2-TKIP WPA: G-TKIP (PSK) P1-AES P2-TKIP"

The above example shows a network using Pre-Shared Key with both WPA2 and WPA enabled, for both modes, a group key using TKIP is needed, and in both modes you can choose between AES (CCMP) and TKIP as the cipher for the pairwise key.

The length of the generated string could theoretically be up to about 180 characters. If the length of the supplied security_string is too short, the result will be truncated and the function will return kvrERR_PARAMETER.

Parameters
[out]security_stringA C string.
[in]security_string_sizeMax size of security_string.
[in]capabilityThe advertised capabilities of the BSS.
[in]type_wpaAuthentication suite type.
[in]wpa_infoAdvertised information for WPA.
[in]rsn_infoAdvertised information for RSN.
Returns
kvrOK on success or any other kvrStatus on failure.
Examples:
example/c/kvrConfig.c.