//////////////////////////////////////////////////////////////////////
// PPPTraf 1.0. (C) DiSKiLLeR, 9/2/2000. (diskiller@cnbinc.com)     //
//                                                                  //
// This program is distributed under the terms of the GNU License.  //
// Please refer to the file README and COPYING.                     //
//////////////////////////////////////////////////////////////////////

#include <stdio.h>
#include <pthread.h>

#include "bpf.h"
#include "data.h"

/** little helper function **/
static void createthread(void *, void *);

int main()
{
	struct ahost *data;

	data_init();
	bpf_init("tun0");			/* uh oh ... */
	createthread((void *)bpf_loop, NULL);

	data = data_get();

	interface_init();
	interface_loop(data);

	printf("\nShutting down kernel BPF... ");
	fflush(stdout);
	bpf_shutdown();
	printf("done.\n");

	exit(0);
}



static void createthread(void *func, void *param)
{
	pthread_t th;
	pthread_attr_t attr;

	pthread_attr_init(&attr);
	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);

	pthread_create(&th, &attr, (void *)func, (void *)param);
}


syntax highlighted by Code2HTML, v. 0.9.1