Ejemplo n.º 1
0
/**
 * Serialization routine for lifedata.
 */
static void
serialize_lifedata(pmsg_t *mb, gconstpointer data)
{
    const struct lifedata *ld = data;

    pmsg_write_u8(mb, LIFEDATA_STRUCT_VERSION);
    pmsg_write_time(mb, ld->first_seen);
    pmsg_write_time(mb, ld->last_seen);
}
Ejemplo n.º 2
0
/**
 * Serialization routine for guiddata.
 */
static void
serialize_guiddata(pmsg_t *mb, const void *data)
{
	const struct guiddata *gd = data;

	pmsg_write_u8(mb, GUID_DATA_VERSION);
	pmsg_write_time(mb, gd->create_time);
	pmsg_write_time(mb, gd->last_time);
}
Ejemplo n.º 3
0
/**
 * Serialization routine for tokdata.
 */
static void
serialize_tokdata(pmsg_t *mb, const void *data)
{
	const struct tokdata *td = data;

	pmsg_write_time(mb, td->last_update);
	pmsg_write_u8(mb, td->length);
	pmsg_write(mb, td->token, td->length);
}
Ejemplo n.º 4
0
/**
 * Serialization routine for pubdata.
 */
static void
serialize_pubdata(pmsg_t *mb, const void *data)
{
	const struct pubdata *pd = data;

	pmsg_write_time(mb, pd->next_enqueue);
	pmsg_write_time(mb, pd->expiration);

	/*
	 * Because this is persistent, version the structure so that changes
	 * can be processed efficiently after an upgrade.
	 *
	 * This is done here and not at the beginning of the serialized data
	 * because I forgot to plan for it before.
	 *		--RAM, 2009-10-18
	 */

	pmsg_write_u8(mb, PUBDATA_STRUCT_VERSION);
}
Ejemplo n.º 5
0
/**
 * Serialization routine for keydata.
 */
static void
serialize_keydata(pmsg_t *mb, const void *data)
{
	const struct keydata *kd = data;
	int i;

	g_assert(kd->values <= MAX_VALUES);

	pmsg_write_u8(mb, KEYS_KEYDATA_VERSION);
	pmsg_write_u8(mb, kd->values);

	for (i = 0; i < kd->values; i++) {
		pmsg_write(mb, &kd->creators[i], sizeof(kd->creators[i]));
		pmsg_write(mb, &kd->dbkeys[i], sizeof(kd->dbkeys[i]));
		pmsg_write_time(mb, kd->expire[i]);
	}
}