/** Returns the SIM method EAP-SIM or EAP-AKA hinted at by the user identifier
*
- * %{aka_sim_id_method:&id_attr}
+@verbatim
+%{aka_sim_id_method:&id_attr}
+@endverbatim
+ *
+ * @ingroup xlat_functions
*/
static ssize_t aka_sim_xlat_id_method_xlat(TALLOC_CTX *ctx, char **out, UNUSED size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
/** Returns the type of identity used
*
- * %{aka_sim_id_type:&id_attr}
+@verbatim
+%{aka_sim_id_type:&id_attr}
+@endverbatim
+ *
+ * @ingroup xlat_functions
*/
static ssize_t aka_sim_xlat_id_type_xlat(TALLOC_CTX *ctx, char **out, UNUSED size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
/** Returns the key index from a 3gpp pseudonym
*
- * %{3gpp_pseudonym_key_index:&id_attr}
+@verbatim
+%{3gpp_pseudonym_key_index:&id_attr}
+@endverbatim
*
+ * @ingroup xlat_functions
*/
static ssize_t aka_sim_3gpp_pseudonym_key_index_xlat(TALLOC_CTX *ctx, char **out, UNUSED size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
return talloc_array_length(*out) - 1;
}
+/** Decrypt a 3gpp pseudonym
+ *
+@verbatim
+%{3gpp_pseudonym_decrypt:&id_attr &key_attr}
+@endverbatim
+ *
+ * @ingroup xlat_functions
+ */
static ssize_t aka_sim_3gpp_pseudonym_decrypt_xlat(TALLOC_CTX *ctx, char **out, UNUSED size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
REQUEST *request, char const *fmt)
/** Encrypts a 3gpp pseudonym
*
- * %{3gpp_pseudonym_encrypt:&id_attr &key_attr key_index}
+@verbatim
+%{3gpp_pseudonym_encrypt:&id_attr &key_attr key_index}
+@endverbatim
*
+ * @ingroup xlat_functions
*/
static ssize_t aka_sim_3gpp_pseudonym_encrypt_xlat(TALLOC_CTX *ctx, char **out, UNUSED size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
return len;
}
-/*
- * Xlat for %{config:section.subsection.attribute}
+/** xlat to get config values
+ *
+@verbatim
+%{config:section.subsection.attribute}
+@endverbatim
+ *
+ * @ingroup xlat_functions
*/
static ssize_t xlat_config(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
} xlat_redundant_t;
+/** xlat "redundant" processing
+ *
+ * Processes xlat calls for modules defined in "redundant"
+ * sub-sections of the instantiate configuration.
+ *
+ * @ingroup xlat_functions
+ */
static ssize_t xlat_redundant(TALLOC_CTX *ctx, char **out, NDEBUG_UNUSED size_t outlen,
void const *mod_inst, UNUSED void const *xlat_inst,
REQUEST *request, char const *fmt)
}
+/** xlat "load-balance" processing
+ *
+ * Processes xlat calls for modules defined in "load-balance"
+ * sub-sections of the instantiate configuration.
+ *
+ * @ingroup xlat_functions
+ */
static ssize_t xlat_load_balance(TALLOC_CTX *ctx, char **out, NDEBUG_UNUSED size_t outlen,
void const *mod_inst, UNUSED void const *xlat_inst,
REQUEST *request, char const *fmt)
"%{sub:oo un %{User-Name}}" == "funbar"
@endverbatim
*
- * @see #xlat_func_sub_regex
+ * @see xlat_func_sub_regex
*
* @ingroup xlat_functions
*/
/** Implements the Foreach-Variable-X
*
+ * @ingroup xlat_functions
*/
static ssize_t unlang_foreach_xlat(TALLOC_CTX *ctx, char **out, UNUSED size_t outlen,
void const *mod_inst, UNUSED void const *xlat_inst,
/** Get information about the interpreter state
*
+ * @ingroup xlat_functions
*/
static ssize_t unlang_interpret_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
/** Allow single attribute values to be retrieved from the cache
*
+ * @ingroup xlat_functions
*/
static ssize_t cache_xlat(TALLOC_CTX *ctx, char **out, UNUSED size_t freespace,
void const *mod_inst, UNUSED void const *xlat_inst,
*
* Arguments are @verbatim(<plaintext>...)@endverbatim
*
+@verbatim
+%{<inst>_encrypt:<plaintext>...}
+@endverbatim
+ *
* If multiple arguments are provided they will be concatenated.
+ *
+ * @ingroup xlat_functions
*/
static xlat_action_t cipher_rsa_encrypt_xlat(TALLOC_CTX *ctx, fr_cursor_t *out,
REQUEST *request, UNUSED void const *xlat_inst, void *xlat_thread_inst,
*
* Arguments are @verbatim(<plaintext>...)@endverbatim
*
+@verbatim
+%{<inst>_sign:<plaintext>...}
+@endverbatim
+ *
* If multiple arguments are provided they will be concatenated.
+ *
+ * @ingroup xlat_functions
*/
static xlat_action_t cipher_rsa_sign_xlat(TALLOC_CTX *ctx, fr_cursor_t *out,
REQUEST *request, void const *xlat_inst, void *xlat_thread_inst,
*
* Arguments are @verbatim(<ciphertext\>...)@endverbatim
*
+@verbatim
+%{<inst>_decrypt:<ciphertext>...}
+@endverbatim
+ *
* If multiple arguments are provided they will be concatenated.
+ *
+ * @ingroup xlat_functions
*/
static xlat_action_t cipher_rsa_decrypt_xlat(TALLOC_CTX *ctx, fr_cursor_t *out,
REQUEST *request, UNUSED void const *xlat_inst, void *xlat_thread_inst,
*
* Arguments are @verbatim(<signature>, <plaintext>...)@endverbatim
*
+@verbatim
+%{<inst>_verify:<signature> <plaintext>...}
+@endverbatim
+ *
* If multiple arguments are provided (after @verbatim<signature>@endverbatim)
* they will be concatenated.
+ *
+ * @ingroup xlat_functions
*/
static xlat_action_t cipher_rsa_verify_xlat(TALLOC_CTX *ctx, fr_cursor_t *out,
REQUEST *request, void const *xlat_inst, void *xlat_thread_inst,
return rcode;
}
-/*
- * Xlat for %{client:[<ipaddr>.]foo}
+/** xlat to get client config data
+ *
+ * Example:
+@verbatim
+%{client:[<ipaddr>.]foo}
+@endverbatim
+ *
+ * @ingroup xlat_functions
*/
static ssize_t xlat_client(TALLOC_CTX *ctx, char **out, UNUSED size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
}
DIAG_ON(format-nonliteral)
+/** Get or convert time and date
+ *
+ * Using the format in the module instance configuration, get
+ * various timestamps, or convert strings to date format.
+ *
+ * When the request arrived:
+@verbatim
+%{date:request}
+@endverbatim
+ *
+ * Now:
+@verbatim
+%{date:now}
+@endverbatim
+ *
+ * Examples (Tmp-Integer-0 = 1506101100):
+@verbatim
+update request {
+ &Tmp-String-0 := "%{date:&Tmp-Integer-0}" ("Fri 22 Sep 18:25:00 BST 2017")
+ &Tmp-Integer-1 := "%{date:&Tmp-String-0}" (1506101100)
+}
+@endverbatim
+ *
+ * @ingroup xlat_functions
+ */
static ssize_t xlat_date_convert(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
void const *mod_inst, UNUSED void const *xlat_inst,
REQUEST *request, char const *fmt)
if (!fr_cond_assert(unlang_xlat_event_timeout_delete(request, rctx) == 0)) return;
}
+/** Xlat to delay the request
+ *
+ * Example (delay 2 seconds):
+@verbatim
+"%{delay:2}"
+@endverbatim
+ *
+ * @ingroup xlat_functions
+ */
static xlat_action_t xlat_delay(TALLOC_CTX *ctx, UNUSED fr_cursor_t *out,
REQUEST *request, void const *xlat_inst, UNUSED void *xlat_thread_inst,
fr_value_box_t **in)
int nothing;
} rlm_dhcpv4_t;
+/** Decode DHCP option data
+ *
+ * Creates DHCP attributes based on the given binary option data
+ *
+ * Example:
+@verbatim
+%{dhcpv4_decode:%{Tmp-Octets-0}}
+@endverbatim
+ *
+ * @ingroup xlat_functions
+ */
static xlat_action_t dhcpv4_decode_xlat(TALLOC_CTX *ctx, fr_cursor_t *out,
REQUEST *request, UNUSED void const *xlat_inst, UNUSED void *xlat_thread_inst,
fr_value_box_t **in)
return XLAT_ACTION_DONE;
}
+/** Encode DHCP option data
+ *
+ * Returns octet string created from the provided DHCP attributes
+ *
+ * Example:
+@verbatim
+%{dhcpv4_encode:&request:[*]}
+@endverbatim
+ *
+ * @ingroup xlat_functions
+ */
static xlat_action_t dhcpv4_encode_xlat(TALLOC_CTX *ctx, fr_cursor_t *out,
REQUEST *request, UNUSED void const *xlat_inst, UNUSED void *xlat_thread_inst,
fr_value_box_t **in)
#include <freeradius-devel/server/module.h>
#include <freeradius-devel/server/rad_assert.h>
-/*
- * Xlat for %{attr_by_num:<number>}
+/** Xlat for %{attr_by_num:\<number\>}
+ *
+ * @ingroup xlat_functions
*/
static ssize_t xlat_dict_attr_by_num(TALLOC_CTX *ctx, char **out, UNUSED size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
return talloc_array_length(*out) - 1;
}
-/*
- * Xlat for %{attr_by_oid:<oid>}
+/** Xlat for %{attr_by_oid:\<oid\>}
+ *
+ * @ingroup xlat_functions
*/
static ssize_t xlat_dict_attr_by_oid(TALLOC_CTX *ctx, char **out, UNUSED size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
/** Return the vendor of an attribute reference
*
+ * @ingroup xlat_functions
*/
static ssize_t xlat_vendor(TALLOC_CTX *ctx, char **out, UNUSED size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
/** Return the vendor number of an attribute reference
*
+ * @ingroup xlat_functions
*/
static ssize_t xlat_vendor_num(TALLOC_CTX *ctx, char **out, UNUSED size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
/** Return the attribute name of an attribute reference
*
+ * @ingroup xlat_functions
*/
static ssize_t xlat_attr(TALLOC_CTX *ctx, char **out, size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
/** Return the attribute number of an attribute reference
*
+ * @ingroup xlat_functions
*/
static ssize_t xlat_attr_num(TALLOC_CTX *ctx, char **out, UNUSED size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
/** Equivalent to the old safe_characters functionality in rlm_sql but with utf8 support
*
- * @verbatim Example: "%{escape:<img>foo.jpg</img>}" == "=60img=62foo.jpg=60/img=62" @endverbatim
+ * Example:
+@verbatim
+"%{escape:<img>foo.jpg</img>}" == "=60img=62foo.jpg=60/img=62"
+@endverbatim
+ *
+ * @ingroup xlat_functions
*/
static ssize_t escape_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
void const *mod_inst, UNUSED void const *xlat_inst,
/** Equivalent to the old safe_characters functionality in rlm_sql
*
- * @verbatim Example: "%{unescape:=60img=62foo.jpg=60/img=62}" == "<img>foo.jpg</img>" @endverbatim
+ * Example:
+@verbatim
+"%{unescape:=60img=62foo.jpg=60/img=62}" == "<img>foo.jpg</img>"
+@endverbatim
+ *
+ * @ingroup xlat_functions
*/
static ssize_t unescape_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
return status;
}
-/*
- * Do xlat of strings.
+/** Exec programs from an xlat
+ *
+ * Example:
+@verbatim
+"%{exec:/bin/echo hello}" == "hello"
+@endverbatim
+ *
+ * @ingroup xlat_functions
*/
static ssize_t exec_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
void const *mod_inst, UNUSED void const *xlat_inst,
goto redo;
}
-/*
- * Do xlat of strings!
+/** Xlat expressions
+ *
+ * Example (NAS-Port = 1):
+@verbatim
+"%{expr:2 + 3 + &NAS-Port}" == 6
+@endverbatim
+ *
+ * @ingroup xlat_functions
*/
static ssize_t expr_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
CONF_PARSER_TERMINATOR
};
+/** Convert domain name to ASCII punycode
+ *
+@verbatim
+%{idn:<domain>}
+@endverbatim
+ *
+ * @ingroup xlat_functions
+ */
static ssize_t xlat_idna(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
void const *mod_inst, UNUSED void const *xlat_inst,
REQUEST *request, char const *fmt)
} rlm_json_jpath_to_eval_t;
/** Ensure contents are quoted correctly for a JSON document
+ *
+ * @ingroup xlat_functions
*
* @param ctx talloc context
* @param out Where to write the output
}
/** Determine if a jpath expression is valid
+ *
+ * @ingroup xlat_functions
*
* @param ctx to allocate expansion buffer in.
* @param mod_inst data.
*
* Usage is `%{json_encode:attr tmpl list}`
*
+ * @ingroup xlat_functions
+ *
* @param ctx talloc context
* @param out where to write the output
* @param request the current request
{ NULL }
};
+
+/** Escape LDAP string
+ *
+ * @ingroup xlat_functions
+ */
static ssize_t ldap_escape_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
REQUEST *request, char const *fmt)
return fr_ldap_escape_func(request, *out, outlen, fmt, NULL);
}
+/** Unescape LDAP string
+ *
+ * @ingroup xlat_functions
+ */
static ssize_t ldap_unescape_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
REQUEST *request, char const *fmt)
/** Expand an LDAP URL into a query, and return a string result from that query.
*
+ * @ingroup xlat_functions
*/
static ssize_t ldap_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
void const *mod_inst, UNUSED void const *xlat_inst,
struct berval **values;
- fr_ldap_connection_t *conn;
+ fr_ldap_connection_t *conn;
int ldap_errno;
char const *url;
}
-/*
- * Does dynamic translation of strings.
+/** Get data from MSCHAP attributes
+ *
+ * Pulls NT-Response, LM-Response, or Challenge from MSCHAP
+ * attributes.
*
- * Pulls NT-Response, LM-Response, or Challenge from MSCHAP
- * attributes.
+ * @ingroup xlat_functions
*/
static ssize_t mschap_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
void const *mod_inst, UNUSED void const *xlat_inst,
newXS("radiusd::xlat",XS_radiusd_xlat, "rlm_perl");
}
-/*
- * The xlat function
+/** Call perl code using an xlat
+ *
+ * @ingroup xlat_functions
*/
static ssize_t perl_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
void const *mod_inst, UNUSED void const *xlat_inst,
return 0;
}
+/** Force a redis cluster remap
+ *
+@verbatim
+%{redis_remap:<redis server ip>:<redis server port>}
+@endverbatim
+ *
+ * @ingroup xlat_functions
+ */
static xlat_action_t redis_remap_xlat(TALLOC_CTX *ctx, fr_cursor_t *out,
REQUEST *request, void const *xlat_inst,
UNUSED void *xlat_thread_inst,
/** Return the node that is currently servicing a particular key
*
- *
+ * @ingroup xlat_functions
*/
static xlat_action_t redis_node_xlat(TALLOC_CTX *ctx, fr_cursor_t *out,
REQUEST *request, void const *xlat_inst,
return XLAT_ACTION_DONE;
}
+
+/** Xlat to make calls to redis
+ *
+@verbatim
+%{redis:<redis command>}
+@endverbatim
+ *
+ * @ingroup xlat_functions
+ */
static ssize_t redis_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
void const *mod_inst, UNUSED void const *xlat_inst,
REQUEST *request, char const *fmt)
return xa;
}
-/*
- * Simple xlat to read text data from a URL
+/** Simple xlat to read text data from a URL
+ *
+ * Example:
+@verbatim
+%{rest:http://example.com/}
+@endverbatim
+ *
+ * @ingroup xlat_functions
*/
static xlat_action_t rest_xlat(TALLOC_CTX *ctx, UNUSED fr_cursor_t *out,
REQUEST *request, UNUSED void const *xlat_inst, void *xlat_thread_inst,
{ NULL }
};
-/*
+/** SoH xlat
+ *
* Not sure how to make this useful yet...
+ *
+ * @ingroup xlat_functions
*/
static ssize_t soh_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
/** Execute an arbitrary SQL query
*
- * For selects the first value of the first column will be returned,
- * for inserts, updates and deletes the number of rows affected will be
- * returned instead.
+ * For SELECTs, the first value of the first column will be returned.
+ * For INSERTS, UPDATEs and DELETEs, the number of rows affected will
+ * be returned instead.
+ *
+@verbatim
+%{sql:<sql statement>}
+@endverbatim
+ *
+ * @ingroup xlat_functions
*/
static ssize_t sql_xlat(UNUSED TALLOC_CTX *ctx, char **out, UNUSED size_t outlen,
void const *mod_inst, UNUSED void const *xlat_inst,
return 0;
}
+/** Perform a DNS lookup for an A record
+ *
+ * @ingroup xlat_functions
+ */
static ssize_t xlat_a(TALLOC_CTX *ctx, char **out, size_t outlen,
void const *mod_inst, UNUSED void const *xlat_inst,
REQUEST *request, char const *fmt)
return -1;
}
+/** Perform a DNS lookup for an AAAA record
+ *
+ * @ingroup xlat_functions
+ */
static ssize_t xlat_aaaa(TALLOC_CTX *ctx, char **out, size_t outlen,
void const *mod_inst, UNUSED void const *xlat_inst,
REQUEST *request, char const *fmt)
}
*/
+/** Perform a DNS lookup for a PTR record
+ *
+ * @ingroup xlat_functions
+ */
static ssize_t xlat_ptr(TALLOC_CTX *ctx, char **out, size_t outlen,
void const *mod_inst, UNUSED void const *xlat_inst,
REQUEST *request, char const *fmt)
/** Unpack data
*
- * Example: %{unpack:&Class 0 integer}
+ * Example:
+@verbatim
+%{unpack:&Class 0 integer}
+@endverbatim
+ * Expands Class, treating octet at offset 0 (bytes 0-3) as an "integer".
*
- * Expands Class, treating octet at offset 0 (bytes 0-3) as an "integer".
+ * @ingroup xlat_functions
*/
static ssize_t unpack_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
return i;
}
-/**
- * @brief Convert Yubikey modhex to standard hex
+/** Xlat to convert Yubikey modhex to standard hex
+ *
+ * Example:
+@verbatim
+"%{modhextohex:vvrbuctetdhc}" == "ffc1e0d3d260"
+@endverbatim
*
- * Example: "%{modhextohex:vvrbuctetdhc}" == "ffc1e0d3d260"
+ * @ingroup xlat_functions
*/
static ssize_t modhex_to_hex_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,