MCPcopy Create free account
hub / github.com/F-Stack/f-stack / RuleAdd

Function RuleAdd

freebsd/netinet/libalias/alias_proxy.c:200–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200void
201RuleAdd(struct libalias *la, struct proxy_entry *entry)
202{
203 int rule_index;
204 struct proxy_entry *ptr;
205 struct proxy_entry *ptr_last;
206
207 LIBALIAS_LOCK_ASSERT(la);
208
209 entry->la = la;
210 if (la->proxyList == NULL) {
211 la->proxyList = entry;
212 entry->last = NULL;
213 entry->next = NULL;
214 return;
215 }
216
217 rule_index = entry->rule_index;
218 ptr = la->proxyList;
219 ptr_last = NULL;
220 while (ptr != NULL) {
221 if (ptr->rule_index >= rule_index) {
222 if (ptr_last == NULL) {
223 entry->next = la->proxyList;
224 entry->last = NULL;
225 la->proxyList->last = entry;
226 la->proxyList = entry;
227 return;
228 }
229 ptr_last->next = entry;
230 ptr->last = entry;
231 entry->last = ptr->last;
232 entry->next = ptr;
233 return;
234 }
235 ptr_last = ptr;
236 ptr = ptr->next;
237 }
238
239 ptr_last->next = entry;
240 entry->last = ptr_last;
241 entry->next = NULL;
242}
243
244static void
245RuleDelete(struct proxy_entry *entry)

Callers 1

LibAliasProxyRuleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected