$Revision: 1.1 $
$Date: 2005/11/17 12:28:12 $

# Functions

## `mf_process_maxfwd_header(max_value)`

If no Max-Forward header is present in the received request, a header will be added having the original value equal with "max_value". An OK code is returned by the function.

If a Max-Forward header is already present, its value will be decremented. If after this operation its value will be positive non-zero, an OK code will be returned. Otherwise (for a zero value) an error code will be returned. Note that an error code will be also returned if the SIP message couldn't be parsed or if the Max-Forward header's body invalid (non numerical string or negative numerical value).

Meaning of the parameters is as follows:

- max_value - Value to be added if there is no Max-Forwards header field in the message.

### `mx_process_maxfwd_header` usage

    ...
    # initial sanity checks -- messages with
    # max_forwards==0, or excessively long requests
    if (!mf_process_maxfwd_header("10")) {
        sl_send_reply("483","Too Many Hops");
        break;
    };
    ...