aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/cadet_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-21 17:51:51 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-21 17:51:51 +0100
commit308518cb6fbc4b635fccd87a770f66cc2e2816f3 (patch)
tree298ce9cf97c35e1447d119c270ceaa13d394275d /src/cadet/cadet_api.c
parent745cf54e655a9fb40a4ba3643de09a3471ca6ef6 (diff)
downloadgnunet-308518cb6fbc4b635fccd87a770f66cc2e2816f3.tar.gz
gnunet-308518cb6fbc4b635fccd87a770f66cc2e2816f3.zip
some renaming, some code general code cleanup, some logging
Diffstat (limited to 'src/cadet/cadet_api.c')
-rw-r--r--src/cadet/cadet_api.c109
1 files changed, 55 insertions, 54 deletions
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index 494aab612..83ff2b3b7 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -169,7 +169,7 @@ struct GNUNET_CADET_Handle
169 /** 169 /**
170 * child of the next channel to create (to avoid reusing IDs often) 170 * child of the next channel to create (to avoid reusing IDs often)
171 */ 171 */
172 struct GNUNET_CADET_ClientChannelNumber next_chid; 172 struct GNUNET_CADET_ClientChannelNumber next_ccn;
173 173
174 /** 174 /**
175 * Configuration given by the client, in case of reconnection 175 * Configuration given by the client, in case of reconnection
@@ -238,7 +238,7 @@ struct GNUNET_CADET_Channel
238 /** 238 /**
239 * Local ID of the channel 239 * Local ID of the channel
240 */ 240 */
241 struct GNUNET_CADET_ClientChannelNumber chid; 241 struct GNUNET_CADET_ClientChannelNumber ccn;
242 242
243 /** 243 /**
244 * Channel's port, if any. 244 * Channel's port, if any.
@@ -361,17 +361,17 @@ find_port (const struct GNUNET_CADET_Handle *h,
361 * Get the channel handler for the channel specified by id from the given handle 361 * Get the channel handler for the channel specified by id from the given handle
362 * 362 *
363 * @param h Cadet handle 363 * @param h Cadet handle
364 * @param chid ID of the wanted channel 364 * @param ccn ID of the wanted channel
365 * @return handle to the required channel or NULL if not found 365 * @return handle to the required channel or NULL if not found
366 */ 366 */
367static struct GNUNET_CADET_Channel * 367static struct GNUNET_CADET_Channel *
368retrieve_channel (struct GNUNET_CADET_Handle *h, 368retrieve_channel (struct GNUNET_CADET_Handle *h,
369 struct GNUNET_CADET_ClientChannelNumber chid) 369 struct GNUNET_CADET_ClientChannelNumber ccn)
370{ 370{
371 struct GNUNET_CADET_Channel *ch; 371 struct GNUNET_CADET_Channel *ch;
372 372
373 for (ch = h->channels_head; NULL != ch; ch = ch->next) 373 for (ch = h->channels_head; NULL != ch; ch = ch->next)
374 if (ch->chid.channel_of_client == chid.channel_of_client) 374 if (ch->ccn.channel_of_client == ccn.channel_of_client)
375 return ch; 375 return ch;
376 return NULL; 376 return NULL;
377} 377}
@@ -381,13 +381,13 @@ retrieve_channel (struct GNUNET_CADET_Handle *h,
381 * Create a new channel and insert it in the channel list of the cadet handle 381 * Create a new channel and insert it in the channel list of the cadet handle
382 * 382 *
383 * @param h Cadet handle 383 * @param h Cadet handle
384 * @param chid Desired chid of the channel, 0 to assign one automatically. 384 * @param ccn Desired ccn of the channel, 0 to assign one automatically.
385 * 385 *
386 * @return Handle to the created channel. 386 * @return Handle to the created channel.
387 */ 387 */
388static struct GNUNET_CADET_Channel * 388static struct GNUNET_CADET_Channel *
389create_channel (struct GNUNET_CADET_Handle *h, 389create_channel (struct GNUNET_CADET_Handle *h,
390 struct GNUNET_CADET_ClientChannelNumber chid) 390 struct GNUNET_CADET_ClientChannelNumber ccn)
391{ 391{
392 struct GNUNET_CADET_Channel *ch; 392 struct GNUNET_CADET_Channel *ch;
393 393
@@ -396,22 +396,22 @@ create_channel (struct GNUNET_CADET_Handle *h,
396 h->channels_tail, 396 h->channels_tail,
397 ch); 397 ch);
398 ch->cadet = h; 398 ch->cadet = h;
399 if (0 == chid.channel_of_client) 399 if (0 == ccn.channel_of_client)
400 { 400 {
401 ch->chid = h->next_chid; 401 ch->ccn = h->next_ccn;
402 while (NULL != retrieve_channel (h, 402 while (NULL != retrieve_channel (h,
403 h->next_chid)) 403 h->next_ccn))
404 { 404 {
405 h->next_chid.channel_of_client 405 h->next_ccn.channel_of_client
406 = htonl (1 + ntohl (h->next_chid.channel_of_client)); 406 = htonl (1 + ntohl (h->next_ccn.channel_of_client));
407 if (0 == ntohl (h->next_chid.channel_of_client)) 407 if (0 == ntohl (h->next_ccn.channel_of_client))
408 h->next_chid.channel_of_client 408 h->next_ccn.channel_of_client
409 = htonl (GNUNET_CADET_LOCAL_CHANNEL_ID_CLI); 409 = htonl (GNUNET_CADET_LOCAL_CHANNEL_ID_CLI);
410 } 410 }
411 } 411 }
412 else 412 else
413 { 413 {
414 ch->chid = chid; 414 ch->ccn = ccn;
415 } 415 }
416 ch->allow_send = GNUNET_NO; 416 ch->allow_send = GNUNET_NO;
417 return ch; 417 return ch;
@@ -438,7 +438,7 @@ destroy_channel (struct GNUNET_CADET_Channel *ch, int call_cleaner)
438 struct GNUNET_CADET_TransmitHandle *th; 438 struct GNUNET_CADET_TransmitHandle *th;
439 struct GNUNET_CADET_TransmitHandle *next; 439 struct GNUNET_CADET_TransmitHandle *next;
440 440
441 LOG (GNUNET_ERROR_TYPE_DEBUG, " destroy_channel %X\n", ch->chid); 441 LOG (GNUNET_ERROR_TYPE_DEBUG, " destroy_channel %X\n", ch->ccn);
442 442
443 if (NULL == ch) 443 if (NULL == ch)
444 { 444 {
@@ -530,8 +530,8 @@ send_ack (struct GNUNET_CADET_Channel *ch)
530 530
531 LOG (GNUNET_ERROR_TYPE_DEBUG, 531 LOG (GNUNET_ERROR_TYPE_DEBUG,
532 "Sending ACK on channel %X\n", 532 "Sending ACK on channel %X\n",
533 ch->chid.channel_of_client); 533 ch->ccn.channel_of_client);
534 msg->channel_id = ch->chid; 534 msg->ccn = ch->ccn;
535 GNUNET_MQ_send (ch->cadet->mq, 535 GNUNET_MQ_send (ch->cadet->mq,
536 env); 536 env);
537} 537}
@@ -569,7 +569,7 @@ request_data (void *cls)
569 env = GNUNET_MQ_msg_extra (msg, 569 env = GNUNET_MQ_msg_extra (msg,
570 th->size, 570 th->size,
571 GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA); 571 GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA);
572 msg->channel_id = th->channel->chid; 572 msg->ccn = th->channel->ccn;
573 osize = th->notify (th->notify_cls, 573 osize = th->notify (th->notify_cls,
574 th->size, 574 th->size,
575 &msg[1]); 575 &msg[1]);
@@ -594,15 +594,15 @@ handle_channel_created (void *cls,
594 struct GNUNET_CADET_Channel *ch; 594 struct GNUNET_CADET_Channel *ch;
595 struct GNUNET_CADET_Port *port; 595 struct GNUNET_CADET_Port *port;
596 const struct GNUNET_HashCode *port_number; 596 const struct GNUNET_HashCode *port_number;
597 struct GNUNET_CADET_ClientChannelNumber chid; 597 struct GNUNET_CADET_ClientChannelNumber ccn;
598 598
599 chid = msg->channel_id; 599 ccn = msg->ccn;
600 port_number = &msg->port; 600 port_number = &msg->port;
601 LOG (GNUNET_ERROR_TYPE_DEBUG, 601 LOG (GNUNET_ERROR_TYPE_DEBUG,
602 "Creating incoming channel %X [%s]\n", 602 "Creating incoming channel %X [%s]\n",
603 ntohl (chid.channel_of_client), 603 ntohl (ccn.channel_of_client),
604 GNUNET_h2s (port_number)); 604 GNUNET_h2s (port_number));
605 if (ntohl (chid.channel_of_client) >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) 605 if (ntohl (ccn.channel_of_client) >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI)
606 { 606 {
607 GNUNET_break (0); 607 GNUNET_break (0);
608 return; 608 return;
@@ -612,11 +612,11 @@ handle_channel_created (void *cls,
612 { 612 {
613 void *ctx; 613 void *ctx;
614 614
615 ch = create_channel (h, chid); 615 ch = create_channel (h, ccn);
616 ch->allow_send = GNUNET_NO; 616 ch->allow_send = GNUNET_NO;
617 ch->peer = GNUNET_PEER_intern (&msg->peer); 617 ch->peer = GNUNET_PEER_intern (&msg->peer);
618 ch->cadet = h; 618 ch->cadet = h;
619 ch->chid = chid; 619 ch->ccn = ccn;
620 ch->port = port; 620 ch->port = port;
621 ch->options = ntohl (msg->opt); 621 ch->options = ntohl (msg->opt);
622 622
@@ -634,7 +634,7 @@ handle_channel_created (void *cls,
634 LOG (GNUNET_ERROR_TYPE_DEBUG, "No handler for incoming channels\n"); 634 LOG (GNUNET_ERROR_TYPE_DEBUG, "No handler for incoming channels\n");
635 env = GNUNET_MQ_msg (d_msg, 635 env = GNUNET_MQ_msg (d_msg,
636 GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY); 636 GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY);
637 d_msg->channel_id = msg->channel_id; 637 d_msg->ccn = msg->ccn;
638 GNUNET_MQ_send (h->mq, env); 638 GNUNET_MQ_send (h->mq, env);
639 } 639 }
640 return; 640 return;
@@ -653,20 +653,20 @@ handle_channel_destroy (void *cls,
653{ 653{
654 struct GNUNET_CADET_Handle *h = cls; 654 struct GNUNET_CADET_Handle *h = cls;
655 struct GNUNET_CADET_Channel *ch; 655 struct GNUNET_CADET_Channel *ch;
656 struct GNUNET_CADET_ClientChannelNumber chid; 656 struct GNUNET_CADET_ClientChannelNumber ccn;
657 657
658 chid = msg->channel_id; 658 ccn = msg->ccn;
659 LOG (GNUNET_ERROR_TYPE_DEBUG, 659 LOG (GNUNET_ERROR_TYPE_DEBUG,
660 "Channel %X Destroy from service\n", 660 "Channel %X Destroy from service\n",
661 ntohl (chid.channel_of_client)); 661 ntohl (ccn.channel_of_client));
662 ch = retrieve_channel (h, 662 ch = retrieve_channel (h,
663 chid); 663 ccn);
664 664
665 if (NULL == ch) 665 if (NULL == ch)
666 { 666 {
667 LOG (GNUNET_ERROR_TYPE_DEBUG, 667 LOG (GNUNET_ERROR_TYPE_DEBUG,
668 "channel %X unknown\n", 668 "channel %X unknown\n",
669 ntohl (chid.channel_of_client)); 669 ntohl (ccn.channel_of_client));
670 return; 670 return;
671 } 671 }
672 destroy_channel (ch, 672 destroy_channel (ch,
@@ -698,7 +698,7 @@ check_local_data (void *cls,
698 } 698 }
699 699
700 ch = retrieve_channel (h, 700 ch = retrieve_channel (h,
701 message->channel_id); 701 message->ccn);
702 if (NULL == ch) 702 if (NULL == ch)
703 { 703 {
704 GNUNET_break_op (0); 704 GNUNET_break_op (0);
@@ -728,15 +728,16 @@ handle_local_data (void *cls,
728 728
729 LOG (GNUNET_ERROR_TYPE_DEBUG, 729 LOG (GNUNET_ERROR_TYPE_DEBUG,
730 "Got a data message!\n"); 730 "Got a data message!\n");
731 ch = retrieve_channel (h, message->channel_id); 731 ch = retrieve_channel (h,
732 message->ccn);
732 GNUNET_assert (NULL != ch); 733 GNUNET_assert (NULL != ch);
733 734
734 payload = (struct GNUNET_MessageHeader *) &message[1]; 735 payload = (struct GNUNET_MessageHeader *) &message[1];
735 LOG (GNUNET_ERROR_TYPE_DEBUG, " %s data on channel %s [%X]\n", 736 LOG (GNUNET_ERROR_TYPE_DEBUG, " %s data on channel %s [%X]\n",
736 GC_f2s (ntohl (ch->chid.channel_of_client) >= 737 GC_f2s (ntohl (ch->ccn.channel_of_client) >=
737 GNUNET_CADET_LOCAL_CHANNEL_ID_CLI), 738 GNUNET_CADET_LOCAL_CHANNEL_ID_CLI),
738 GNUNET_i2s (GNUNET_PEER_resolve2 (ch->peer)), 739 GNUNET_i2s (GNUNET_PEER_resolve2 (ch->peer)),
739 ntohl (message->channel_id.channel_of_client)); 740 ntohl (message->ccn.channel_of_client));
740 741
741 type = ntohs (payload->type); 742 type = ntohs (payload->type);
742 LOG (GNUNET_ERROR_TYPE_DEBUG, " payload type %s\n", GC_m2s (type)); 743 LOG (GNUNET_ERROR_TYPE_DEBUG, " payload type %s\n", GC_m2s (type));
@@ -778,21 +779,21 @@ handle_local_ack (void *cls,
778{ 779{
779 struct GNUNET_CADET_Handle *h = cls; 780 struct GNUNET_CADET_Handle *h = cls;
780 struct GNUNET_CADET_Channel *ch; 781 struct GNUNET_CADET_Channel *ch;
781 struct GNUNET_CADET_ClientChannelNumber chid; 782 struct GNUNET_CADET_ClientChannelNumber ccn;
782 783
783 LOG (GNUNET_ERROR_TYPE_DEBUG, "Got an ACK!\n"); 784 LOG (GNUNET_ERROR_TYPE_DEBUG, "Got an ACK!\n");
784 chid = message->channel_id; 785 ccn = message->ccn;
785 ch = retrieve_channel (h, chid); 786 ch = retrieve_channel (h, ccn);
786 if (NULL == ch) 787 if (NULL == ch)
787 { 788 {
788 LOG (GNUNET_ERROR_TYPE_DEBUG, 789 LOG (GNUNET_ERROR_TYPE_DEBUG,
789 "ACK on unknown channel %X\n", 790 "ACK on unknown channel %X\n",
790 ntohl (chid.channel_of_client)); 791 ntohl (ccn.channel_of_client));
791 return; 792 return;
792 } 793 }
793 LOG (GNUNET_ERROR_TYPE_DEBUG, 794 LOG (GNUNET_ERROR_TYPE_DEBUG,
794 " on channel %X!\n", 795 " on channel %X!\n",
795 ntohl (ch->chid.channel_of_client)); 796 ntohl (ch->ccn.channel_of_client));
796 ch->allow_send = GNUNET_YES; 797 ch->allow_send = GNUNET_YES;
797 if (0 < ch->packet_size) 798 if (0 < ch->packet_size)
798 { 799 {
@@ -1406,7 +1407,7 @@ GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
1406 } 1407 }
1407 h->cls = cls; 1408 h->cls = cls;
1408 h->message_handlers = handlers; 1409 h->message_handlers = handlers;
1409 h->next_chid.channel_of_client = htonl (GNUNET_CADET_LOCAL_CHANNEL_ID_CLI); 1410 h->next_ccn.channel_of_client = htonl (GNUNET_CADET_LOCAL_CHANNEL_ID_CLI);
1410 h->reconnect_time = GNUNET_TIME_UNIT_MILLISECONDS; 1411 h->reconnect_time = GNUNET_TIME_UNIT_MILLISECONDS;
1411 h->reconnect_task = NULL; 1412 h->reconnect_task = NULL;
1412 1413
@@ -1432,12 +1433,12 @@ GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle)
1432 while (NULL != ch) 1433 while (NULL != ch)
1433 { 1434 {
1434 aux = ch->next; 1435 aux = ch->next;
1435 if (ntohl (ch->chid.channel_of_client) >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) 1436 if (ntohl (ch->ccn.channel_of_client) >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI)
1436 { 1437 {
1437 GNUNET_break (0); 1438 GNUNET_break (0);
1438 LOG (GNUNET_ERROR_TYPE_DEBUG, 1439 LOG (GNUNET_ERROR_TYPE_DEBUG,
1439 "channel %X not destroyed\n", 1440 "channel %X not destroyed\n",
1440 ntohl (ch->chid.channel_of_client)); 1441 ntohl (ch->ccn.channel_of_client));
1441 } 1442 }
1442 destroy_channel (ch, 1443 destroy_channel (ch,
1443 GNUNET_YES); 1444 GNUNET_YES);
@@ -1566,7 +1567,6 @@ GNUNET_CADET_close_port (struct GNUNET_CADET_Port *p)
1566 * @param peer peer identity the channel should go to 1567 * @param peer peer identity the channel should go to
1567 * @param port Port hash (port number). 1568 * @param port Port hash (port number).
1568 * @param options CadetOption flag field, with all desired option bits set to 1. 1569 * @param options CadetOption flag field, with all desired option bits set to 1.
1569 *
1570 * @return handle to the channel 1570 * @return handle to the channel
1571 */ 1571 */
1572struct GNUNET_CADET_Channel * 1572struct GNUNET_CADET_Channel *
@@ -1579,21 +1579,21 @@ GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle *h,
1579 struct GNUNET_CADET_LocalChannelCreateMessage *msg; 1579 struct GNUNET_CADET_LocalChannelCreateMessage *msg;
1580 struct GNUNET_MQ_Envelope *env; 1580 struct GNUNET_MQ_Envelope *env;
1581 struct GNUNET_CADET_Channel *ch; 1581 struct GNUNET_CADET_Channel *ch;
1582 struct GNUNET_CADET_ClientChannelNumber chid; 1582 struct GNUNET_CADET_ClientChannelNumber ccn;
1583 1583
1584 LOG (GNUNET_ERROR_TYPE_DEBUG, 1584 LOG (GNUNET_ERROR_TYPE_DEBUG,
1585 "Creating new channel to %s:%u\n", 1585 "Creating new channel to %s:%u\n",
1586 GNUNET_i2s (peer), port); 1586 GNUNET_i2s (peer), port);
1587 chid.channel_of_client = htonl (0); 1587 ccn.channel_of_client = htonl (0);
1588 ch = create_channel (h, chid); 1588 ch = create_channel (h, ccn);
1589 LOG (GNUNET_ERROR_TYPE_DEBUG, " at %p\n", ch); 1589 LOG (GNUNET_ERROR_TYPE_DEBUG, " at %p\n", ch);
1590 LOG (GNUNET_ERROR_TYPE_DEBUG, " number %X\n", 1590 LOG (GNUNET_ERROR_TYPE_DEBUG, " number %X\n",
1591 ntohl (ch->chid.channel_of_client)); 1591 ntohl (ch->ccn.channel_of_client));
1592 ch->ctx = channel_ctx; 1592 ch->ctx = channel_ctx;
1593 ch->peer = GNUNET_PEER_intern (peer); 1593 ch->peer = GNUNET_PEER_intern (peer);
1594 1594
1595 env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE); 1595 env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE);
1596 msg->channel_id = ch->chid; 1596 msg->ccn = ch->ccn;
1597 msg->port = *port; 1597 msg->port = *port;
1598 msg->peer = *peer; 1598 msg->peer = *peer;
1599 msg->opt = htonl (options); 1599 msg->opt = htonl (options);
@@ -1639,8 +1639,9 @@ GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel *channel)
1639 1639
1640 env = GNUNET_MQ_msg (msg, 1640 env = GNUNET_MQ_msg (msg,
1641 GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY); 1641 GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY);
1642 msg->channel_id = channel->chid; 1642 msg->ccn = channel->ccn;
1643 GNUNET_MQ_send (h->mq, env); 1643 GNUNET_MQ_send (h->mq,
1644 env);
1644 1645
1645 destroy_channel (channel, GNUNET_YES); 1646 destroy_channel (channel, GNUNET_YES);
1646} 1647}
@@ -1698,9 +1699,9 @@ GNUNET_CADET_notify_transmit_ready (struct GNUNET_CADET_Channel *channel,
1698 GNUNET_assert (NULL != channel); 1699 GNUNET_assert (NULL != channel);
1699 GNUNET_assert (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE >= notify_size); 1700 GNUNET_assert (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE >= notify_size);
1700 LOG (GNUNET_ERROR_TYPE_DEBUG, "CADET NOTIFY TRANSMIT READY\n"); 1701 LOG (GNUNET_ERROR_TYPE_DEBUG, "CADET NOTIFY TRANSMIT READY\n");
1701 LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", channel->chid); 1702 LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", channel->ccn);
1702 LOG (GNUNET_ERROR_TYPE_DEBUG, " allow_send %d\n", channel->allow_send); 1703 LOG (GNUNET_ERROR_TYPE_DEBUG, " allow_send %d\n", channel->allow_send);
1703 if (ntohl (channel->chid.channel_of_client) >= 1704 if (ntohl (channel->ccn.channel_of_client) >=
1704 GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) 1705 GNUNET_CADET_LOCAL_CHANNEL_ID_CLI)
1705 LOG (GNUNET_ERROR_TYPE_DEBUG, " to origin\n"); 1706 LOG (GNUNET_ERROR_TYPE_DEBUG, " to origin\n");
1706 else 1707 else
@@ -1996,7 +1997,7 @@ GNUNET_CADET_show_channel (struct GNUNET_CADET_Handle *h,
1996 1997
1997 env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL); 1998 env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL);
1998 msg->peer = *initiator; 1999 msg->peer = *initiator;
1999 msg->channel_id.channel_of_client = htonl (channel_number); 2000 msg->ccn.channel_of_client = htonl (channel_number);
2000 GNUNET_MQ_send (h->mq, env); 2001 GNUNET_MQ_send (h->mq, env);
2001 2002
2002 h->info_cb.channel_cb = callback; 2003 h->info_cb.channel_cb = callback;