48 #ifndef CHAMELEON_MODULE
49 #ifdef CHAMELEON_CONF_MODULE
50 #define CHAMELEON_MODULE CHAMELEON_CONF_MODULE
52 #define CHAMELEON_MODULE chameleon_bitopt
56 extern const struct chameleon_module CHAMELEON_MODULE;
61 #define PRINTF(...) printf(__VA_ARGS__)
75 printbin(
int n,
int digits)
80 for(i = 0; i < digits; ++i) {
81 output[digits - i - 1] = (n & 1) +
'0';
90 printhdr(uint8_t *hdr,
int len)
95 for(i = 0; i < len; ++i) {
97 printf(
" (0x%0x), ", hdr[i]);
112 chameleon_parse(
void)
114 struct channel *c =
NULL;
115 PRINTF(
"%d.%d: chameleon_input\n",
120 c = CHAMELEON_MODULE.input();
122 PRINTF(
"%d.%d: chameleon_input channel %d\n",
125 packetbuf_set_attr(PACKETBUF_ATTR_CHANNEL, c->channelno);
127 PRINTF(
"%d.%d: chameleon_input channel not found for incoming packet\n",
134 chameleon_create(
struct channel *c)
138 PRINTF(
"%d.%d: chameleon_output channel %d\n",
142 ret = CHAMELEON_MODULE.output(c);
143 packetbuf_set_attr(PACKETBUF_ATTR_CHANNEL, c->channelno);
154 chameleon_hdrsize(
const struct packetbuf_attrlist attrlist[])
156 return CHAMELEON_MODULE.hdrsize(attrlist);