bignag change -- lot of things primarily added in relationship with
[sip-router] / modules / tm / test.c
1 #include "../../hash_func.h"
2 #include "t_funcs.h"
3 #include "../../dprint.h"
4 #include "../../config.h"
5 #include "../../parser/parser_f.h"
6 #include "../../ut.h"
7 #include "../../timer.h"
8
9 #include "t_hooks.h"
10
11 int _test_insert_to_reply( struct sip_msg *msg, char *str )
12 {
13     struct lump* anchor;
14     char *buf;
15     int len;
16
17     len=strlen( str );
18     buf=pkg_malloc( len );
19     if (!buf) {
20         LOG(L_ERR, "_test_insert_to_reply: no mem\n");
21         return 0;
22     }
23     memcpy( buf, str, len );
24
25     anchor = anchor_lump(&msg->add_rm,
26         msg->headers->name.s - msg->buf, 0 , 0);
27     if (anchor == NULL) {
28         LOG(L_ERR, "_test_insert_to_reply: anchor_lump failed\n");
29         return 0;
30     }
31     if (insert_new_lump_before(anchor,buf, len, 0)==0) {
32         LOG(L_ERR, "_test_insert_to_reply: inser_new_lump failed\n");
33         return 0;
34     }
35     return 1;
36 }
37