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

Function flag_list_to_bitmask

flags.c:122–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122int flag_list_to_bitmask(const str_const *flags, enum flag_type type, char delim,
123 int init_new_flags)
124{
125 const char *p, *lim;
126 const char *crt_flag;
127 str_const name;
128 struct flag_entry *e;
129 int ret = 0;
130 int id;
131
132 if (flags->len < 0)
133 return 0;
134
135#ifdef EXTRA_DEBUG
136 LM_DBG("flag_list -> '%.*s'\n", flags->len, flags->s);
137#endif
138 lim = flags->s + flags->len;
139 crt_flag = flags->s;
140 for (p = flags->s; p <= lim; p++) {
141
142 if (p == lim || *p == delim) {
143
144 name.s = crt_flag;
145 name.len = p - crt_flag;
146 for (e = flag_lists[type]; e; e = e->next) {
147 if (e->name.len == p - crt_flag &&
148 str_strcmp(&e->name, &name) == 0) {
149
150 ret |= 1 << e->bit;
151 break;
152 }
153 }
154
155 if (init_new_flags && !e) {
156 id = get_flag_id_by_name(type, (char*)name.s, name.len);
157 if (id >= 0)
158 ret |= 1 << id;
159 }
160
161 crt_flag = p + 1;
162 }
163 }
164
165 return ret;
166}
167
168/**
169 * The function MUST be called only in the pre-forking phases of OpenSIPS

Callers 10

receive_ucontact_insertFunction · 0.85
receive_ucontact_updateFunction · 0.85
get_domain_db_ucontactsFunction · 0.85
cdb_pack_ping_dataFunction · 0.85
cdb_ctdict2infoFunction · 0.85
dbrow2infoFunction · 0.85
load_dialog_info_from_dbFunction · 0.85
sync_dlg_db_memFunction · 0.85
pv_set_dlg_flagsFunction · 0.85

Calls 1

get_flag_id_by_nameFunction · 0.85

Tested by

no test coverage detected