4 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
9 static char rcsid[] = "$Id$";
13 * Revision 1.2 2008/02/14 00:57:58 james
14 * *** empty log message ***
16 * Revision 1.1 2008/02/13 18:05:06 james
17 * *** empty log message ***
26 client_free (Client * c)
32 fprintf(stderr,"Client at %p freed\n",c);
36 clients_new_client (Clients * cs, Socket * s, Context * ctx)
40 c = (Client *) malloc (sizeof (Client));
49 fprintf(stderr,"Client at %p created\n",c);
52 if (ipc_msg_send_debug (s, "new_client"))
59 clients_reap (Clients * cs)
64 for (p = &cs->head; *p;)
84 Clients *ret = (Clients *) malloc (sizeof (Clients));
93 clients_pre_select (Clients * cs, fd_set * rfds, fd_set * wfds)
97 for (c = cs->head; c; c = c->next)
99 socket_pre_select (c->s, rfds, wfds);
104 clients_post_select (Clients * cs, Context * ctx, fd_set * rfds,
110 for (c = cs->head; c; c = c->next)
112 if (socket_post_select (c->s, rfds, wfds))
124 clients_output (Clients * cs, void *_buf, int len)
126 uint8_t *buf=(uint8_t *) _buf;
129 #define DEBUG_MSG_LEN 128
131 char mbuf[sizeof (IPC_Msg_hdr) + DEBUG_MSG_LEN];
137 m = (IPC_Msg *) mbuf;
138 m->debug.type = IPC_MSG_TYPE_DEBUG;
139 i=sprintf(m->debug.msg,"buf[0]=%d len=%d",buf[0],len);
140 m->debug.size = sizeof (IPC_Msg_hdr) + i + 1;
144 for (c = cs->head; c; c = c->next)
147 if (ipc_msg_send(c->s,m))
155 clients_shutdown (Clients * cs)
159 for (c = cs->head; c; c = c->next)