Radcli library 1.5.3
A simple radius library
Loading...
Searching...
No Matches
Miscellaneous API

Miscellaneous functions. More...

Functions

unsigned short rc_getport (int type)
 Get the port number for the supplied request type.
int rc_own_hostname (char *hostname, int len)
 Get the hostname of this machine.
int rc_get_srcaddr (struct sockaddr *lia, const struct sockaddr *ria)
 Find outbound interface address for a given destination.
void rc_setdebug (int debug)
 Set debug logging level.
void rc_openlog (char const *ident)
 Open the system log for radcli messages.

Detailed Description

Miscellaneous functions.

All radcli error and informational messages are emitted via syslog(3) (facility LOG_DAEMON by default). An application controls where those messages go by calling openlog(3) with its own ident and facility before making any radcli calls. The rc_openlog() and rc_setdebug() functions below are kept for source compatibility with older code; new code should use openlog(3) and the clientdebug config option directly.

Function Documentation

◆ rc_get_srcaddr()

int rc_get_srcaddr ( struct sockaddr * lia,
const struct sockaddr * ria )

Find outbound interface address for a given destination.

Given remote address find local address which the system will use as a source address for sending datagrams to that remote address.

Parameters
[out]lialocal address.
[in]riathe remote address.
Returns
OK_RC on success. NETUNREACH_RC if network is unreachable (i.e. no route to destination). ERROR_RC for all other failures. Address is filled into the first argument.

Definition at line 125 of file ip_util.c.

◆ rc_getport()

unsigned short rc_getport ( int type)

Get the port number for the supplied request type.

Parameters
typeAUTH or ACCT.
Returns
the port number.

Definition at line 64 of file ip_util.c.

◆ rc_openlog()

void rc_openlog ( char const * ident)

Open the system log for radcli messages.

Deprecated
New code should call openlog(3) directly. radcli emits all messages via syslog(3); opening the log with your application's own ident and facility before the first radcli call is sufficient. This function is a thin wrapper around openlog() retained for source compatibility with freeradius-client and radiusclient-ng.
Parameters
identprogram name passed to openlog(3).

Definition at line 54 of file log.c.

◆ rc_own_hostname()

int rc_own_hostname ( char * hostname,
int len )

Get the hostname of this machine.

Parameters
hostnamewill hold the name of the host.
lenthe size of hostname.
Returns
-1 on failure, 0 on success.

Definition at line 82 of file ip_util.c.

◆ rc_setdebug()

void rc_setdebug ( int debug)

Set debug logging level.

Deprecated
Prefer setting clientdebug in the configuration file (rc_read_config()) or rc_add_config(). Using this function bypasses the config file and is retained only for source compatibility with freeradius-client and radiusclient-ng.
Parameters
debugdebug level; 0 disables debug output, positive values enable it.

Definition at line 39 of file log.c.