X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=tap-win32.c;h=df31fda49718f7d5eb8727c523da9fab9129386c;hb=a15167446259805dcd7e639261b2413e07654040;hp=8384952c6f9cf42ff6ed89dbb9c988ec5771c3c9;hpb=5fafdf24ef2c090c164d4dc89684b3f379dbdd87;p=qemu diff --git a/tap-win32.c b/tap-win32.c index 8384952..df31fda 100644 --- a/tap-win32.c +++ b/tap-win32.c @@ -24,9 +24,11 @@ * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING included with this * distribution); if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "vl.h" +#include "qemu-common.h" +#include "net.h" +#include "sysemu.h" #include #include @@ -74,7 +76,7 @@ // Compile time configuration //====================== -//#define DEBUG_TAP_WIN32 1 +//#define DEBUG_TAP_WIN32 #define TUN_ASYNCHRONOUS_WRITES 1 @@ -343,7 +345,7 @@ static int get_device_guid( 0, KEY_READ, &connection_key); - + if (status == ERROR_SUCCESS) { len = sizeof (name_data); status = RegQueryValueEx( @@ -467,7 +469,7 @@ static int tap_win32_write(tap_win32_overlapped_t *overlapped, result = WriteFile(overlapped->handle, buffer, size, &write_size, &overlapped->write_overlapped); - + if (!result) { switch (error = GetLastError()) { @@ -506,7 +508,7 @@ static DWORD WINAPI tap_win32_thread_entry(LPVOID param) result = GetOverlappedResult( overlapped->handle, &overlapped->read_overlapped, &read_size, FALSE); if (!result) { -#if DEBUG_TAP_WIN32 +#ifdef DEBUG_TAP_WIN32 LPVOID lpBuffer; dwError = GetLastError(); FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, @@ -517,7 +519,7 @@ static DWORD WINAPI tap_win32_thread_entry(LPVOID param) #endif } } else { -#if DEBUG_TAP_WIN32 +#ifdef DEBUG_TAP_WIN32 LPVOID lpBuffer; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), @@ -657,10 +659,11 @@ static void tap_win32_send(void *opaque) } } -int tap_win32_init(VLANState *vlan, const char *ifname) +int tap_win32_init(VLANState *vlan, const char *model, + const char *name, const char *ifname) { TAPState *s; - + s = qemu_mallocz(sizeof(TAPState)); if (!s) return -1; @@ -669,8 +672,8 @@ int tap_win32_init(VLANState *vlan, const char *ifname) return -1; } - s->vc = qemu_new_vlan_client(vlan, tap_receive, NULL, s); - + s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, NULL, s); + snprintf(s->vc->info_str, sizeof(s->vc->info_str), "tap: ifname=%s", ifname);