networkclient
|
Data Structures | |
struct | nr_retransmit_config_t |
Typedefs | |
typedef enum nr_transmit_state_t | nr_transmit_state_t |
typedef struct nr_retransmit_config_t | nr_retransmit_config_t |
Functions | |
int | nr_transmit_init (nr_track_id_t *s, RADIUS_PACKET *request) |
int | nr_transmit (nr_track_id_t *s, struct timeval *when, RADIUS_PACKET *request, RADIUS_PACKET *response) |
These routines manage RADIUS retransmits, multiple simultaneous packets, etc. These routines are not part of the BSD licensed RADIUS library.
typedef struct nr_retransmit_config_t nr_retransmit_config_t |
Configuration for retransmitting a request.
See RFC 5080 Section 2.2.1 for the meaning of the individual fields. The times given in these fields are used as a basis for the calculations, and are not fixed (i.e. absolute) values. The RFC requires that "jitter" be added, so that retransmissions do not "clump" together.
The functions that take this structure as an argument also accept a NULL pointer instead of a pointer to this structure. In that case, those functions use "default" values. You should nearly always use NULL, as changing the default values is not recommended.
If you do need to change these value, we recommend first changing only nr_transmit_config_t::mrd, to set the maximum retransmit duration. Set the other values to the defaults recommended below.
It is possible to change the nr_transmit_config_t::mrc field, but we recommend always leaving it at the default value.
The nr_transmit_config_t::irt and nr_retransmit_config_t::mrt fields should never be changed from the defaults. They are here solely for completeness of the API.
typedef enum nr_transmit_state_t nr_transmit_state_t |
The state of a packet being sent from a client to a server.
enum nr_transmit_state_t |
The state of a packet being sent from a client to a server.
int nr_transmit | ( | nr_track_id_t * | s, |
struct timeval * | when, | ||
RADIUS_PACKET * | request, | ||
RADIUS_PACKET * | response | ||
) |
Transmits a request om a client to a server, and updates timers to wait for the reply.
The RADIUS_PACKET::state field should be set before this function is called. It should be examined when the function returns. For RADIUS over TCP, reading from the socket will return 0 bytes when the server has closed the TCP connection. That condition can happens when RADIUS_PACKET::state is NR_TRANSMIT_CONTINUE, and the function returns 0. It returns 1 when it re-sends a request.
We strongly recommend using this API to get tranmission timers. It follows the relevant RFCs, and is intended to be robust and simple. All other "ad hoc" methods are more fragile and cause problems.
[in] | s | The transmission tracking structure. |
[in,out] | when | On input, the time of "now". On output, the next time that nr_transmit() should be called. |
[in] | request | The packet to transmit |
[in] | response | The response which was received. |
References NR_TRANSMIT_HAVE_RESPONSE, NR_TRANSMIT_INITIAL, NR_TRANSMIT_TIMEOUT, return_NR_ERR, and radius_packet::state.
int nr_transmit_init | ( | nr_track_id_t * | s, |
RADIUS_PACKET * | request | ||
) |
Initialize a RADIUS_PACKET structure for sending.
[in] | s | The server to which we send packets. |
[in] | request | The packet to transmit |
References radius_packet::attempts, radius_packet::delay, NR_TRANSMIT_INITIAL, return_NR_ERR, radius_packet::secret, nr_track_id_t::secret, radius_packet::sizeof_secret, nr_track_id_t::sizeof_secret, and radius_packet::state.
Referenced by main().