avp(7)

NAME
avp - Manipulation of Attributes

DESCRIPTION
The avp module provides various functions for the manipulation of attributes.

The name is a left-over from earlier versions of SER where attributes were called ‘attribute-value pairs’ or AVPs for short.

FUNCTIONS

  append_attr_hf (hf, attribute)
Allowed in request and failure processing.

The \FCappend_attr_hf()\F[] function appends a new header field value to the header field named by the argument \FChf\F[]. The new value will be populated with the content of the attribute named by the argument \FCattribute\F[]. If the argument is missing, the content is taken from the attribute with same name as the header field.

  attr2uri (attribute, part)
Allowed in request and failure processing.

The \FCattr2uri()\F[] function sets the Request-URI to the content of the attribute named by the argument \FCattribute\F[]. If the argument \FCpart\F[] is present, only the part of the Request-URI identified by it will be changed. This mimiks the behavior of many of the core functions that allow manipulation of the Request-URI.

The following values are allowed for the \FCpart\F[] argument:

\FCdomain\F[], \FChost\F[]
    replace the host part of the Request-URI,

\FCdomainport\F[], \FChostport\F[]
    replace the host and port parts of the Request-URI,

\FCport\F[]
    replace the port part of the Request-URI,

\FCprefix\F[]
    prefix the content of the attribute to the username part of the Request-URI,

\FCstrip\F[]
    the attribute contains an integer specifying the number of characters to be stripped off the beginning of the username part of the Request-URI,

\FCstrip_tail\F[]
    the attribute contains an integer specifyin the number of characters to be stripped off the end of the username part of the Request-URI,

\FCuri\F[]
    replace the entire Request-URI,

\FCuser\F[], \FCusername\F[]
    replace the username part of the Request-URI,

\FCuserpass\F[], \FCusernamepassword\F[]
    replace the username and password parts of the Request-URI.

  attr_destination (attribute)
Allowed in request and failure processing.

The \FCattr_destination()\F[] function sets the destination URI to the content of the attribute named by the argument \FCattribute\F[].

If the destination URI is set, the request will be send to the address determined from that URI instead of the Request-URI. It will carried over into branches together with the Request-URI when a call to \FCappend_branch\F[]() is made.

  attr_equals (attribute, value)
Allowed in request, reply, and failure processing.

The \FCattr_equals()\F[] function checks whether the attribute identified by the argument \FCattribute\F[] exists and its value is identical the the value given by the argument \FCvalue\F[]. If so, it returns \FCtrue\F[] and \FCfalse\F[] otherwise.

  attr_equals_xl (attribute, value)
Allowed in request, reply, and failure processing.

The \FCattr_equals()\F[] function checks whether the attribute identified by the argument \FCattribute\F[] exists and its value is identical to the xl string given by the argument \FCvalue\F[]. If so, it returns \FCtrue\F[] and \FCfalse\F[] otherwise.

For more information on xl strings, see \FCxprint\F[](7).

  attr_exists (attribute)
Allowed in request, reply, and failure processing.

The \FCattr_exists()\F[] function checks whether an attribute by the name given by the name of \FCattribute\F[] exists and returns \FCtrue\F[] in this case or \FCfalse\F[] otherwise.

  attr_to_reply (hf, attribute)
Allowed in request and failure processing.

The \FCattr_to_reply()\F[] function adds a new header fields value to the final response that will eventually be sent upstream. The name of the header field is given by the argument \FChf\F[]. The content will be taken from an attribute. If the argument \FCattribute\F[] is present, it contains the name of the attribute. Otherwise, the header field name from the argument \FChf\F[] will be taken as the name.

  del_attr (attribute)
Allowed in request, reply, and failure processing.

The \FCdel_attr\F[] function deletes the attribute identified by the argument \FCattribute\F[].

  del_attrs (group)
Allowed in request, reply, and failure processing.

The \FCdel_attrs()\F[] function deletes all attributes from the group of attributes identified by the attribute prefix given through the argument \FCgroup\F[]. For example, to delete all attributes of the From user, call

\FC
        del_attrs("$fu");
      \F[]

  dump_attrs (group)
Allowed in request, reply, and failure processing.

The \FCdump_attrs()\F[] dumps a list of the existing attributes and their values to the system log. If the \FCgroup\F[] argument is present, it contains an attribute namespace prefix and limits the output to the attrbutes in that namespace.

  flags2attr (attribute)
Allowed in request, reply, and failure processing.

The \FCflags2attr()\F[] function stores the current state of all the flags in compact form in the attribute identified by the argument \FCattribute\F[].

  insert_attr_hf (hf, attribute)
Allowed in request and failure processing.

The \FCinsert_attr_hf()\F[] function inserts a header field value to the header field named by the argument \FChf\F[] with the value of the attribute identified by the argument \FCattribute\F[]. If there are already values for that header field, the new value will be prepended before any existing value.

If the optional argument \FCattribute\F[] is missing, the name of the attribute is taken from the name of the header field in argument \FChf\F[].

  print_attr (attribute)
Allowed in request, reply, and failure processing.

The \FCprint_attr()\F[] function prints the content of the attribute identified by the argument \FCattribute\F[] to the system log.

For a more flexible way of printing messages to the system log that allows to print extra information together with the attribute value, see the \FCxprint\F[](7) module.

  replace_attr_hf (hf, attribute)
Allowed in request and failure processing.

The \FCreplace_attr_hf()\F[] function removes all header field values of the header field named by the argument \FChf\F[] and adds a new header field value with the content of the attribute identified by the argument \FCattribute\F[]. If the argument \FCattribute\F[] is missing, the content of the new header field value will be taken from an argument with the same name as the header field.

  set_attr (attribute, value)
Allowed in request, reply, and failure processing.

The \FCset_attr()\F[] function is a synonym for the \FCset_sattr\F[]() function and sets the attribute identified by the argument \FCattribute\F[] to the string contained in the argument \FCvalue\F[].

Like \FCset_sattr\F[](), it is identical to assinging an string using the assignment operator and is deprecated.

  set_iattr (attribute, value)
Allowed in request, reply, and failure processing.

The \FCset_iattr()\F[] function sets the attribute identified by the argument \FCattribute\F[] to the integer value contained in the argument \FCvalue\F[]. If the attribute does not yet exist, it is created.

This function is identical to assinging an integer using the assignment operator and is only kept to retain compatibility with earlier versions of SER. It therefore is deprecated and may be removed in the future.

  set_sattr (attribute, value)
Allowed in request, reply, and failure processing.

The \FCset_sattr()\F[] function sets the attribute identified by the argument \FCattribute\F[] to the string contained in the argument \FCvalue\F[]. If the attribute does not yet exist, it is created.

This function is identical to assinging an string using the assignment operator and is only kept to retain compatibility with earlier versions of SER. It therefore is deprecated and may be removed in the future.

  subst_attr (attribute, subst)
Allowed in request, reply, and failure processing.

The \FCsubst_attr()\F[] function manipulates the content of the attribute identified by the argument \FCattribute\F[] using a subst expression.

A subst expression is identical to the expression used by the \FCsed\F[](1) program’s s command.

  xlfix_attr (attribute)
Allowed in request, reply, and failure processing.

The \FCxlfix_attr()\F[] function evaluates the xl string contained in the attributed identified by the argument \FCattribute\F[] and stores the result of the evaluation in the same attribute.

For more information on xl strings, see \FCxprint\F[](7).

  xlset_attr (attribute, value)
Allowed in request, reply, and failure processing.

The \FCxlset_attr()\F[] function sets the attribute identified by the argument \FCattribute\F[] to the evaluated xl string given by the argument \FCvalue\F[].

For more information on xl strings, see \FCxprint\F[](7).

  xlset_destination (value)
Allowed in request processing only.

The \FCxlset_destination()\F[] function sets the destination URI to the evaluated content of the xl string given by the argument \FCvalue\F[].

For details on xl strings, see \FCxprint\F[](7).

MODULE PARAMETERS

  xlbuf_size
Type: integer
Default: 256

The \FCxlbuf_size\F[] parameter defines the size of the buffer that used for evaluation of xl strings. The evaluated string cannot be larger than the size given by this parameter.

SEE ALSO
\FCser\F[](8), \FCser.cfg\F[](5), \FCavp_db\F[](7), \FCavp_radius\F[](7)