| 88 | }; |
| 89 | |
| 90 | int tr_add_extra(const trans_export_t *e) |
| 91 | { |
| 92 | trans_extra_t *tr_extra; |
| 93 | int i; |
| 94 | |
| 95 | if(!e || !e->name.s || !e->parse_func || !e->eval_func) { |
| 96 | LM_ERR("invalid transformation export parameters\n"); |
| 97 | return -1; |
| 98 | } |
| 99 | |
| 100 | for (i = 0; core_trans[i].name.s; i++) |
| 101 | if (e->name.len == core_trans[i].name.len && |
| 102 | !memcmp(e->name.s, core_trans[i].name.s, e->name.len)) { |
| 103 | LM_ERR("transformation class <%.*s> already registered by core\n", |
| 104 | e->name.len, e->name.s); |
| 105 | return -1; |
| 106 | } |
| 107 | for (tr_extra = tr_extra_list; tr_extra; tr_extra = tr_extra->next) |
| 108 | if (e->name.len == tr_extra->tre.name.len && |
| 109 | !memcmp(e->name.s, tr_extra->tre.name.s, e->name.len)) { |
| 110 | LM_ERR("transformation class <%.*s> already registered\n", |
| 111 | e->name.len, e->name.s); |
| 112 | return -1; |
| 113 | } |
| 114 | |
| 115 | tr_extra = NULL; |
| 116 | tr_extra = pkg_malloc(sizeof *tr_extra); |
| 117 | if (!tr_extra) { |
| 118 | LM_ERR("No more pkg mem\n"); |
| 119 | return -1; |
| 120 | } |
| 121 | memcpy(&tr_extra->tre, e, sizeof(trans_export_t)); |
| 122 | tr_extra->next = tr_extra_list; |
| 123 | tr_extra_list = tr_extra; |
| 124 | |
| 125 | return 0; |
| 126 | } |
| 127 | |
| 128 | int register_trans_mod(const char *mod_name, const trans_export_t *tr_exports) |
| 129 | { |
no outgoing calls
no test coverage detected