9 struct pa_client *pa_client_new(struct pa_core *core, const char *protocol_name, char *name) {
14 c = malloc(sizeof(struct pa_client));
16 c->name = name ? strdup(name) : NULL;
19 c->protocol_name = protocol_name;
24 r = pa_idxset_put(core->clients, c, &c->index);
25 assert(c->index != PA_IDXSET_INVALID && r >= 0);
27 fprintf(stderr, "client: created %u \"%s\"\n", c->index, c->name);
32 void pa_client_free(struct pa_client *c) {
35 pa_idxset_remove_by_data(c->core->clients, c, NULL);
36 fprintf(stderr, "client: freed %u \"%s\"\n", c->index, c->name);
41 void pa_client_kill(struct pa_client *c) {
44 fprintf(stderr, "kill() operation not implemented for client %u\n", c->index);
51 char *pa_client_list_to_string(struct pa_core *c) {
53 struct pa_client *client;
54 uint32_t index = PA_IDXSET_INVALID;
60 pa_strbuf_printf(s, "%u client(s).\n", pa_idxset_ncontents(c->clients));
62 for (client = pa_idxset_first(c->clients, &index); client; client = pa_idxset_next(c->clients, &index)) {
63 pa_strbuf_printf(s, " index: %u\n\tname: <%s>\n\tprotocol_name: <%s>\n", client->index, client->name, client->protocol_name);
66 pa_strbuf_printf(s, "\towner module: <%u>\n", client->owner->index);
69 return pa_strbuf_tostring_free(s);
73 void pa_client_rename(struct pa_client *c, const char *name) {
76 c->name = name ? strdup(name) : NULL;