Mailinglist Archive: yast-commit (1212 mails)
| < Previous | Next > |
[yast-commit] r51688 - /trunk/pkg-bindings/src/Network.cc
- From: lslezak@xxxxxxxxxxxxxxxx
- Date: Tue, 30 Sep 2008 11:03:32 -0000
- Message-id: <20080930110332.302EA1D6A@xxxxxxxxxxxxxxxx>
Author: lslezak
Date: Tue Sep 30 13:03:31 2008
New Revision: 51688
URL: http://svn.opensuse.org/viewcvs/yast?rev=51688&view=rev
Log:
- added forgotten src/Network.cc file
Added:
trunk/pkg-bindings/src/Network.cc
Added: trunk/pkg-bindings/src/Network.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Network.cc?rev=51688&view=auto
==============================================================================
--- trunk/pkg-bindings/src/Network.cc (added)
+++ trunk/pkg-bindings/src/Network.cc Tue Sep 30 13:03:31 2008
@@ -0,0 +1,68 @@
+/*
------------------------------------------------------------------------------
+ * Copyright (c) 2008 Novell, Inc. All Rights Reserved.
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it
under
+ * the terms of version 2 of the GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, contact Novell, Inc.
+ *
+ * To contact Novell about this file by physical or electronic mail, you may
find
+ * current contact information at www.novell.com.
+ *
------------------------------------------------------------------------------
+ */
+
+/*
+ File: $Id: Source_Load.cc 49526 2008-07-30 13:28:18Z mvidner $
+ Author: Ladislav Slezák <lslezak@xxxxxxxxxx>
+ Summary: Network related functions
+ Namespace: Pkg
+*/
+
+
+#include <PkgFunctions.h>
+#include "log.h"
+
+// system()
+#include <cstdlib>
+
+#include <zypp/Url.h>
+
+/*
+ Textdomain "pkg-bindings"
+*/
+
+/*
+ A helper function
+ Detect whether there is a network connection.
+ See isNetworkRunning() function in NetworkService.ycp
+*/
+bool PkgFunctions::NetworkDetected()
+{
+ y2milestone("Checking the network status...");
+ int result = ::system("ip addr|grep -v 'inet6 ::1\\|inet6 fe80'|grep -c
inet6");
+ y2milestone("Network is running: %s", (result == 0) ? "yes" : "no");
+
+ return !result;
+}
+
+/*
+ A helper function
+ Is the URL remote?
+*/
+bool PkgFunctions::remoteRepo(const zypp::Url &url)
+{
+ // is it a remote repository?
+ std::string scheme(zypp::str::toLower(url.getScheme()));
+
+ y2debug("Repository schema: %s", scheme.c_str());
+
+ return (scheme == "ftp" || scheme == "http" || scheme == "https" || scheme
== "nfs"
+ || scheme == "smb");
+}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
Date: Tue Sep 30 13:03:31 2008
New Revision: 51688
URL: http://svn.opensuse.org/viewcvs/yast?rev=51688&view=rev
Log:
- added forgotten src/Network.cc file
Added:
trunk/pkg-bindings/src/Network.cc
Added: trunk/pkg-bindings/src/Network.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Network.cc?rev=51688&view=auto
==============================================================================
--- trunk/pkg-bindings/src/Network.cc (added)
+++ trunk/pkg-bindings/src/Network.cc Tue Sep 30 13:03:31 2008
@@ -0,0 +1,68 @@
+/*
------------------------------------------------------------------------------
+ * Copyright (c) 2008 Novell, Inc. All Rights Reserved.
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it
under
+ * the terms of version 2 of the GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, contact Novell, Inc.
+ *
+ * To contact Novell about this file by physical or electronic mail, you may
find
+ * current contact information at www.novell.com.
+ *
------------------------------------------------------------------------------
+ */
+
+/*
+ File: $Id: Source_Load.cc 49526 2008-07-30 13:28:18Z mvidner $
+ Author: Ladislav Slezák <lslezak@xxxxxxxxxx>
+ Summary: Network related functions
+ Namespace: Pkg
+*/
+
+
+#include <PkgFunctions.h>
+#include "log.h"
+
+// system()
+#include <cstdlib>
+
+#include <zypp/Url.h>
+
+/*
+ Textdomain "pkg-bindings"
+*/
+
+/*
+ A helper function
+ Detect whether there is a network connection.
+ See isNetworkRunning() function in NetworkService.ycp
+*/
+bool PkgFunctions::NetworkDetected()
+{
+ y2milestone("Checking the network status...");
+ int result = ::system("ip addr|grep -v 'inet6 ::1\\|inet6 fe80'|grep -c
inet6");
+ y2milestone("Network is running: %s", (result == 0) ? "yes" : "no");
+
+ return !result;
+}
+
+/*
+ A helper function
+ Is the URL remote?
+*/
+bool PkgFunctions::remoteRepo(const zypp::Url &url)
+{
+ // is it a remote repository?
+ std::string scheme(zypp::str::toLower(url.getScheme()));
+
+ y2debug("Repository schema: %s", scheme.c_str());
+
+ return (scheme == "ftp" || scheme == "http" || scheme == "https" || scheme
== "nfs"
+ || scheme == "smb");
+}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
| < Previous | Next > |