void read_cb(int fd, short ev_kind, void *arg) { char buff[50]; ssize_t read_cnt; struct client *c = (struct client*)arg; read_cnt = read(fd, buff, sizeof(buff)); if (read_cnt <= 0) { if (errno != EAGAIN && errno != EWOULDBLOCK) { del_client(c); } } else { c->wevent = (struct event*)calloc(1, sizeof(struct event)); if (c->wevent == NULL) { del_client(c); } event_set(c->wevent, fd, EV_WRITE, write_cb, c); event_add(c->wevent, NULL); printf("recv from client: %s\n", buff); } }
void serv_pdi(t_on_screen *screen, char *msg) { int num_cli; t_cli *list_cli; t_cli *save_cli; int cli_exist; num_cli = atoi(get_argument(msg, 2)); list_cli = screen->world->client; save_cli = NULL; cli_exist = 0; while (list_cli != NULL) { if (list_cli->num == num_cli) { cli_exist = 1; break; } save_cli = list_cli; list_cli = list_cli->next; } if (cli_exist) del_client(screen, save_cli, list_cli); screen->world->loading = 0; }
int pdi_cmd(char **args, t_graphic *c) { if (check_player(atoi(args[0] + 1), c) == FAILURE) return (my_error("Unknown player id", FAILURE)); del_client(c, atoi(args[0] + 1)); return (SUCCESS); }
/* Close all client connections sending EV_EXIT. */ static void close_clients () { int i; for (i = 0; i < CLIENTS_MAX; i++) if (clients[i].socket != -1) { send_int (clients[i].socket, EV_EXIT); close (clients[i].socket); del_client (&clients[i]); } }
/* Client requested we send the queue so we get it from audio.c and * send it to the client. */ static int req_send_queue (struct client *cli) { int i; struct plist *queue; logit ("Client with fd %d wants queue... sending it", cli->socket); if (!send_int(cli->socket, EV_DATA)) { logit ("Error while sending response; disconnecting the client"); close (cli->socket); del_client (cli); return 0; } queue = audio_queue_get_contents (); for (i = 0; i < queue->num; i++) if (!plist_deleted(queue, i)) { if(!send_item(cli->socket, &queue->items[i])){ logit ("Error sending queue; disconnecting the client"); close (cli->socket); del_client (cli); free (queue); return 0; } } plist_free (queue); free (queue); if (!send_item (cli->socket, NULL)) { logit ("Error while sending end of playlist mark; " "disconnecting the client"); close (cli->socket); del_client (cli); return 0; } logit ("Queue sent"); return 1; }
static void command(struct tpclient *c, char *buf) { char cmd = *buf; if (cmd < sizeof commands / sizeof *commands) svriowait(c, tprealloc(buf, commands[cmd].len), commands[cmd].func, commands[cmd].func_name); else { error("unknown command %d", cmd); if (DEBUG > 2) DumpFD(c->fd); tpfree(buf); del_client(c); } }
/* Send events to clients whose sockets are ready to write. */ static void send_events (fd_set *fds) { int i; for (i = 0; i < CLIENTS_MAX; i++) if (clients[i].socket != -1 && FD_ISSET(clients[i].socket, fds)) { debug ("Flushing events for client %d", i); if (!flush_events (&clients[i])) { close (clients[i].socket); del_client (&clients[i]); } } }
void write_cb(int fd, short ev_kind, void *arg) { char buff[50] = {"Hello Client!"}; ssize_t write_cnt; write_cnt = write(fd, buff, strlen(buff)); if (write_cnt != strlen(buff)) { printf("write error\n"); } else { printf("write to client: %s\n", buff); } del_client((struct client*)arg); }
void unregister_with_agent(t_agent_client *client) /* * Drop the client given */ { t_agent *agent; if(!client) return; agent = client->agent; if(agent) { WAITLOCK(agent->lck); agent->clients = g_slist_remove(agent->clients, client); UNLOCK(agent->lck); } del_client(client); } /* unregister_with_agent() */
int event_handler(int msg_type, int charging_type, int cid, char *subscriber, int crdtonce, int crdtpsec, int crdtpMb) { AAAMessage *acr; //Offline charging AAAMessage *ccr; //Online charging int sesid = cid; str user_subscriber; user_subscriber.s = subscriber; user_subscriber.len = strlen(user_subscriber.s); //sprintf(buf,"%d",cid); //str sesid; sesid.s = cid;sesid.len = strlen(sesid.s); str ohost; ohost.s = "iptv.open-ims.test"; ohost.len = strlen(ohost.s); str orealm; orealm.s = "open-ims.test"; orealm.len = strlen(orealm.s); str drealm; drealm.s = "open-ims.test"; drealm.len = strlen(drealm.s); str dhost; dhost.s = "cdf.open-ims.test"; dhost.len = strlen(dhost.s); str dhost1; dhost1.s = "ocf.open-ims.test"; dhost1.len = strlen(dhost1.s); str acctype; acctype.s ="START"; acctype.len = strlen(acctype.s); str accnumber; accnumber.s = "10"; accnumber.len = strlen(accnumber.s); str auth_app_id; auth_app_id.s = "100"; auth_app_id.len = strlen(auth_app_id.s); str service_context_id; service_context_id.s = "100"; service_context_id.len = strlen(service_context_id.s); str cc_type; cc_type.s ="START"; cc_type.len = strlen(cc_type.s); str cc_number; cc_number.s = "10"; cc_number.len = strlen(cc_number.s); switch (msg_type) { case START: if (charging_type == 0) { LOG(L_INFO,"INFO: event_handler - Invoking offline charging\n"); lock_get(list_of_clients->lock); if(!list_of_clients->head){ LOG(L_DBG,"event_handler START - No clients Found on list.\n"); lock_release(list_of_clients->lock); return 0; } client = list_of_clients->head; while(client->call_id != cid && client->next !=0){ client=client->next; } if(client->call_id != cid && client->next == 0){ LOG(L_ERR,"event_handler START - Client not found.\n"); lock_release(list_of_clients->lock); return 0; } LOG(L_DBG,"event_handler START - Found client %s call ID %d\n",client->subscriber,client->call_id); lock_release(list_of_clients->lock); LOG(L_INFO,"event_handler START - ACR (INITIAL_REQUEST).\n"); acr = Rf_ACR(sesid,user_subscriber,ohost,orealm,drealm,START,accnumber,dhost,0,0,0); if(acr==0) return 0; } else if (charging_type == 1) { LOG(L_INFO,"INFO: event_handler - START - Invoking online charging\n"); lock_get(list_of_clients->lock); if(!list_of_clients->head){ LOG(L_DBG,"event_handler START - No clients Found on list.\n"); lock_release(list_of_clients->lock); return 0; } client = list_of_clients->head; while(client->call_id != cid && client->next !=0){ client=client->next; } if(client->call_id != cid && client->next == 0){ LOG(L_ERR,"event_handler START - Client not found.\n"); lock_release(list_of_clients->lock); return 0; } LOG(L_DBG,"event_handler START - Found client %s call ID %d\n",client->subscriber,client->call_id); LOG(L_DBG,"event_handler START - Found %s callID %d and credits %d.\n",client->subscriber,client->call_id,client->onceoff_credit + client->persec_credit + client->perMbyte_credit); lock_release(list_of_clients->lock); LOG(L_INFO,"event_handler START - CCR (INITIAL_REQUEST).\n"); ccr = Ro_CCR(sesid,user_subscriber,ohost,orealm,auth_app_id,service_context_id,START,cc_number,dhost1,0,0,0); if(ccr==0) return 0; } break; case INTERIM: if(charging_type == 0) { lock_get(list_of_clients->lock); if(!list_of_clients->head){ LOG(L_DBG,"event_handler INTERIM - No clients Found on list.\n"); lock_release(list_of_clients->lock); return 0; } client = list_of_clients->head; while(client->call_id != cid && client->next !=0){ client=client->next; } if(client->call_id != cid && client->next == 0){ LOG(L_ERR,"event_handler INTERIM - Client not found.\n"); lock_release(list_of_clients->lock); return 0; } LOG(L_DBG,"event_handler INTERIM - Found client %s call ID %d\n",client->subscriber,client->call_id); LOG(L_DBG,"event_handler INTERIM - Found %s callID %d and credits %d.\n",client->subscriber,client->call_id,client->onceoff_credit + client->persec_credit + client->perMbyte_credit); lock_release(list_of_clients->lock); LOG(L_INFO,"event_handler INTERIM - Sending ACR(UPDATE_REQUEST).\n"); acr = Rf_ACR(sesid,user_subscriber,ohost,orealm,drealm,INTERIM,accnumber,dhost,crdtonce,crdtpsec,crdtpMb); if(acr==0) return 0; } else if(charging_type == 1) { lock_get(list_of_clients->lock); if(!list_of_clients->head){ LOG(L_DBG,"event_handler INTERIM - No clients Found on list.\n"); lock_release(list_of_clients->lock); return 0; } client = list_of_clients->head; while(client->call_id != cid && client->next !=0){ client=client->next; } if(client->call_id != cid && client->next == 0){ LOG(L_ERR,"event_handler INTERIM - Client not found.\n"); lock_release(list_of_clients->lock); return 0; } LOG(L_DBG,"event_handler INTERIM - Found client %s call ID %d\n",client->subscriber,client->call_id); LOG(L_DBG,"event_handler INTERIM - Found %s callID %d and credits %d.\n",client->subscriber,client->call_id,client->onceoff_credit + client->persec_credit + client->perMbyte_credit); lock_release(list_of_clients->lock); LOG(L_INFO,"event_handler INTERIM - Sending CCR(UPDATE_REQUEST).\n"); ccr = Ro_CCR(sesid,user_subscriber,ohost,orealm,auth_app_id,service_context_id,INTERIM,cc_number,dhost1,crdtonce,crdtpsec,crdtpMb); if(ccr==0) return 0; } break; case STOP: if(charging_type == 0) { lock_get(list_of_clients->lock); if(!list_of_clients->head){ LOG(L_DBG,"event_handler STOP - No clients Found on list.\n"); lock_release(list_of_clients->lock); return 0; } client = list_of_clients->head; while(client->call_id != cid && client->next !=0){ client=client->next; } if(client->call_id != cid && client->next == 0){ LOG(L_ERR,"event_handler STOP - Client not found.\n"); lock_release(list_of_clients->lock); return 0; } LOG(L_DBG,"event_handler STOP - Found client %s call ID %d\n",client->subscriber,client->call_id); LOG(L_DBG,"event_handler STOP - Found %s callID %d and credits %d.\n",client->subscriber,client->call_id,client->onceoff_credit + client->persec_credit + client->perMbyte_credit); lock_release(list_of_clients->lock); LOG(L_INFO,"event_handler STOP - Sending ACR(TERMINATE_REQUEST).\n"); acr = Rf_ACR(sesid,user_subscriber,ohost,orealm,drealm,STOP,accnumber,dhost,crdtonce,crdtpsec,crdtpMb); if(acr==0) return 0; del_client(cid); } else if(charging_type == 1) { lock_get(list_of_clients->lock); if(!list_of_clients->head){ LOG(L_DBG,"event_handler STOP - No clients Found on list.\n"); lock_release(list_of_clients->lock); return 0; } client = list_of_clients->head; while(client->call_id != cid && client->next !=0){ client=client->next; } if(client->call_id != cid && client->next == 0){ LOG(L_ERR,"event_handler STOP - Client not found.\n"); lock_release(list_of_clients->lock); return 0; } LOG(L_DBG,"event_handler STOP - Found client %s call ID %d\n",client->subscriber,client->call_id); LOG(L_DBG,"event_handler STOP - Found %s callID %d and credits %d.\n",client->subscriber,client->call_id,client->onceoff_credit + client->persec_credit + client->perMbyte_credit); lock_release(list_of_clients->lock); LOG(L_INFO,"event_handler STOP - Sending CCR(TERMINATE_REQUEST).\n"); ccr = Ro_CCR(sesid,user_subscriber,ohost,orealm,auth_app_id,service_context_id,STOP,cc_number,dhost1,crdtonce,crdtpsec,crdtpMb); if(ccr==0) return 0; call_terminate(client->call_id,client->call_did); del_client(cid); } break; case EVENT: //Not yet used lock_get(list_of_clients->lock); if(!list_of_clients->head){ LOG(L_DBG,"event_handler EVENT - No clients Found on list.\n"); lock_release(list_of_clients->lock); return 0; } client = list_of_clients->head; while(client->call_id != cid && client->next !=0){ client=client->next; } if(client->call_id != cid && client->next == 0){ LOG(L_ERR,"event_handler EVENT - Client not found.\n"); lock_release(list_of_clients->lock); return 0; } LOG(L_DBG,"event_handler EVENT - Found client %s call ID %d\n",client->subscriber,client->call_id); LOG(L_DBG,"event_handler EVENT - Found %s callID %d and credits %d.\n",client->subscriber,client->call_id,client->onceoff_credit + client->persec_credit + client->perMbyte_credit); client->events = Event; lock_release(list_of_clients->lock); break; case YES: lock_get(list_of_clients->lock); if(!list_of_clients->head){ LOG(L_DBG,"event_handler YES - No clients Found on list.\n"); lock_release(list_of_clients->lock); return 0; } client = list_of_clients->head; while(client->call_id != cid && client->next !=0){ client=client->next; } if(client->call_id != cid && client->next == 0){ LOG(L_ERR,"event_handler YES - Client not found.\n"); lock_release(list_of_clients->lock); return 0; } client->subscriber = subscriber;//Temporary hack LOG(L_DBG,"event_handler YES - Found client %s call ID %d\n",client->subscriber,client->call_id); LOG(L_DBG,"event_handler YES - Found %s callID %d and credits %d.\n",client->subscriber,client->call_id,client->onceoff_credit + client->persec_credit + client->perMbyte_credit); LOG(L_DBG,"event_handler YES - Credits received for %s client ID: %d\tonce: %d\tTime: %d\tVol: %d\n",client->subscriber,client->call_id,crdtonce,crdtpsec,crdtpMb); if(client->charge_type == 1){ client->onceoff_credit = client->onceoff_credit + crdtonce; client->persec_credit = client->persec_credit + crdtpsec; client->perMbyte_credit = client->perMbyte_credit + crdtpMb; client->used_crtdonce = client->onceoff_credit; client->onceoff_credit = 0; }else{ client->onceoff_credit = crdtonce; client->persec_credit = crdtpsec; client->perMbyte_credit = crdtpMb; } client->feedback = Yes; lock_release(list_of_clients->lock); break; case NO: //Not used break; } return 1; }
static void Iowait(void) { int maxfd; fd_set readfds; QUEUE *q; /* accept input on any descriptor */ FD_ZERO(&readfds); FD_SET(master, &readfds); maxfd = master; for (q = QFIRST(tpclients); q != &tpclients; q = QNEXT(q)) { struct tpclient * c = OFFSET(q, struct tpclient, global); if (c->fd > maxfd) maxfd = c->fd; FD_SET(c->fd, &readfds); } debug(3, "entering select to fd %d", maxfd); /* wait for something to do */ if (select(maxfd + 1, &readfds, 0, 0, 0) == -1) { error("select: %m"); return; } /* new client connection */ if (FD_ISSET(master, &readfds)) { debug(1, "new connection"); int i = accept(master, 0, 0); if (i == -1) error("accept: %m"); else svr_next_command(new_client(i)); } q = QFIRST(tpclients); while (q != &tpclients) { struct tpclient * c = OFFSET(q, struct tpclient, global); q = QNEXT(q); if (FD_ISSET(c->fd, &readfds)) { long bufsize = c->input ? tptypes(c->input, 0, 0) : 0; int used = c->used; if (used >= bufsize) // something unexpected. could be EOF { char check_eof[100]; int len = read(c->fd, &check_eof, sizeof check_eof); if (len > 0) { error("Iowait: read %d unexpected bytes from fd %d", len, c->fd); dump(c->fd, "unexpected", check_eof, len); } del_client(c); } else if ((used = read(c->fd, c->input + used, bufsize - used)) == -1) { error("Iowait: read: %m"); del_client(c); } else if (used == 0) { debug(1, "eof on %d", c->fd); del_client(c); } else if ((c->used = c->used + used) == bufsize) { void (*handle)(struct tpclient *, char *) = c->handler; char *buf = c->input; char *handler_name = c->handler_name; c->handler_name = 0; c->handler = 0; c->input = 0; c->used = 0; debug(1, "%d bytes read from %d. calling handler %s at 0x%x", bufsize, c->fd, handler_name, handle); if (DEBUG > 2) dump(c->fd, "read", buf, bufsize); handle(c, buf); debug(2, "back from handler %s at 0x%x", handler_name, handle); } else debug(2, "%d bytes read from %d. waiting for %d more...", used, c->fd, bufsize - c->used); } if (q != &tpclients) debug(2, "-------"); } }
/* Handle CMD_SEND_PLIST. Some client requested to get the playlist, so we asked * another client to send it (EV_SEND_PLIST). */ static int req_send_plist (struct client *cli) { int requesting = find_cli_requesting_plist (); int send_fd; struct plist_item *item; int serial; debug ("Client with fd %d wants to send its playlists", cli->socket); if (requesting == -1) { logit ("No clients are requesting the playlist"); send_fd = -1; } else { send_fd = clients[requesting].socket; if (!send_int(send_fd, EV_DATA)) { logit ("Error while sending response; disconnecting the client"); close (send_fd); del_client (&clients[requesting]); send_fd = -1; } } if (!get_int(cli->socket, &serial)) { logit ("Error while getting serial"); return 0; } if (send_fd != -1 && !send_int(send_fd, serial)) { error ("Error while sending serial; disconnecting the client"); close (send_fd); del_client (&clients[requesting]); send_fd = -1; } /* Even if no clients are requesting the playlist, we must read it, * because there is no way to say that we don't need it. */ while ((item = recv_item(cli->socket)) && item->file[0]) { if (send_fd != -1 && !send_item(send_fd, item)) { logit ("Error while sending item; disconnecting the client"); close (send_fd); del_client (&clients[requesting]); send_fd = -1; } plist_free_item_fields (item); free (item); } if (item) { plist_free_item_fields (item); free (item); logit ("Playlist sent"); } else logit ("Error while receiving item"); if (send_fd != -1 && !send_item (send_fd, NULL)) { logit ("Error while sending end of playlist mark; " "disconnecting the client"); close (send_fd); del_client (&clients[requesting]); return 0; } if (requesting != -1) clients[requesting].requests_plist = 0; return item ? 1 : 0; }
/* Receive a command from the client and execute it. */ static void handle_command (const int client_id) { int cmd; int err = 0; struct client *cli = &clients[client_id]; if (!get_int(cli->socket, &cmd)) { logit ("Failed to get command from the client"); close (cli->socket); del_client (cli); return; } switch (cmd) { case CMD_QUIT: logit ("Exit request from the client"); close (cli->socket); del_client (cli); server_quit = 1; break; case CMD_LIST_CLEAR: logit ("Clearing the list"); audio_plist_clear (); break; case CMD_LIST_ADD: if (!req_list_add(cli)) err = 1; break; case CMD_PLAY: if (!req_play(cli)) err = 1; break; case CMD_DISCONNECT: logit ("Client disconnected"); close (cli->socket); del_client (cli); break; case CMD_PAUSE: audio_pause (); break; case CMD_UNPAUSE: audio_unpause (); break; case CMD_STOP: audio_stop (); break; case CMD_GET_CTIME: if (!send_data_int(cli, MAX(0, audio_get_time()))) err = 1; break; case CMD_SEEK: if (!req_seek(cli)) err = 1; break; case CMD_JUMP_TO: if (!req_jump_to(cli)) err = 1; break; case CMD_GET_SNAME: if (!send_sname(cli)) err = 1; break; case CMD_GET_STATE: if (!send_data_int(cli, audio_get_state())) err = 1; break; case CMD_GET_BITRATE: if (!send_data_int(cli, sound_info.bitrate)) err = 1; break; case CMD_GET_AVG_BITRATE: if (!send_data_int(cli, sound_info.avg_bitrate)) err = 1; break; case CMD_GET_RATE: if (!send_data_int(cli, sound_info.rate)) err = 1; break; case CMD_GET_CHANNELS: if (!send_data_int(cli, sound_info.channels)) err = 1; break; case CMD_NEXT: audio_next (); break; case CMD_PREV: audio_prev (); break; case CMD_PING: if (!send_int(cli->socket, EV_PONG)) err = 1; break; case CMD_GET_OPTION: if (!send_option(cli)) err = 1; break; case CMD_SET_OPTION: if (!get_set_option(cli)) err = 1; break; case CMD_GET_MIXER: if (!send_data_int(cli, audio_get_mixer())) err = 1; break; case CMD_SET_MIXER: if (!set_mixer(cli)) err = 1; break; case CMD_DELETE: if (!delete_item(cli)) err = 1; break; case CMD_SEND_PLIST_EVENTS: cli->wants_plist_events = 1; logit ("Request for events"); break; case CMD_GET_PLIST: if (!get_client_plist(cli)) err = 1; break; case CMD_SEND_PLIST: if (!req_send_plist(cli)) err = 1; break; case CMD_CAN_SEND_PLIST: cli->can_send_plist = 1; break; case CMD_CLI_PLIST_ADD: case CMD_CLI_PLIST_DEL: case CMD_CLI_PLIST_CLEAR: case CMD_CLI_PLIST_MOVE: if (!plist_sync_cmd(cli, cmd)) err = 1; break; case CMD_LOCK: if (!client_lock(cli)) err = 1; break; case CMD_UNLOCK: if (!client_unlock(cli)) err = 1; break; case CMD_GET_SERIAL: if (!send_serial(cli)) err = 1; break; case CMD_PLIST_GET_SERIAL: if (!req_plist_get_serial(cli)) err = 1; break; case CMD_PLIST_SET_SERIAL: if (!req_plist_set_serial(cli)) err = 1; break; case CMD_GET_TAGS: if (!req_get_tags(cli)) err = 1; break; case CMD_TOGGLE_MIXER_CHANNEL: req_toggle_mixer_channel (); break; case CMD_TOGGLE_SOFTMIXER: req_toggle_softmixer (); break; case CMD_GET_MIXER_CHANNEL_NAME: if (!req_get_mixer_channel_name(cli)) err = 1; break; case CMD_GET_FILE_TAGS: if (!get_file_tags(client_id)) err = 1; break; case CMD_ABORT_TAGS_REQUESTS: if (!abort_tags_requests(client_id)) err = 1; break; case CMD_LIST_MOVE: if (!req_list_move(cli)) err = 1; break; case CMD_TOGGLE_EQUALIZER: req_toggle_equalizer(); break; case CMD_EQUALIZER_REFRESH: req_equalizer_refresh(); break; case CMD_EQUALIZER_PREV: req_equalizer_prev(); break; case CMD_EQUALIZER_NEXT: req_equalizer_next(); break; case CMD_TOGGLE_MAKE_MONO: req_toggle_make_mono(); break; case CMD_QUEUE_ADD: if (!req_queue_add(cli)) err = 1; break; case CMD_QUEUE_DEL: if (!req_queue_del(cli)) err = 1; break; case CMD_QUEUE_CLEAR: logit ("Clearing the queue"); audio_queue_clear (); add_event_all (EV_QUEUE_CLEAR, NULL); break; case CMD_QUEUE_MOVE: if (!req_queue_move(cli)) err = 1; break; case CMD_GET_QUEUE: if (!req_send_queue(cli)) err = 1; break; default: logit ("Bad command (0x%x) from the client", cmd); err = 1; } if (err) { logit ("Closing client connection due to error"); close (cli->socket); del_client (cli); } }
t_agent_client * register_with_agent( t_agent *agent, /* Agent to register with */ int *am_mask /* Messages accepted */ #ifdef DEBUG , char *name /* For debugging!!! */ #endif ) /* * Register with the given agent. A new client will be created * with a distinct input queue onto which all agent status * messages will be duplicated. * In addition a new file descriptor for the output queue * will be created for sending messages to the agent. * The am_mask is a list of every message ID that the client * should be sent, terminated with NULL. If this is the only * value given then no messages will ever be sent to the client * registering. */ { t_agent_client *client; int cell; /* Cell in 'mask' array */ if(!agent) /* Agent doesn't exist? */ { E("Client called to register with NULL agent"); return NULL; /* Nothing to do! */ } client = NEW(t_agent_client); if(!client) { E("Failed to create new client"); return NULL; } client->agent = agent; client->op_am_q = agent->ip_am_q; client->ip_am_q = NO_AM_Q; #ifdef DEBUG client->name = name; #endif client->ip_am_q = new_am_q(); if(client->ip_am_q == NO_AM_Q) { E("Failed to initialise client due to msg Q failure"); D(7, "INFO: agent = [%s]", agent->name); del_client(client); return NULL; } /* * Compile the message mask. For every message in the list, * set the appropriate messsage ID in the mask to TRUE */ for(cell = 0; cell < am_enums; cell++) /* Default all masks to FALSE*/ client->mask[cell] = FALSE; while(*am_mask) /* For each ID in the list ..*/ { #ifdef PARANOID if(*am_mask > am_enums) /* Sanity (range check) */ { E("mask value [%d] > MAX [%d]", *am_mask, am_enums); } else #endif client->mask[(*am_mask) - 1] = TRUE;/* Set to true */ am_mask++; } /* --- Append the client to the agent's master list of clients --- */ WAITLOCK(agent->lck); agent->clients = g_slist_append(agent->clients, client); D(7, "[%s] is client %d of agent [%s]", name, g_slist_length(agent->clients)-1, agent->name); UNLOCK(agent->lck); return client; } /* register_with_agent() */