Example #1
0
struct peer* peer_exists_simple(const char* addr, unsigned short port)
{
	if(!addr || !port) return NULL;

	struct peer* sp=peer_new();
	strncpy(sp->addr, addr, IPV4_MAX);
	sp->port=port;
	struct peer* ret=peer_exists(sp);
	peer_remove(sp);
	return ret;
}
Example #2
0
static void e2avahi_resolve_callback(
    void* userdata,
	int event, /* One of E2AVAHI_EVENT_... */
	const char *name, /* name+type combination is unique on the network */
	const char *type,
	const char *host_name, /* hostname and port are only valid in ADD */
	uint16_t port)
{
	switch (event)
	{
		case E2AVAHI_EVENT_ADD:
			peer_register(name, host_name, port);
			break;
		case E2AVAHI_EVENT_REMOVE:
			peer_remove(name);
			break;
	}
}