4 * userspace compatibility code for dummynet schedulers
17 #include <strings.h> /* bzero, ffs, ... */
18 #include <string.h> /* strcmp */
20 #include <sys/queue.h>
24 #define ND(fmt, args...) do {} while (0)
25 #define D1(fmt, args...) do {} while (0)
26 #define D(fmt, args...) fprintf(stderr, "%-8s " fmt "\n", \
27 __FUNCTION__, ## args)
28 #define DX(lev, fmt, args...) do { \
29 if (debug > lev) D(fmt, ## args); } while (0)
33 #define offsetof(t,m) (int)((&((t *)0L)->m))
38 /* prevent include of other system headers */
39 #define _NETINET_IP_VAR_H_ /* ip_fw_args */
53 int type, subtype, len, id;
57 int par[4]; /* flowset parameters */
59 /* simulation entries.
60 * 'index' is not strictly necessary
61 * y is used for the inverse mapping ,
64 int y; /* inverse mapping */
65 int base_y; /* inverse mapping */
66 int next_y; /* inverse mapping */
69 int next_flow; /* first_flow + n_flows */
71 * when generating, let 'cur' go from 0 to n_flows-1,
72 * then point to flow first_flow + cur
87 struct list_head h; /* used by the generator */
100 struct mbuf *m_nextpkt;
101 int flow_id; /* for testing, index of a flow */
102 //int flowset_id; /* for testing, index of a flowset */
103 void *cfg; /* config args */
106 #define MALLOC_DECLARE(x)
107 #define KASSERT(x, y) do { if (!(x)) printf y ; exit(0); } while (0)
108 struct ipfw_flow_id {
111 typedef void * module_t;
115 int (*f)(module_t, int, void *);
119 typedef struct _md_t moduledata_t;
121 #define DECLARE_MODULE(name, b, c, d) \
122 moduledata_t *_g_##name = & b
123 #define MODULE_DEPEND(a, b, c, d, e)
127 #include <ip_dn_private.h>
128 #include <dn_sched.h>
131 struct dn_fsk *fs; /* parent flowset. */
132 struct dn_sch_inst *_si; /* parent sched instance. */
138 struct dn_schk *sched;
141 struct dn_schk *sched;
146 void *enqueue, *dequeue;
147 int q_datalen, si_datalen, schk_datalen;
148 int (*config)(struct dn_schk *);
149 int (*new_sched)(struct dn_sch_inst *);
150 int (*new_fsk)(struct dn_fsk *);
151 int (*new_queue)(struct dn_queue *q);
161 mq_append(struct mq *q, struct mbuf *m)
166 q->tail->m_nextpkt = m;
175 #endif /* _DN_TEST_H */