All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Functions
clients.h File Reference

API to add client definitions to the server, both on startup and at runtime. More...

Go to the source code of this file.

Data Structures

struct  radclient
 Describes a host allowed to send packets to the server. More...
 

Typedefs

typedef int(* client_value_cb_t )(char **out, CONF_PAIR const *cp, void *data)
 Callback for retrieving values when building client sections. More...
 
typedef struct radclient RADCLIENT
 Describes a host allowed to send packets to the server. More...
 
typedef struct radclient_list RADCLIENT_LIST
 

Functions

bool client_add (RADCLIENT_LIST *clients, RADCLIENT *client)
 Add a client to a RADCLIENT_LIST. More...
 
bool client_add_dynamic (RADCLIENT_LIST *clients, RADCLIENT *master, RADCLIENT *c)
 Add a dynamic client. More...
 
RADCLIENTclient_afrom_cs (TALLOC_CTX *ctx, CONF_SECTION *cs, bool in_server, bool with_coa)
 Allocate a new client from a config section. More...
 
RADCLIENTclient_afrom_query (TALLOC_CTX *ctx, char const *identifier, char const *secret, char const *shortname, char const *type, char const *server, bool require_ma) CC_HINT(nonnull(2
 
RADCLIENTclient_afrom_request (RADCLIENT_LIST *clients, REQUEST *request)
 Create a new client, consuming all attributes in the control list of the request. More...
 
void client_delete (RADCLIENT_LIST *clients, RADCLIENT *client)
 
RADCLIENT RADCLIENTclient_find (RADCLIENT_LIST const *clients, fr_ipaddr_t const *ipaddr, int proto)
 
RADCLIENTclient_find_old (fr_ipaddr_t const *ipaddr)
 
RADCLIENTclient_findbynumber (RADCLIENT_LIST const *clients, int number)
 
void client_free (RADCLIENT *client)
 
void client_list_free (RADCLIENT_LIST *clients)
 
RADCLIENT_LISTclient_list_init (CONF_SECTION *cs)
 
RADCLIENT_LISTclient_list_parse_section (CONF_SECTION *section, bool tls_required)
 
int client_map_section (CONF_SECTION *out, CONF_SECTION const *map, client_value_cb_t func, void *data)
 Create a client CONF_SECTION using a mapping section to map values from a result set to client attributes. More...
 
RADCLIENTclient_read (char const *filename, int in_server, int flag)
 

Detailed Description

API to add client definitions to the server, both on startup and at runtime.

Id:
3de383ea58cdc983dcc430dac180f64ad489e527
Author
Arran Cudbard-Bell a.cud.nosp@m.bard.nosp@m.b@fre.nosp@m.erad.nosp@m.ius.o.nosp@m.rg

Definition in file clients.h.


Data Structure Documentation

struct radclient

Describes a host allowed to send packets to the server.

Definition at line 35 of file clients.h.

+ Collaboration diagram for radclient:
Data Fields
fr_stats_t acct Accounting stats.
fr_stats_t auth Authentication stats.
char const * client_server Virtual server associated with this dynamic client.

Only used where client specifies a network of potential clients.

fr_stats_t coa Change of Authorization stats.
char const * coa_name Name of the CoA home server or pool.
home_pool_t * coa_pool The CoA home_pool_t the client is associated with.

Must be used exclusively from coa_server.

home_server_t * coa_server The CoA home_server_t the client is associated with.

Must be used exclusively from coa_pool.

time_t created When the client was created.
CONF_SECTION * cs CONF_SECTION that was parsed to generate the client.
bool defines_coa_server Client also defines a home_server.
fr_stats_t dsc Disconnect-Request stats.
uint32_t dynamic Whether the client was dynamically defined.
fr_ipaddr_t ipaddr IPv4/IPv6 address of the host.
time_t last_new_client Used for relate limiting addition and deletion of dynamic clients.
uint32_t lifetime How long before the client is removed.
fr_socket_limit_t limit Connections per client (TCP clients only).
char const * login Username to use for simultaneous use checks.
char const * longname Client identifier.
bool message_authenticator Require RADIUS message authenticator in requests.
char const * nas_type Type of client (arbitrary).
int number Unique client number.
char const * password Password to use for simultaneous use checks.
int proto Protocol number.
bool rate_limit Where addition of clients should be rate limited.
struct timeval response_window How long the client has to respond.
char const * secret Secret PSK.
char const * server Virtual server client is associated with.
char const * shortname Client nickname.
fr_ipaddr_t src_ipaddr IPv4/IPv6 address to send responses from (family must match ipaddr).

Typedef Documentation

typedef int(* client_value_cb_t)(char **out, CONF_PAIR const *cp, void *data)

Callback for retrieving values when building client sections.

Example:

int _client_value_cb(char **out, CONF_PAIR const *cp, void *data)
{
my_result *result = data;
char *value;
value = get_attribute_from_result(result, cf_pair_value(cp));
if (!value) {
out = NULL;
return 0;
}
out = talloc_strdup(value);
free_attribute(value);
if (!*out) return -1;
return 0;
}
Parameters
[out]outWhere to write a pointer to the talloced value buffer.
[in]cpThe value of the CONF_PAIR specifies the attribute name to retrieve from the result.
[in]dataPointer to the result struct to copy values from.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 136 of file clients.h.

typedef struct radclient RADCLIENT

Describes a host allowed to send packets to the server.

Definition at line 104 of file clients.h.

Function Documentation

bool client_add ( RADCLIENT_LIST clients,
RADCLIENT client 
)

Add a client to a RADCLIENT_LIST.

Parameters
clientslist to add client to, may be NULL if global client list is being used.
clientto add.
Returns
  • true on success.
  • false on failure.

Definition at line 192 of file client.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool client_add_dynamic ( RADCLIENT_LIST clients,
RADCLIENT master,
RADCLIENT c 
)

Add a dynamic client.

Definition at line 708 of file client.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RADCLIENT* client_afrom_cs ( TALLOC_CTX *  ctx,
CONF_SECTION cs,
bool  in_server,
bool  with_coa 
)

Allocate a new client from a config section.

Parameters
ctxto allocate new clients in.
csto process as a client.
in_serverWhether the client should belong to a specific virtual server.
with_coaIf true and coa_server or coa_pool aren't specified automatically, create a coa home_server section and add it to the client CONF_SECTION.
Returns
new RADCLIENT struct.

Definition at line 858 of file client.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RADCLIENT* client_afrom_query ( TALLOC_CTX *  ctx,
char const *  identifier,
char const *  secret,
char const *  shortname,
char const *  type,
char const *  server,
bool  require_ma 
)

+ Here is the caller graph for this function:

RADCLIENT* client_afrom_request ( RADCLIENT_LIST clients,
REQUEST request 
)

Create a new client, consuming all attributes in the control list of the request.

Parameters
clientslist to add new client to.
requestFake request.
Returns
  • New client on success.
  • NULL on error.

Definition at line 1175 of file client.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void client_delete ( RADCLIENT_LIST clients,
RADCLIENT client 
)

Definition at line 378 of file client.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RADCLIENT RADCLIENT* client_find ( RADCLIENT_LIST const *  clients,
fr_ipaddr_t const *  ipaddr,
int  proto 
)

Definition at line 431 of file client.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RADCLIENT* client_find_old ( fr_ipaddr_t const *  ipaddr)

Definition at line 472 of file client.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RADCLIENT* client_findbynumber ( RADCLIENT_LIST const *  clients,
int  number 
)

Definition at line 402 of file client.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void client_free ( RADCLIENT client)

Definition at line 62 of file client.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void client_list_free ( RADCLIENT_LIST clients)

Definition at line 140 of file client.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RADCLIENT_LIST* client_list_init ( CONF_SECTION cs)

Definition at line 173 of file client.c.

+ Here is the caller graph for this function:

RADCLIENT_LIST* client_list_parse_section ( CONF_SECTION section,
bool  tls_required 
)

+ Here is the caller graph for this function:

int client_map_section ( CONF_SECTION out,
CONF_SECTION const *  map,
client_value_cb_t  func,
void *  data 
)

Create a client CONF_SECTION using a mapping section to map values from a result set to client attributes.

If we hit a CONF_SECTION we recurse and process its CONF_PAIRS too.

Note
Caller should free CONF_SECTION passed in as out, on error. Contents of that section will be in an undefined state.
Parameters
[in,out]outSection to perform mapping on. Either the root of the client config, or a parent section (when this function is called recursively). Should be alloced with cf_section_alloc, or if there's a separate template section, the result of calling cf_section_dup on that section.
[in]mapsection.
[in]functo call to retrieve CONF_PAIR values. Must return a talloced buffer containing the value.
[in]datato pass to func, usually a result pointer.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 775 of file client.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RADCLIENT* client_read ( char const *  filename,
int  in_server,
int  flag 
)

Definition at line 1449 of file client.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function: