int main(int argc, char *argv[])
{
	int pair[2];
	pthread_t tmp;
	struct pri *pri;
	pri_set_message(testmsg);
	pri_set_error(testerr);
	if (socketpair(AF_LOCAL, SOCK_DGRAM, 0, pair)) {
		perror("socketpair");
		exit(1);
	}
	if (!(pri = pri_new(pair[0], PRI_NETWORK, PRI_DEF_SWITCHTYPE))) {
		perror("pri(0)");
		exit(1);
	}
	first = pri;
	pri_set_debug(pri, DEBUG_LEVEL);
	if (pthread_create(&tmp, NULL, dchan, pri)) {
		perror("thread(0)");
		exit(1);
	}
	if (!(pri = pri_new(pair[1], PRI_CPE, PRI_DEF_SWITCHTYPE))) {
		perror("pri(1)");
		exit(1);
	}
	pri_set_debug(pri, DEBUG_LEVEL);
	if (pthread_create(&tmp, NULL, dchan, pri)) {
		perror("thread(1)");
		exit(1);
	}
	/* Wait for things to run */
	sleep(5);
	exit(0);
}
int main(int argc, char *argv[])
{
	int d1, d2;
	
	if (argc < 3) {
		fprintf(stderr, "Usage: pridump <dev1> <dev2>\n");
		exit(1);
	}
	
	pri_set_message(my_pri_message);
	pri_set_error(my_pri_error);
	
	d1 = pri_open(argv[1]);
	if (d1 < 0)
		exit(1);
	d2 = pri_open(argv[2]);
	if (d2 < 0)
		exit(1);
	pri_bridge(d1, d2);
	return 0;
}
Exemple #3
0
static FIO_SIG_LOAD_FUNCTION(ftdm_pritap_init)
{
    pri_set_error(s_pri_error);
    pri_set_message(s_pri_message);
    return FTDM_SUCCESS;
}