Lines Matching full:channel
32 * - the special channel index 0 is used by the emulator and qemud only.
33 * other channel numbers correspond to clients. More specifically,
42 * internal unique channel number > 0, then sends a connection
43 * initiation request to the emulator (i.e. through channel 0):
48 * number corresponding to the channel number.
50 * * in case of success, the emulator responds through channel 0
59 * send the following through channel 0:
71 * * any command sent through channel 0 to the emulator that is
299 #define MAX_EVENTS (MAX_CHANNELS+1) /* each channel + the serial fd */
646 int channel;
668 p->channel = -1;
914 p->channel = -101; /* special debug value, not used */
975 * dummy packet with the new client socket in p->channel
987 p->channel = fd_accept(f->fd);
988 if (p->channel < 0) {
1007 * fd in the 'channel' field of a dummy packet.
1039 * 0 2 a 2-byte hex string for the channel number
1052 * extracts the payload size and channel index, then sends
1063 int in_channel; /* extracted channel number */
1084 * This will essentially parse the header, extract the channel number and
1122 //D("received %d bytes packet for channel %d", s->in_datalen, s->in_channel);
1139 D("ignoring %d bytes addressed to channel %d",
1143 inp->channel = s->in_channel;
1158 * this assumes that p->len and p->channel contain the payload's
1159 * size and channel and will add the appropriate header.
1166 //D("sending to serial %d bytes from channel %d: '%.*s'", p->len, p->channel, p->len, p->data);
1171 int2hex( p->channel, h->data + CHANNEL_OFFSET, CHANNEL_SIZE );
1229 int channel;
1245 static void multiplexer_close_channel( Multiplexer* mult, int channel );
1246 static void multiplexer_serial_send( Multiplexer* mult, int channel, Packet* p );
1265 c->channel = -1;
1289 multiplexer_serial_send(c->multiplexer, c->channel, p);
1293 if (c->channel > 0) {
1314 c->channel = multiplexer_open_channel(c->multiplexer, p);
1315 if (c->channel < 0) {
1319 D("%s: -> received channel id %d", __FUNCTION__, c->channel);
1334 if (c->channel > 0)
1335 multiplexer_close_channel(c->multiplexer, c->channel);
1351 D("%s: registration failed for client %d", __FUNCTION__, c->channel);
1355 D("%s: registration succeeded for client %d", __FUNCTION__, c->channel);
1367 c->channel = -1;
1395 c->channel = -1;
1417 /* find a client by its channel */
1419 multiplexer_find_client( Multiplexer* mult, int channel )
1424 if (c->channel == channel)
1438 int channel = hex2int(p->data+11, 2);
1439 Client* client = multiplexer_find_client(mult, channel);
1454 int channel = hex2int(p->data+11, 2);
1455 Client* client = multiplexer_find_client(mult, channel);
1465 int channel = hex2int(p->data+11, 2);
1466 Client* client = multiplexer_find_client(mult, channel);
1497 T("%s: channel=%d '%.*s'", __FUNCTION__, p->channel, p->len, p->data);
1499 if (p->channel == CHANNEL_CONTROL) {
1504 client = multiplexer_find_client(mult, p->channel);
1510 D("%s: discarding packet for unknown channel %d", __FUNCTION__, p->channel);
1523 multiplexer_serial_send( Multiplexer* mult, int channel, Packet* p )
1525 p->channel = channel;
1531 /* a function used by a client to allocate a new channel id and
1544 int len, channel;
1546 /* find a free channel number, assume we don't have many
1551 channel = (++mult->last_channel) & 0xff;
1554 if (c->channel == channel)
1558 len = snprintf((char*)p->data, sizeof p->data, "connect:%.*s:%02x", service->len, service->data, channel);
1564 p->channel = CHANNEL_CONTROL;
1568 return channel;
1571 /* used to tell the emulator a channel was closed by a client */
1573 multiplexer_close_channel( Multiplexer* mult, int channel )
1576 int len = snprintf((char*)p->data, sizeof(p->data), "disconnect:%02x", channel);
1583 p->channel = CHANNEL_CONTROL;
1596 * in p->channel. See fdhandler_accept_event() */
1597 int fd = p->channel;