2 * $Id: dn_test.h 5626 2010-03-04 21:55:22Z luigi $
4 * userspace compatibility code for dummynet schedulers
12 #include <strings.h> /* bzero, ffs, ... */
13 #include <string.h> /* strcmp */
15 #include <sys/queue.h>
19 #define ND(fmt, args...) do {} while (0)
20 #define D1(fmt, args...) do {} while (0)
21 #define D(fmt, args...) fprintf(stderr, "%-8s " fmt "\n", \
22 __FUNCTION__, ## args)
23 #define DX(lev, fmt, args...) do { \
24 if (debug > lev) D(fmt, ## args); } while (0)
27 #define offsetof(t,m) (int)((&((t *)0L)->m))
31 /* prevent include of other system headers */
32 #define _NETINET_IP_VAR_H_ /* ip_fw_args */
46 int type, subtype, len, id;
49 int par[4]; /* flowset parameters */
51 /* simulation entries.
52 * 'index' is not strictly necessary
53 * y is used for the inverse mapping ,
56 int y; /* inverse mapping */
57 int base_y; /* inverse mapping */
58 int next_y; /* inverse mapping */
61 int next_flow; /* first_flow + n_flows */
63 * when generating, let 'cur' go from 0 to n_flows-1,
64 * then point to flow first_flow + cur
77 struct list_head h; /* used by the generator */
89 struct mbuf *m_nextpkt;
90 int flow_id; /* for testing, index of a flow */
91 //int flowset_id; /* for testing, index of a flowset */
92 void *cfg; /* config args */
95 #define MALLOC_DECLARE(x)
96 #define KASSERT(x, y) do { if (!(x)) printf y ; exit(0); } while (0)
100 typedef void * module_t;
103 int (*f)(module_t, int, void *);
106 typedef struct _md_t moduledata_t;
107 #define DECLARE_MODULE(name, b, c, d) \
108 moduledata_t *_g_##name = & b
109 #define MODULE_DEPEND(a, b, c, d, e)
113 #include <ip_dn_private.h>
114 #include <dn_sched.h>
117 struct dn_fsk *fs; /* parent flowset. */
118 struct dn_sch_inst *_si; /* parent sched instance. */
124 struct dn_schk *sched;
127 struct dn_schk *sched;
132 void *enqueue, *dequeue;
133 int q_datalen, si_datalen, schk_datalen;
134 int (*config)(struct dn_schk *);
135 int (*new_sched)(struct dn_sch_inst *);
136 int (*new_fsk)(struct dn_fsk *);
137 int (*new_queue)(struct dn_queue *q);
147 mq_append(struct mq *q, struct mbuf *m)
152 q->tail->m_nextpkt = m;
157 #endif /* _DN_TEST_H */