networkclient
Example client programs

Files

file  example_1.c
 Sample code to initialize a RADIUS packet.
 
file  example_2.c
 Sample code to initialize a RADIUS packet.
 
file  example_3.c
 Sample code to initialize a RADIUS packet and a response to it.
 
file  example_4.c
 Allocate and manage multiple packets.
 
file  example_5.c
 Sample code to initialize a RADIUS packet send it to a server.
 

Detailed Description

Example programs

The library includes a number of example programs. These programs show how the APIs can be used.w

Initializing a packet

Code - example_1.c

This example initializes a packet, and then adds User-Name and User-Password to it. The resulting packet is then printed to the standard output.

Using CHAP password.

Code - example_2.c

This example initializes a packet, and then adds User-Name and CHAP-Password to it. The resulting packet is then printed to the standard output.

Creating a response packet

Code - example_3.c

This example initializes a packet, and then adds User-Name and User-Password to it. The resulting packet is then printed to the standard output.

As a next step, it then creates the response, and prints that, too.

Allocate and manage multiple packets

Code - example_4.c

This example creates multiple packets, and allocates RADIUS ID fields for them. The purpose of this example is to show how the nr_transmit() API works. See also transmit.c

Send and receive one packet

Code - example_5.c

This example initializes a packet, and then adds User-Name and User-Password to it. The resulting packet is then printed to the standard output.

The packet is sent to a server, and waits for a response. It then prints the response.

Send and receive one packet

Code - example_6.c

This example initializes a packet, and then adds User-Name and User-Password to it. An ID is allocated for the packet. The resulting packet is then printed to the standard output.

The packet is sent to a server, and waits for a response. It then prints the response.

The difference between this example and example_5.c is that the previous example just sent one packet in a blocking call. This example shows how multiple packets can be sent using the ID tracking API.