static void proto_flush_all(void *);
+static void
+proto_enqueue(list *l, struct proto *p)
+{
+ int pri = p->proto->priority;
+
+ if (!pri)
+ add_tail(l, &p->n);
+ else
+ {
+ struct proto *q = HEAD(*l);
+ while (q->n.next && q->proto->priority >= pri)
+ q = (struct proto *) q->n.next;
+ insert_node(&p->n, q->n.prev);
+ }
+}
+
static void
proto_relink(struct proto *p)
{
default:
l = &inactive_proto_list;
}
- add_tail(l, &p->n);
+ proto_enqueue(l, p);
}
void *
q = p->init(x);
q->proto_state = PS_DOWN;
q->core_state = FS_HUNGRY;
- add_tail(&initial_proto_list, &q->n);
+ proto_enqueue(&initial_proto_list, q);
}
debug("\n");
}
WALK_LIST(p, proto_list)
{
- debug(" protocol %s: state %s/%s\n", p->name, p_states[p->proto_state], c_states[p->core_state]);
+ debug(" protocol %s (pri=%d): state %s/%s\n", p->name, p->proto->priority,
+ p_states[p->proto_state], c_states[p->core_state]);
if (p->disabled)
debug("\tDISABLED\n");
else if (p->proto->dump)
node n;
char *name;
unsigned debug; /* Default debugging flags */
+ int priority; /* Protocol priority (usually 0) */
void (*preconfig)(struct protocol *, struct config *); /* Just before configuring */
void (*postconfig)(struct proto_config *); /* After configuring each instance */