qb_ipcs_connection_alloc(struct qb_ipcs_service *s)
{
	struct qb_ipcs_connection *c =
	    calloc(1, sizeof(struct qb_ipcs_connection));

	if (c == NULL) {
		return NULL;
	}

	c->pid = 0;
	c->euid = -1;
	c->egid = -1;
	c->receive_buf = NULL;
	c->context = NULL;
	c->fc_enabled = QB_FALSE;
	c->state = QB_IPCS_CONNECTION_INACTIVE;
	c->poll_events = POLLIN | POLLPRI | POLLNVAL;

	c->setup.type = s->type;
	c->request.type = s->type;
	c->response.type = s->type;
	c->event.type = s->type;
	(void)strlcpy(c->description, "not set yet", CONNECTION_DESCRIPTION);

	/* initial alloc ref */
	qb_ipcs_connection_ref(c);

	/*
	 * The connection makes use of the service object. Give the connection
	 * a reference to the service so we know the service can never be destroyed
	 * until the connection is done with it.
	 */
	qb_ipcs_ref(s);
	c->service = s;
	qb_list_init(&c->list);

	return c;
}
qb_ipcs_connection_alloc(struct qb_ipcs_service *s)
{
	struct qb_ipcs_connection *c =
	    calloc(1, sizeof(struct qb_ipcs_connection));

	if (c == NULL) {
		return NULL;
	}

	c->pid = 0;
	c->euid = -1;
	c->egid = -1;
	c->receive_buf = NULL;
	c->context = NULL;
	c->fc_enabled = QB_FALSE;
	c->state = QB_IPCS_CONNECTION_INACTIVE;
	c->poll_events = POLLIN | POLLPRI | POLLNVAL;

	c->setup.type = s->type;
	c->request.type = s->type;
	c->response.type = s->type;
	c->event.type = s->type;
	(void)strlcpy(c->description, "not set yet", CONNECTION_DESCRIPTION);

	 
	qb_ipcs_connection_ref(c);

	 
	qb_ipcs_ref(s);
	c->service = s;
	qb_list_init(&c->list);

	return c;
}