From e1196c0b284a51fda9f477aa6015647f59f29062 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Thu, 10 Jun 2004 07:49:50 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=3523 --- checkin_notes | 15 ++ client/gui_rpc_client.C | 37 ++++- client/gui_rpc_client.h | 2 + client/gui_test.C | 70 ++++++++- client/main.C | 2 +- client/stdafx.cpp | 21 +++ client/stdafx.h | 21 ++- lib/filesys.C | 1 + lib/parse.h | 3 +- win_build/RSAEuro.vcproj | 2 +- win_build/boinc.sln | 10 +- win_build/boinc_cli.vcproj | 2 +- win_build/boinc_dll.vcproj | 2 +- win_build/boinc_gui.vcproj | 10 +- win_build/boinc_guirpc_test.vcproj | 226 +++++++++++++++++++++++++++++ win_build/boinc_ss.vcproj | 2 +- win_build/upper_case.vcproj | 2 +- 17 files changed, 409 insertions(+), 19 deletions(-) create mode 100644 win_build/boinc_guirpc_test.vcproj diff --git a/checkin_notes b/checkin_notes index e7c5dee5cf..e85cae27c8 100755 --- a/checkin_notes +++ b/checkin_notes @@ -13201,3 +13201,18 @@ David 9 June 2004 explain_state.php info.php +Rom 9 June 2004 + - Put together the gui rpc testing application for Windows. + - Fix a bug or two with yesterdays checkin. + + client/ + gui_rpc_client.C, .h + gui_test.C + main.C + stdafx.cpp, .h + lib/ + filesys.C + parse.h + win_build/ + *.vcproj + \ No newline at end of file diff --git a/client/gui_rpc_client.C b/client/gui_rpc_client.C index da6d333d2e..fd156aa4c7 100644 --- a/client/gui_rpc_client.C +++ b/client/gui_rpc_client.C @@ -1,3 +1,27 @@ +// The contents of this file are subject to the BOINC Public License +// Version 1.0 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://boinc.berkeley.edu/license_1.0.txt +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is the Berkeley Open Infrastructure for Network Computing. +// +// The Initial Developer of the Original Code is the SETI@home project. +// Portions created by the SETI@home project are Copyright (C) 2002 +// University of California at Berkeley. All Rights Reserved. +// +// Contributor(s): +// + +#ifdef _WIN32 +#include "stdafx.h" +#endif + +#ifndef _WIN32 #include #include #include @@ -6,6 +30,7 @@ #include #include #include +#endif #include "parse.h" #include "error_numbers.h" @@ -16,16 +41,24 @@ int RPC_CLIENT::init(char* path) { sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(GUI_RPC_PORT); - addr.sin_addr.s_addr = htonl(INADDR_ANY); + addr.sin_addr.s_addr = inet_addr("127.0.0.1"); sock = socket(AF_INET, SOCK_STREAM, 0); retval = connect(sock, (const sockaddr*)(&addr), sizeof(addr)); if (retval) { + retval = WSAGetLastError(); perror("connect"); exit(1); } +#ifdef _WIN32 + fin = fdopen(dup(_open_osfhandle(sock, _O_RDONLY)), "r"); + fout = fdopen(_open_osfhandle(sock, _O_WRONLY), "w"); +#else fin = fdopen(dup(sock), "r"); fout = fdopen(sock, "w"); +#endif + + return 0; } RPC_CLIENT::~RPC_CLIENT() { @@ -35,7 +68,6 @@ RPC_CLIENT::~RPC_CLIENT() { int RPC_CLIENT::get_state() { char buf[256]; - int retval; PROJECT* project; fprintf(fout, "\n"); @@ -448,3 +480,4 @@ APP_VERSION* RPC_CLIENT::lookup_app_version(string& str, int version_num) { } return 0; } + diff --git a/client/gui_rpc_client.h b/client/gui_rpc_client.h index d1fb9be94f..60767f4445 100644 --- a/client/gui_rpc_client.h +++ b/client/gui_rpc_client.h @@ -17,12 +17,14 @@ // Contributor(s): // +#ifndef _WIN32 #include #include #include using std::string; using std::vector; +#endif #define GUI_RPC_PORT 31416 diff --git a/client/gui_test.C b/client/gui_test.C index 74d491b574..a0ea35afae 100644 --- a/client/gui_test.C +++ b/client/gui_test.C @@ -1,15 +1,70 @@ +// The contents of this file are subject to the BOINC Public License +// Version 1.0 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://boinc.berkeley.edu/license_1.0.txt +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is the Berkeley Open Infrastructure for Network Computing. +// +// The Initial Developer of the Original Code is the SETI@home project. +// Portions created by the SETI@home project are Copyright (C) 2002 +// University of California at Berkeley. All Rights Reserved. +// +// Contributor(s): +// + // gui_test: test program for BOINC GUI RPCs. // Does a single RPC and shows results +#ifdef _WIN32 +#include "stdafx.h" +#include "win_net.h" +#endif + +#ifndef _WIN32 #include +#endif #include "gui_rpc_client.h" +#include "error_numbers.h" + +#ifdef _WIN32 + +int WinsockInitialize() +{ + WSADATA wsdata; + return WSAStartup( MAKEWORD( 1, 1 ), &wsdata); +} + +int WinsockCleanup() +{ + return WSACleanup(); +} + +#endif + +int main(int argc, char** argv) { -main(int argc, char** argv) { RPC_CLIENT rpc; unsigned int i; vector message_descs; +#ifdef _WIN32 + // Initialize WinSock + if ( WinsockInitialize() != 0 ) { + printf( + "BOINC Core Client Error Message\n" + "Failed to initialize the Windows Sockets interface\n" + "Terminating Application...\n" + ); + return ERR_IO; + } +#endif + rpc.init("gui_rpc"); rpc.get_state(); rpc.print(); @@ -20,4 +75,17 @@ main(int argc, char** argv) { md.project.c_str(), md.priority, md.timestamp, md.body.c_str() ); } + +#ifdef _WIN32 + if ( WinsockCleanup() != 0 ) { + printf( + "BOINC Core Client Error Message\n" + "Failed to cleanup the Windows Sockets interface\n" + ); + return ERR_IO; + } +#endif + + return 0; } + diff --git a/client/main.C b/client/main.C index d72db5a638..a64f9984fe 100644 --- a/client/main.C +++ b/client/main.C @@ -350,7 +350,7 @@ int main(int argc, char** argv) { retval = boinc_main_loop(argc, argv); } - if ( WinsockInitialize() != 0 ) { + if ( WinsockCleanup() != 0 ) { printf( "BOINC Core Client Error Message\n" "Failed to cleanup the Windows Sockets interface\n" diff --git a/client/stdafx.cpp b/client/stdafx.cpp index a5c9cea300..7792b4d2ed 100644 --- a/client/stdafx.cpp +++ b/client/stdafx.cpp @@ -1,7 +1,28 @@ +// The contents of this file are subject to the BOINC Public License +// Version 1.0 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://boinc.berkeley.edu/license_1.0.txt +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is the Berkeley Open Infrastructure for Network Computing. +// +// The Initial Developer of the Original Code is the SETI@home project. +// Portions created by the SETI@home project are Copyright (C) 2002 +// University of California at Berkeley. All Rights Reserved. +// +// Contributor(s): +// + // stdafx.cpp : source file that includes just the standard includes // Test.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information +#ifdef _WIN32 #include "stdafx.h" +#endif diff --git a/client/stdafx.h b/client/stdafx.h index 89b468dc07..57db2d235a 100644 --- a/client/stdafx.h +++ b/client/stdafx.h @@ -1,9 +1,26 @@ +// The contents of this file are subject to the BOINC Public License +// Version 1.0 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://boinc.berkeley.edu/license_1.0.txt +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is the Berkeley Open Infrastructure for Network Computing. +// +// The Initial Developer of the Original Code is the SETI@home project. +// Portions created by the SETI@home project are Copyright (C) 2002 +// University of California at Berkeley. All Rights Reserved. +// +// Contributor(s): +// + // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, // but are changed infrequently -#pragma once - #ifndef _STDAFX_H_ #define _STDAFX_H_ diff --git a/lib/filesys.C b/lib/filesys.C index e07bb91ce3..868d0ece9f 100755 --- a/lib/filesys.C +++ b/lib/filesys.C @@ -404,6 +404,7 @@ int boinc_copy(const char* orig, const char* newf) { int boinc_rename(const char* old, const char* newf) { #ifdef _WIN32 + int retval=0; boinc_delete_file(newf); for (int i=0; i<5; i++) { retval = rename(old, newf); diff --git a/lib/parse.h b/lib/parse.h index ca3a7da7c9..6f65b3c091 100644 --- a/lib/parse.h +++ b/lib/parse.h @@ -17,11 +17,12 @@ // Contributor(s): // +#ifndef _WIN32 #include #include #include using namespace std; - +#endif extern bool parse(char* , char* ); extern bool parse_int(const char* buf, const char*tag, int&); diff --git a/win_build/RSAEuro.vcproj b/win_build/RSAEuro.vcproj index aace3bce1a..1fe85f36a2 100644 --- a/win_build/RSAEuro.vcproj +++ b/win_build/RSAEuro.vcproj @@ -28,7 +28,7 @@ PrecompiledHeaderFile=".\Build\Debug\RSAEuro\obj/RSAEuro.pch" AssemblerListingLocation=".\Build\Debug\RSAEuro\obj/" ObjectFile=".\Build\Debug\RSAEuro\obj/" - ProgramDataBaseFileName=".\Build\Debug\RSAEuro\obj/" + ProgramDataBaseFileName=".\Build\Debug\RSAEuro\obj/vc70.pdb" BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="TRUE" diff --git a/win_build/boinc.sln b/win_build/boinc.sln index e97198a5fb..f3e528e1ba 100644 --- a/win_build/boinc.sln +++ b/win_build/boinc.sln @@ -29,6 +29,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "upper_case", "upper_case.vc ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boinc_guirpc_test", "boinc_guirpc_test.vcproj", "{DA997BD1-B575-465C-9851-EEBB727F506A}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug @@ -59,8 +63,10 @@ Global {48FB07D8-6E26-4BB1-98AB-22001C0FB0FF}.Debug.Build.0 = Debug|Win32 {48FB07D8-6E26-4BB1-98AB-22001C0FB0FF}.Release.ActiveCfg = Release|Win32 {48FB07D8-6E26-4BB1-98AB-22001C0FB0FF}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionItems) = postSolution + {DA997BD1-B575-465C-9851-EEBB727F506A}.Debug.ActiveCfg = Debug|Win32 + {DA997BD1-B575-465C-9851-EEBB727F506A}.Debug.Build.0 = Debug|Win32 + {DA997BD1-B575-465C-9851-EEBB727F506A}.Release.ActiveCfg = Release|Win32 + {DA997BD1-B575-465C-9851-EEBB727F506A}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection diff --git a/win_build/boinc_cli.vcproj b/win_build/boinc_cli.vcproj index 8b9d63290e..af0868af2b 100644 --- a/win_build/boinc_cli.vcproj +++ b/win_build/boinc_cli.vcproj @@ -32,7 +32,7 @@ PrecompiledHeaderFile=".\Build\Debug\boinc_cli\obj/boinc_cli.pch" AssemblerListingLocation=".\Build\Debug\boinc_cli\obj/" ObjectFile=".\Build\Debug\boinc_cli\obj/" - ProgramDataBaseFileName=".\Build\Debug\boinc_cli\obj/" + ProgramDataBaseFileName=".\Build\Debug\boinc_cli\obj/vc70.pdb" BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="TRUE" diff --git a/win_build/boinc_dll.vcproj b/win_build/boinc_dll.vcproj index af10ff300f..933d557d2f 100644 --- a/win_build/boinc_dll.vcproj +++ b/win_build/boinc_dll.vcproj @@ -29,7 +29,7 @@ PrecompiledHeaderFile=".\Build\Debug\boinc_dll\obj/boinc_dll.pch" AssemblerListingLocation=".\Build\Debug\boinc_dll\obj/" ObjectFile=".\Build\Debug\boinc_dll\obj/" - ProgramDataBaseFileName=".\Build\Debug\boinc_dll\obj/" + ProgramDataBaseFileName=".\Build\Debug\boinc_dll\obj/vc70.pdb" BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="TRUE" diff --git a/win_build/boinc_gui.vcproj b/win_build/boinc_gui.vcproj index e7ad4308a7..a7dd60cbcc 100644 --- a/win_build/boinc_gui.vcproj +++ b/win_build/boinc_gui.vcproj @@ -104,7 +104,7 @@ PrecompiledHeaderFile=".\Build\Debug\boinc_gui\obj/boinc_gui.pch" AssemblerListingLocation=".\Build\Debug\boinc_gui\obj/" ObjectFile=".\Build\Debug\boinc_gui\obj/" - ProgramDataBaseFileName=".\Build\Debug\boinc_gui\obj/" + ProgramDataBaseFileName=".\Build\Debug\boinc_gui\obj/vc70.pdb" BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="TRUE" @@ -1366,10 +1366,10 @@ Name="Resource Files" Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> + RelativePath="..\client\win\res\boinc.bmp"> + RelativePath="..\client\win\boinc.bmp"> @@ -1389,10 +1389,10 @@ + RelativePath="..\client\win\boincsm.bmp"> + RelativePath="..\client\win\res\boincsm.bmp"> diff --git a/win_build/boinc_guirpc_test.vcproj b/win_build/boinc_guirpc_test.vcproj new file mode 100644 index 0000000000..80f7423ec0 --- /dev/null +++ b/win_build/boinc_guirpc_test.vcproj @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/win_build/boinc_ss.vcproj b/win_build/boinc_ss.vcproj index 123bc03746..e60bfc4555 100644 --- a/win_build/boinc_ss.vcproj +++ b/win_build/boinc_ss.vcproj @@ -30,7 +30,7 @@ PrecompiledHeaderFile=".\Build\Debug\boinc_ss\obj/boinc_ss.pch" AssemblerListingLocation=".\Build\Debug\boinc_ss\obj/" ObjectFile=".\Build\Debug\boinc_ss\obj/" - ProgramDataBaseFileName=".\Build\Debug\boinc_ss\obj/" + ProgramDataBaseFileName=".\Build\Debug\boinc_ss\obj/vc70.pdb" BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="TRUE" diff --git a/win_build/upper_case.vcproj b/win_build/upper_case.vcproj index a36d1d6aca..a77aae5dea 100644 --- a/win_build/upper_case.vcproj +++ b/win_build/upper_case.vcproj @@ -95,7 +95,7 @@ PrecompiledHeaderFile=".\Build\Debug\upper_case\obj/upper_case.pch" AssemblerListingLocation=".\Build\Debug\upper_case\obj/" ObjectFile=".\Build\Debug\upper_case\obj/" - ProgramDataBaseFileName=".\Build\Debug\upper_case\obj/" + ProgramDataBaseFileName=".\Build\Debug\upper_case\obj/vc70.pdb" BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="TRUE"