Confdump Agent  1.4.0
Win32Dumper.cpp
Go to the documentation of this file.
00001 /* 
00002  * Confdump-Agent - Dump static and runtime system configuration
00003  * Copyright (C) 2009-2012  Straton IT, SAS
00004  * 
00005  * This program is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 3 as
00007  * published by the Free Software Foundation.
00008  * 
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #include <winsock2.h>
00019 #include <iphlpapi.h>
00020 
00021 
00022 
00023 #include <algorithm>
00024 
00025 #include "boost/foreach.hpp"
00026 
00027 #include "QVariant"
00028 #include "QList"
00029 #include "QString"
00030 
00031 #include "Confdump/NoSuchTable.hpp"
00032 #include "Confdump/System/Win32Dumper.hpp"
00033 #include "Confdump/System/ManagedElement.hpp"
00034 #include "Confdump/System/Wmi/ComContext.hpp"
00035 #include "Confdump/System/Win32/Socket.hpp"
00036 #include "Confdump/System/Win32/ScheduledTask.hpp"
00037 
00038 using boost::shared_ptr;
00039 using Confdump::System::Wmi::ComContext;
00040 
00041 namespace Confdump
00042 {
00043 namespace System
00044 {
00045 
00046 Win32Dumper::Win32Dumper()
00047 {
00048 }
00049 
00050 Win32Dumper::~Win32Dumper()
00051 {
00052 }
00053 
00054 Result Win32Dumper::doQueryTable( QString table )
00055 {
00056         ComContext::Guard com = ComContext().getGuard();
00057         
00058     if ( table == "CD_Socket" )
00059         return Win32::BasicTcp4Socket::allSystemInstances();
00060     else if ( table == "CD_ScheduledTask" )
00061                 return Win32::ScheduledTask::allSystemInstances( com );
00062     else
00063         throw NoSuchTable( "No such Win32 table "+table, table );
00064 }
00065 
00066 QStringList Win32Dumper::doListTables()
00067 {
00068     QStringList tables;
00069     tables << "CD_Socket"
00070            << "CD_ScheduledTask";
00071     return tables;
00072 }
00073 
00074 }
00075 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends