ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/device-tincd.C
(Generate patch)

Comparing gvpe/src/device-tincd.C (file contents):
Revision 1.5 by pcg, Thu Oct 16 13:37:10 2003 UTC vs.
Revision 1.11 by pcg, Thu Sep 30 12:46:16 2004 UTC

1/* 1/*
2 device-tincd.C -- include one of the tincd low level implementations. 2 device-tincd.C -- include one of the tincd low level implementations.
3 Copyright (C) 2003 Marc Lehmann <pcg@goof.com> 3 Copyright (C) 2003-2004 Marc Lehmann <pcg@goof.com>
4 4
5 This program is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
67// will be casted to data_packet, due to structural similarity 67// will be casted to data_packet, due to structural similarity
68struct vpn_packet_t : net_packet { 68struct vpn_packet_t : net_packet {
69 u8 data[MAXSIZE]; 69 u8 data[MAXSIZE];
70}; 70};
71 71
72static tap_device *self;
73
74static bool overwrite_mac; 72static bool overwrite_mac;
75 73
76static bool 74static bool
77get_config_string(const char *key, char **res) 75get_config_string(const char *key, char **res)
78{ 76{
91 89
92#define netname conf.ifname 90#define netname conf.ifname
93 91
94#if IF_linux 92#if IF_linux
95# include "tincd/linux/device.c" 93# include "tincd/linux/device.c"
94
96#elif IF_freebsd 95#elif IF_freebsd
97# include "tincd/freebsd/device.c" 96# include "tincd/freebsd/device.c"
97
98#elif IF_netbsd 98#elif IF_netbsd
99#define IF_istun 1 99# define IF_istun 1
100# include "tincd/netbsd/device.c" 100# include "tincd/netbsd/device.c"
101
102#elif IF_openbsd
103# define IF_istun 1
104# include "tincd/openbsd/device.c"
105
101#elif IF_solaris 106#elif IF_solaris
107# define IF_istun 1
102# include "tincd/solaris/device.c" 108# include "tincd/solaris/device.c"
109
103#elif IF_cygwin 110#elif IF_cygwin
104# include "tincd/cygwin/device.c" 111# include "tincd/cygwin/device.c"
112
105#elif IF_mingw 113#elif IF_mingw
106# include "tincd/mingw/device.c" 114# include "tincd/mingw/device.c"
115
107#elif IF_darwin 116#elif IF_darwin
108#define IF_istun 1 117# define IF_istun 1
109# include "tincd/darwin/device.c" 118# include "tincd/darwin/device.c"
119
110#elif IF_raw_socket 120#elif IF_raw_socket
111#define IF_istun 1 121# define IF_istun 1
112# include "tincd/raw_socket/device.c" 122# include "tincd/raw_socket/device.c"
123
113#else 124#else
114# error No interface implementation for your IFTYPE/IFSUBTYPE combination. 125# error No interface implementation for your IFTYPE/IFSUBTYPE combination.
115#endif 126#endif
116 127
117#if IF_istun 128#if IF_istun
124 return _("tincd compatibility layer"); 135 return _("tincd compatibility layer");
125} 136}
126 137
127tap_device::tap_device () 138tap_device::tap_device ()
128{ 139{
129 self = this; 140 device = "(null)";
130 141
131 if (setup_device ()) 142 if (setup_device ())
132 { 143 {
133 //slog (L_DEBUG, _("%s is a %s"), device, info ()); 144 slog (L_DEBUG, _("interface %s on %s initialized"), info (), device);
134 fd = device_fd; 145 fd = device_fd;
135 strcpy (ifrname, iface); 146 strcpy (ifrname, iface);
136 } 147 }
137 else 148 else
138 { 149 {
139 slog (L_ERR, _("error while configuring tincd device (%s/%s)"), device, info ()); 150 slog (L_ERR, _("error while configuring tincd device %s on %s"), info (), device);
140 exit (1); 151 exit (EXIT_FAILURE);
141 } 152 }
142} 153}
143 154
144tap_device::~tap_device () 155tap_device::~tap_device ()
145{ 156{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines