summaryrefslogtreecommitdiff
path: root/include/asterisk/max_forwards.h
blob: 3130b4b64dc100aafc8823603c26958ef47f565f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * Asterisk -- An open source telephony toolkit.
 *
 * Copyright (C) 2015, Digium, Inc.
 *
 * Mark Michelson <mmichelson@digium.com>
 *
 * See http://www.asterisk.org for more information about
 * the Asterisk project. Please do not directly contact
 * any of the maintainers of this project for assistance;
 * the project provides a web site, mailing lists and IRC
 * channels for your use.
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License Version 2. See the LICENSE file
 * at the top of the source tree.
 */

#ifndef MAX_FORWARDS_H

struct ast_channel;

/*!
 * \brief Set the starting max forwards for a particular channel.
 *
 * \pre chan is locked
 *
 * \param starting_count The value to set the max forwards to.
 * \param chan The channel on which to set the max forwards.
 * \retval 0 Success
 * \retval 1 Failure
 */
int ast_max_forwards_set(struct ast_channel *chan, int starting_count);

/*!
 * \brief Get the current max forwards for a particular channel.
 *
 * If the channel has not had max forwards set on it, then the channel
 * will have the default max forwards set on it and that value will
 * be returned.
 *
 * \pre chan is locked
 *
 * \param chan The channel to get the max forwards for.
 * \return The current max forwards count on the channel
 */
int ast_max_forwards_get(struct ast_channel *chan);

/*!
 * \brief Decrement the max forwards count for a particular channel.
 *
 * If the channel has not had max forwards set on it, then the channel
 * will have the default max forwards set on it and that value will
 * not be decremented.
 *
 * \pre chan is locked
 *
 * \chan The channel for which the max forwards value should be decremented
 * \retval 0 Success
 * \retval -1 Failure
 */
int ast_max_forwards_decrement(struct ast_channel *chan);

/*!
 * \brief Reset the max forwards on a channel to its starting value.
 *
 * If the channel has not had max forwards set on it, then the channel
 * will have the default max forwards set on it.
 *
 * \pre chan is locked.
 *
 * \param chan The channel on which to reset the max forwards count.
 * \retval 0 Success
 * \retval -1 Failure
 */
int ast_max_forwards_reset(struct ast_channel *chan);

#endif /* MAX_FORWARDS_H */