MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / tr_add_extra

Function tr_add_extra

transformations.c:90–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88};
89
90int 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
128int register_trans_mod(const char *mod_name, const trans_export_t *tr_exports)
129{

Callers 1

register_trans_modFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected