ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/vendor/pxys2-2.0.0/pxyscand/src/PXScanModule.h
Revision: 3252
Committed: Wed Apr 2 20:41:43 2014 UTC (11 years, 4 months ago) by michael
Content type: text/x-chdr
File size: 2873 byte(s)
Log Message:
- Imported pxys2-2.0.0

File Contents

# Content
1 // Copyright (C) 2003 Stephane Thiell
2 //
3 // This file is part of pxyscand (from pxys)
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 //
19 // $Id: PXScanModule.h,v 1.2 2004/01/01 02:18:10 mbuna Exp $
20 //
21 #ifndef INCLUDED_PXSCANMODULE_H_
22 #define INCLUDED_PXSCANMODULE_H_
23
24 #include <fstream>
25 #include <cstdlib>
26 #include <ctime>
27
28 #include <sys/types.h>
29 #include <sys/socket.h>
30 #include <netinet/in.h>
31
32 #include <opas/opas.h>
33
34 using std::ofstream;
35
36 class PXScan;
37
38 class PXScanModule
39 {
40 public:
41 PXScanModule(PXScan *inScan);
42 virtual ~PXScanModule();
43
44 // Module interface (implement this when you create a new module)
45
46 // You're advised to override this and call RegisterPXM() to enable stats
47 virtual void InitModule() {}
48
49 // You only need to implement this to start the scan (see examples...)
50 virtual bool StartScan() = 0;
51
52 // --End of interface--
53
54 // Recommended call in InitModule() (will enable stats for this module)
55
56 void RegisterPXM(const char *inShortName, uint16_t inPort,
57 uint32_t *inConnCountPtr, uint32_t *inProxyCountPtr) const;
58
59 // Utilities available for modules
60
61 virtual in_addr GetAddress() const;
62
63 virtual bool IsLocalAddressSet() const;
64 virtual in_addr GetLocalAddress() const;
65
66 virtual time_t GetTimeout() const;
67
68 // You can use this target to perform your proxy scan
69 virtual in_addr GetTargetAddress() const;
70 virtual uint16_t GetTargetPort() const;
71
72 // Special for http proxy agent logging
73 virtual bool LogAgent() const;
74 virtual ofstream& GetFAgent();
75
76 // To check if a string comes from the target (if yes it's a proxy)
77 virtual bool ScannerStringCheck(const char *s);
78
79 // Finally, the result methods.. A scan modules should reply
80 // (asynchronously) one of the 3 following methods
81
82 // Not found.
83 virtual void ProxyNotFound();
84 // Proxy found, fill the info.
85 virtual void ProxyFound(uint16_t inTypeOfProxy, uint16_t inPort,
86 const char *inDescr);
87 // An fatal error occured (usually only ENETUNREACH)
88 virtual void ScanError(int error);
89
90 private:
91 PXScan *mScan; // Opaque scan object, do not use.
92 };
93
94 #endif // INCLUDED_PXSCANMODULE_H_