| 209 | } |
| 210 | |
| 211 | static inline int trace_xlog(struct sip_msg* msg, char* buf, int len) |
| 212 | { |
| 213 | struct modify_trace mod_p; |
| 214 | xl_trace_t xtrace_param; |
| 215 | str correlation_str; |
| 216 | union sockaddr_union su; |
| 217 | |
| 218 | if (msg == NULL || buf == NULL) { |
| 219 | LM_ERR("bad input!\n"); |
| 220 | return -1; |
| 221 | } |
| 222 | |
| 223 | /* xlog not traced; exit... */ |
| 224 | if (!check_is_traced || check_is_traced(xlog_proto_id) == 0) |
| 225 | return 0; |
| 226 | |
| 227 | mod_p.mod_f = add_xlog_data; |
| 228 | xtrace_param.msg = msg; |
| 229 | |
| 230 | xtrace_param.buf.s = buf; |
| 231 | xtrace_param.buf.len = len; |
| 232 | |
| 233 | mod_p.param = &xtrace_param; |
| 234 | |
| 235 | if (msg->callid && msg->callid->body.len) { |
| 236 | correlation_str = msg->callid->body; |
| 237 | } else { |
| 238 | correlation_str.s = "<null>"; |
| 239 | correlation_str.len = 6; |
| 240 | } |
| 241 | |
| 242 | if (msg->rcv.bind_address && msg->rcv.bind_address->port_no) |
| 243 | /* coverity[check_return] - CID #211391 */ |
| 244 | init_su( &su, &msg->rcv.bind_address->address, |
| 245 | msg->rcv.bind_address->port_no); |
| 246 | else |
| 247 | su.s.sa_family = 0; |
| 248 | |
| 249 | if (sip_context_trace(xlog_proto_id, |
| 250 | su.s.sa_family ? &su : NULL /*src*/, su.s.sa_family ? &su : NULL /*dst*/, |
| 251 | 0, IPPROTO_TCP, |
| 252 | &correlation_str, &mod_p) < 0) { |
| 253 | LM_ERR("failed to trace xlog message!\n"); |
| 254 | return -1; |
| 255 | } |
| 256 | |
| 257 | return 0; |
| 258 | } |
| 259 | |
| 260 | int xl_print_log(struct sip_msg* msg, pv_elem_p list, int *len) |
| 261 | { |
no test coverage detected