restructured interfaces of client.c and channel.c.