Exemple #1
0
int __cdecl
#else
int
#endif
main(
	int		argc,
	char	**	argv)
{
	sw_discovery		discovery;
	sw_discovery_oid	oid;
	sw_result			err;

	err = sw_discovery_init(&discovery);
	sw_check_okay(err, exit);

	if (argc != 4)
	{
		fprintf(stderr, "usage: mDNSBrowse <name> <rrtype> <rrclass>\n");
		return -1;
	}

	err = sw_discovery_query_record(discovery, 0, 0, argv[1], atoi(argv[2]), atoi(argv[3]), query_record_reply, NULL, &oid);
	sw_check_okay(err, exit);

	err = sw_discovery_run(discovery);
	sw_check_okay(err, exit);

exit:

	return err;
}
Exemple #2
0
int __cdecl
#else
int
#endif
main(
	int		argc,
	char	**	argv)
{
	sw_discovery		discovery;
	sw_discovery_oid	oid;
	sw_result			err;

	err = sw_discovery_init(&discovery);
	sw_check_okay(err, exit);

	if (argc != 2)
	{
		fprintf(stderr, "usage: mDNSBrowse <type>\n");
		return -1;
	}

	err = sw_discovery_browse(discovery, 0, argv[1], NULL, my_browser, NULL, &oid);
	sw_check_okay(err, exit);

	err = sw_discovery_run(discovery);
	sw_check_okay(err, exit);

exit:

	return err;
}
/*
 * rend_private_init
 *
 * Initialize howl and start runloop
 */
int rend_private_init(char *user) {
    sw_result result;
    
    DPRINTF(E_DBG,L_REND,"Starting rendezvous services\n");
    signal(SIGHUP,  SIG_IGN);           // SIGHUP might happen from a request to reload the daap server

    if(sw_discovery_init(&rend_handle) != SW_OKAY) {
	DPRINTF(E_WARN,L_REND,"Error initializing howl\n");
	errno=EINVAL;
	return -1;
    }

    if(drop_privs(user)) 
	return -1;

    DPRINTF(E_DBG,L_REND,"Starting polling thread\n");
    
    if(pthread_create(&rend_tid,NULL,rend_pipe_monitor,NULL)) {
	DPRINTF(E_FATAL,L_REND,"Could not start thread.  Terminating\n");
	/* should kill parent, too */
	exit(EXIT_FAILURE);
    }

    DPRINTF(E_DBG,L_REND,"Entering runloop\n");

    sw_discovery_run(rend_handle);

    DPRINTF(E_DBG,L_REND,"Exiting runloop\n");

    return 0;
}
Exemple #4
0
int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
    sw_discovery discovery;
    sw_discovery_oid oid;
    
    ASSERT_SW_OKAY(sw_discovery_init(&discovery));

    ASSERT_SW_OKAY(sw_discovery_browse_domains(discovery, 0, reply, NULL, &oid));
    
    ASSERT_SW_OKAY(sw_discovery_run(discovery));
                   
    return 0;
}