#ifndef _UTIL_H_ #define _UTIL_H_ #include "rlocs.h" #include #include #include #include #define debug(msg, ...) { fprintf( stderr, msg, ##__VA_ARGS__ ) ; fprintf( stdout, "\n" ); } #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 multi ); int link_set_up( char *link_name, int state ); /* Our programs use this common struct to take advantage of common init code */ struct session { struct rlocs *rlocs; int fd; }; int session_setup( struct session *session, char *config_file, char *ifname, int multi ); /* We take an array of 2n rlocs to upgrade. First element of each pair is * IP address, second element of each pair is path to private key file */ int session_upgrade_rlocs( struct session *session, int argc, char** args ); void session_teardown( struct session *session ); int sha256sum( unsigned char *src, size_t src_len, unsigned char dst[SHA256_DIGEST_LENGTH] ); #endif