| 1 |
UID Gflags Module |
| 2 |
|
| 3 |
Jiri Kuthan |
| 4 |
|
| 5 |
<[email protected]> |
| 6 |
|
| 7 |
Copyright © 2004 FhG FOKUS |
| 8 |
__________________________________________________________________ |
| 9 |
|
| 10 |
Table of Contents |
| 11 |
|
| 12 |
1. Admin Guide |
| 13 |
|
| 14 |
1. Overview |
| 15 |
2. Parameters |
| 16 |
|
| 17 |
2.1. initial (integer) |
| 18 |
|
| 19 |
3. Functions |
| 20 |
|
| 21 |
3.1. set_gflag(flag_num) |
| 22 |
3.2. reset_ugflag(flag_num) |
| 23 |
3.3. is_ugflag(flag_num) |
| 24 |
|
| 25 |
4. FIFO Interface |
| 26 |
5. RPC Commands |
| 27 |
|
| 28 |
5.1. gflags.set |
| 29 |
5.2. gflags.reset |
| 30 |
5.3. gflags.is_set |
| 31 |
5.4. gflags.flush |
| 32 |
5.5. gflags.dump |
| 33 |
5.6. global.reload |
| 34 |
|
| 35 |
List of Examples |
| 36 |
|
| 37 |
1.1. set_ugflag usage |
| 38 |
1.2. reset_ugflag usage |
| 39 |
|
| 40 |
Chapter 1. Admin Guide |
| 41 |
|
| 42 |
Table of Contents |
| 43 |
|
| 44 |
1. Overview |
| 45 |
2. Parameters |
| 46 |
|
| 47 |
2.1. initial (integer) |
| 48 |
|
| 49 |
3. Functions |
| 50 |
|
| 51 |
3.1. set_gflag(flag_num) |
| 52 |
3.2. reset_ugflag(flag_num) |
| 53 |
3.3. is_ugflag(flag_num) |
| 54 |
|
| 55 |
4. FIFO Interface |
| 56 |
5. RPC Commands |
| 57 |
|
| 58 |
5.1. gflags.set |
| 59 |
5.2. gflags.reset |
| 60 |
5.3. gflags.is_set |
| 61 |
5.4. gflags.flush |
| 62 |
5.5. gflags.dump |
| 63 |
5.6. global.reload |
| 64 |
|
| 65 |
1. Overview |
| 66 |
|
| 67 |
The module implements global flags. The difference between the global |
| 68 |
flags and flags that can be used in the configuration file or AVPs is |
| 69 |
that they the scope of the global flags is not limited to the SIP |
| 70 |
message or transaction being processed. Global flags are always |
| 71 |
available, their contents is not forgotten when a SIP transaction gets |
| 72 |
destroyed in Kamailio. |
| 73 |
|
| 74 |
Global flags can be accessed from the configuration script, for |
| 75 |
example: |
| 76 |
if (is_ugflag("1")) { |
| 77 |
t_relay_to_udp("10.0.0.1", "5060"); |
| 78 |
} else { |
| 79 |
t_relay_to_udp("10.0.0.2", "5060"); |
| 80 |
}; |
| 81 |
|
| 82 |
The value of the global flags can be manipulated by external tools such |
| 83 |
as the web interface of Kamailio or cmd line administration tools. One |
| 84 |
particular application of global flags could be runtime configuration |
| 85 |
changes without the need to restart Kamailio. |
| 86 |
|
| 87 |
2. Parameters |
| 88 |
|
| 89 |
2.1. initial (integer) |
| 90 |
|
| 91 |
2.1. initial (integer) |
| 92 |
|
| 93 |
The initial value of global flags. Each bit in the integer represents |
| 94 |
one flag. |
| 95 |
|
| 96 |
Default value is 0. |
| 97 |
|
| 98 |
3. Functions |
| 99 |
|
| 100 |
3.1. set_gflag(flag_num) |
| 101 |
3.2. reset_ugflag(flag_num) |
| 102 |
3.3. is_ugflag(flag_num) |
| 103 |
|
| 104 |
3.1. set_gflag(flag_num) |
| 105 |
|
| 106 |
Set the flag identified by flag_num to 1. The range of flag_num is 0 to |
| 107 |
31. |
| 108 |
|
| 109 |
Example 1.1. set_ugflag usage |
| 110 |
... |
| 111 |
set_ugflag("2"); |
| 112 |
... |
| 113 |
|
| 114 |
3.2. reset_ugflag(flag_num) |
| 115 |
|
| 116 |
Set the flag identified by flag_num to 0. The range of flag_num is 0 to |
| 117 |
31. |
| 118 |
|
| 119 |
Example 1.2. reset_ugflag usage |
| 120 |
... |
| 121 |
reset_ugflag("2"); |
| 122 |
... |
| 123 |
|
| 124 |
3.3. is_ugflag(flag_num) |
| 125 |
|
| 126 |
Returns 1 when flag identified by flag_num is set, 0 otherwise. The |
| 127 |
range of flag_num parameter is 0 to 31. |
| 128 |
|
| 129 |
4. FIFO Interface |
| 130 |
|
| 131 |
The state of the global flags can be read and modified over the FIFO |
| 132 |
interface of Kamailio. This module implements the following FIFO |
| 133 |
interface functions: |
| 134 |
* set_gflag - Set the value of a flag to 1. The function accepts one |
| 135 |
parameter which is the number of the flag to be set. |
| 136 |
* reset_gflag - Reset the value of a flag to 0. The function accepts |
| 137 |
one parameter which is the number of the flag to be reset. |
| 138 |
* is_gflag - Return the status of a flag. The FIFO function would |
| 139 |
return TRUE if the flag is set and FALSE if it is not set. The only |
| 140 |
parameter of this function is the number of the flag. |
| 141 |
|
| 142 |
5. RPC Commands |
| 143 |
|
| 144 |
5.1. gflags.set |
| 145 |
5.2. gflags.reset |
| 146 |
5.3. gflags.is_set |
| 147 |
5.4. gflags.flush |
| 148 |
5.5. gflags.dump |
| 149 |
5.6. global.reload |
| 150 |
|
| 151 |
The state of the global flags can be read and modified over the RPC |
| 152 |
interface. This module implements the following RPC interface commands: |
| 153 |
|
| 154 |
5.1. gflags.set |
| 155 |
|
| 156 |
gflags.set - Set the value of a flag to 1. The function accepts one |
| 157 |
parameter which is the number of the flag to be set. |
| 158 |
|
| 159 |
5.2. gflags.reset |
| 160 |
|
| 161 |
gflags.reset - Reset the value of a flag to 0. The function accepts one |
| 162 |
parameter which is the number of the flag to be reset. |
| 163 |
|
| 164 |
5.3. gflags.is_set |
| 165 |
|
| 166 |
gflags.is_set - Return the status of a flag. The FIFO function would |
| 167 |
return TRUE if the flag is set and FALSE if it is not set. The only |
| 168 |
parameter of this function is the number of the flag. |
| 169 |
|
| 170 |
5.4. gflags.flush |
| 171 |
|
| 172 |
gflags.flush - Flush the state of global flags into database. |
| 173 |
|
| 174 |
5.5. gflags.dump |
| 175 |
|
| 176 |
gflags.dump - Return the status of all flags. The value is TRUE if the |
| 177 |
flag is set and FALSE if the flag is not set. The function has no |
| 178 |
parameters. |
| 179 |
|
| 180 |
5.6. global.reload |
| 181 |
|
| 182 |
global.reload - Reload values from global_attrs DB table. This function |
| 183 |
does not have any parameters. There is no return value on success. |