You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kamailio/modules_s/maxfwd
Victor Seva ce718dbc1f
Imported Upstream version 3.3.5
13 years ago
..
doc Imported Upstream version 3.3.5 13 years ago
Makefile Imported Upstream version 3.3.5 13 years ago
README Imported Upstream version 3.3.5 13 years ago
maxfwd.c Imported Upstream version 3.3.5 13 years ago
mf_funcs.c Imported Upstream version 3.3.5 13 years ago
mf_funcs.h Imported Upstream version 3.3.5 13 years ago

README

1. Maxfwd Module

Bogdan Iancu

   FhG FOKUS

   Copyright © 2003 FhG FOKUS
     __________________________________________________________________

   1.1. Overview
   1.2. Functions

        1.2.1. maxfwd_process(max_value)
        1.2.2. maxfwd_at_least(min_value)

1.1. Overview

   The module implements all the operations regarding MaX-Forward header
   field, like adding it (if not present) or decrementing and checking the
   value of the existent one.

1.2. Functions

1.2.1.  maxfwd_process(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.

   Example 1. maxfwd_process usage
# initial sanity checks -- messages with
# max_forwards==0, or excessively long requests
if (!maxfwd_process(10)) {
    sl_send_reply(483, "Too many hops");
    drop;
};

1.2.2.  maxfwd_at_least(min_value)

   Test is there is enough hops in Max-forward header, i.e. we know how
   many hops is required to reach target. Returns true if Max-Forward
   header is present in the received request and the value is greater than
   "min_value".

   Meaning of the parameters is as follows:
     * min_value - Min. number of required hops

   Example 2. maxfwd_at_least usage
if (!maxfwd_at_least(3)) {
    sl_send_reply(483, "Too many hops");
    drop;
};