3 * Copyright (C) 2010 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 #include "heartbeat.h"
36 int cont
; /* Continue in tunnel processing ? 1 - yes / 0 - no */
38 int init (char *addr
, unsigned short port
, char *name
, char *pwd
)
40 if (tundev_init () == -1)
43 if (tunnel_init (addr
, port
, name
, pwd
) == -1)
46 if (ipv6_init () == -1)
49 if (tundev_setup () == -1)
52 if (heartbeat_init () == -1)
55 if (poll_init () == -1)
58 if (sig_init () == -1)
77 int syntax (char *bin
)
79 printf ("Syntax error\n\t%s: name password tunnel6server\n", bin
);
84 int main (int argc
, char **argv
)
86 printf ("TUNNEL6 client by ZeXx86\n");
92 /* tunnel server address */
95 unsigned short port
= DEFAULT_PORT
;
97 /* we've found config */
99 if (config_init () == -1) {
105 /* set config values */
108 server
= config
.server
;
113 /* set values from parameters */
119 port
= (unsigned short) atoi (argv
[4]);
122 printf ("User name: %s\n"
124 "Port: %u\n", name
, server
, port
);
126 /* Initialize routines */
127 if (init (server
, port
, name
, pwd
) == -1)
132 printf ("> closing tunnel\n");
134 /* disconnect from server */
135 proto_cmd_disconnect2 ();