| 155 | } |
| 156 | |
| 157 | int run_transformations(struct sip_msg *msg, trans_t *tr, pv_value_t *val) |
| 158 | { |
| 159 | trans_t *it; |
| 160 | int ret = 0; |
| 161 | |
| 162 | if (tr==NULL || val==NULL) { |
| 163 | LM_DBG("null pointer\n"); |
| 164 | ret = -1; |
| 165 | goto out; |
| 166 | } |
| 167 | |
| 168 | it = tr; |
| 169 | while (it) { |
| 170 | ret = (*it->trf)(msg, it->params, it->subtype, val); |
| 171 | if(ret!=0) |
| 172 | goto out; |
| 173 | it = it->next; |
| 174 | } |
| 175 | |
| 176 | out: |
| 177 | /* advancing the current set of buffers avoids buffer overruns when passing |
| 178 | * multiple transformation-enabled vars as cfg function parameters */ |
| 179 | __crt_tr_bufs = (__crt_tr_bufs + 1) % (MAX_ACTION_ELEMS - 1); |
| 180 | |
| 181 | return ret; |
| 182 | } |
| 183 | |
| 184 | static void trans_fill_left(pv_value_t *val, str pad, int len, char *_tr_buffer) |
| 185 | { |