2013-08-04 03:07:20 +01:00
|
|
|
#ifndef _UTIL_H_
|
|
|
|
#define _UTIL_H
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#define info(msg, ...) { fprintf( stdout, msg, ##__VA_ARGS__ ) ; fprintf( stdout, "\n" ); }
|
|
|
|
#define warn(msg, ...) { fprintf( stderr, msg, ##__VA_ARGS__ ) ; fprintf( stderr, "\n" ); }
|
|
|
|
|
|
|
|
|
|
|
|
void* xmalloc( size_t bytes );
|
|
|
|
int create_tun( const char* name );
|
|
|
|
|
|
|
|
int link_set_up( char *link_name, int state );
|
|
|
|
|
2013-08-06 15:20:48 +01:00
|
|
|
/* Our programs use this common struct to take advantage of common init code */
|
|
|
|
struct session {
|
|
|
|
struct rlocs *rlocs;
|
|
|
|
int listen_if;
|
|
|
|
int output_if;
|
|
|
|
int same_if;
|
|
|
|
};
|
|
|
|
|
|
|
|
int session_setup( struct session *session, char *config_file, char *listen_if, char *output_if );
|
|
|
|
void session_teardown( struct session *session );
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-04 03:07:20 +01:00
|
|
|
#endif
|