Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
teotun.c

Teonet TCP Tunnel example

To execute this example start teotun peer. The example will connect to it. So start teonet application with teotun name, for example:

app/teovpn teotun

The start examples/teotun application to create tunnel to port 22 at the teotun peer. This tunnel will open port 7522 at host where teotun example started:

examples/teotun teotun_c

To test created tunnel use ssh and connect to localhost at port 7522:

ssh user@localhost -p 7722

(replace user with valid user name at remote teotun peer)

Created on July 27, 2015, 11:26 AM

#include <stdio.h>
#include <stdlib.h>
#include "ev_mgr.h"
#define TTUN_VERSION VERSION
#define TUN_PEER "teotun"
#define TUN_PEER_PORT 22
#define TUN_PORT 7522
size_t data_len, void *user_data) {
switch(event) {
// Calls immediately after event manager starts
{
// Tunnel parameters message
printf("The tunnel at port %d to port %d at %s peer was created\n",
// Create tunnel
}
break;
default:
break;
}
}
int main(int argc, char** argv) {
printf("Teotun example ver " TTUN_VERSION "\n");
// Initialize teonet event manager and Read configuration
// Start teonet
return (EXIT_SUCCESS);
}