Ejemplo n.º 1
0
/*
 * The service database state is an attribute of the service record
 * of the SDP server itself. This attribute is guaranteed to
 * change if any of the contents of the service repository
 * changes. This function updates the timestamp of value of
 * the svcDBState attribute
 * Set the SDP server DB. Simply a timestamp which is the marker
 * when the DB was modified.
 */
static void update_db_timestamp(void)
{
	if (fixed_dbts) {
		sdp_data_t *d = sdp_data_alloc(SDP_UINT32, &fixed_dbts);
		sdp_attr_replace(server, SDP_ATTR_SVCDB_STATE, d);
	} else {
		uint32_t dbts = sdp_get_time();
		sdp_data_t *d = sdp_data_alloc(SDP_UINT32, &dbts);
		sdp_attr_replace(server, SDP_ATTR_SVCDB_STATE, d);
	}
}
Ejemplo n.º 2
0
static uint32_t sdp_cstate_alloc_buf(sdp_buf_t *buf)
{
	sdp_cstate_list_t *cstate = malloc(sizeof(sdp_cstate_list_t));
	uint8_t *data = malloc(buf->data_size);

	memcpy(data, buf->data, buf->data_size);
	memset((char *)cstate, 0, sizeof(sdp_cstate_list_t));
	cstate->buf.data = data;
	cstate->buf.data_size = buf->data_size;
	cstate->buf.buf_size = buf->data_size;
	cstate->timestamp = sdp_get_time();
	cstate->next = cstates;
	cstates = cstate;
	return cstate->timestamp;
}