示例#1
0
static void new_announcer(AvahiServer *s, AvahiInterface *i, AvahiEntry *e) {
    AvahiAnnouncer *a;

    assert(s);
    assert(i);
    assert(e);
    assert(!e->dead);

    if (!avahi_interface_match(i, e->interface, e->protocol) || !i->announcing || !avahi_entry_is_commited(e))
        return;

    /* We don't want duplicate announcers */
    if (get_announcer(s, e, i))
        return;

    if ((!(a = avahi_new(AvahiAnnouncer, 1)))) {
        avahi_log_error(__FILE__": Out of memory.");
        return;
    }

    a->server = s;
    a->interface = i;
    a->entry = e;
    a->time_event = NULL;

    AVAHI_LLIST_PREPEND(AvahiAnnouncer, by_interface, i->announcers, a);
    AVAHI_LLIST_PREPEND(AvahiAnnouncer, by_entry, e->announcers, a);

    go_to_initial_state(a);
}
示例#2
0
static void reannounce_walk_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
    AvahiEntry *e = userdata;
    AvahiAnnouncer *a;

    assert(m);
    assert(i);
    assert(e);
    assert(!e->dead);

    if (!(a = get_announcer(m->server, e, i)))
        return;

    reannounce(a);
}
示例#3
0
void avahi_entry_return_to_initial_state(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
    AvahiAnnouncer *a;

    assert(s);
    assert(e);
    assert(i);

    if (!(a = get_announcer(s, e, i)))
        return;

    if (a->state == AVAHI_PROBING && a->entry->group)
        a->entry->group->n_probing--;

    go_to_initial_state(a);
}
示例#4
0
int avahi_entry_is_probing(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
    AvahiAnnouncer *a;

    assert(s);
    assert(e);
    assert(i);
    assert(!e->dead);

    if (!(a = get_announcer(s, e, i)))
        return 0;

    return
        a->state == AVAHI_PROBING ||
        (a->state == AVAHI_WAITING && (e->flags & AVAHI_PUBLISH_UNIQUE));
}
示例#5
0
int avahi_entry_is_registered(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
    AvahiAnnouncer *a;

    assert(s);
    assert(e);
    assert(i);
    assert(!e->dead);

    if (!(a = get_announcer(s, e, i)))
        return 0;

    return
        a->state == AVAHI_ANNOUNCING ||
        a->state == AVAHI_ESTABLISHED ||
        (a->state == AVAHI_WAITING && !(e->flags & AVAHI_PUBLISH_UNIQUE));
}
示例#6
0
void avahi_entry_return_to_initial_state(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
    AvahiAnnouncer *a;
    
    assert(s);
    assert(e && e->type == AVAHI_ENTRY_MDNS);
    assert(i);

    if (!(a = get_announcer(s, e, i)))
        return;

    if (a->state == AVAHI_PROBING && a->entry->group) {
		assert(a->entry->group->type == AVAHI_GROUP_MDNS);
        a->entry->group->proto.mdns.n_probing--;
	}

    go_to_initial_state(a);
}