File: CFireFlierClient.hh

package info (click to toggle)
fireflier 1.1.6-3etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 3,348 kB
  • ctags: 1,167
  • sloc: sh: 9,023; cpp: 8,370; makefile: 437; ansic: 300
file content (176 lines) | stat: -rw-r--r-- 5,175 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// generated 2002/9/29 23:16:46 CEST by triendl.kj@triendl.kj.(none)
// using glademm V1.1.0c
//
// newer (non customized) versions of this file go to CFireFlierClient.hh_new

// you might replace
//    class foo : public foo_glade { ... };
// by
//    typedef foo_glade foo;
// if you didn't make any modifications to the widget

#ifndef _CFIREFLIERCLIENT_HH
#define _CFIREFLIERCLIENT_HH

#include <gtkmm.h>
#include "CFireFlierClientApp.hh"
#include "CDlgAuthentication.hh"
#include "CDlgSrc.hh"
#include "CDlgIPTablesRules.hh"
#include "CDlgUSpaceRules.hh"
#include "CPacket.h"
#include "CResolverThread.h"
#include "dispatcher.h"
#include "fireflier.h"
#include "fireflierIO.h"
#include <map>
#include <list>

#ifdef WITHGCONF
#include "CGConf.h"
#endif


class CFireFlierClient: public Gtk::Window
{  
	Gtk::Tooltips m_tooltips;

protected:
	Gtk::MenuItem *m_menuItemViewSrc;
	Gtk::MenuItem *m_menuItemViewIPTablesRules;
	Gtk::MenuItem *m_menuItemViewUSpaceRules;
	Gtk::Toolbar *toolbarFireFlier;
	Gtk::Image *m_butViewSrc;
	Gtk::Image* m_butViewIPTablesRules;
	Gtk::Image* m_butViewUSpaceRules;
	Gtk::RadioButton *m_radioThisPacket;
	Gtk::RadioButton *m_radioQueuedPackets;
	Gtk::RadioButton *m_radioCreateRule;
	Gtk::Label *m_labelChain;
	Gtk::CheckButton *m_chkIPSrc;
	Gtk::Label *m_labelHostSrc;
	Gtk::CheckButton *m_chkPortSrc;
	Gtk::CheckButton *m_chkIFaceIn;
	Gtk::Label *m_labelMAC;
	Gtk::Label *m_labelLen;
	Gtk::Frame *m_frameSrc;
	Gtk::Combo *m_cbTimeout;
	Gtk::CheckButton *m_chkIPDst;
	Gtk::Label *m_labelHostDst;
	Gtk::CheckButton *m_chkPortDst;
	Gtk::CheckButton *m_chkIFaceOut;
	Gtk::CheckButton *m_chkProtocol;
	Gtk::Label *m_labelTCPFlags;
	Gtk::Frame *m_frameDst;
	Gtk::Frame* m_frameGeneral;
	Gtk::Frame* m_frameOptions;
	Gtk::Label *m_labelICMPType;
	Gtk::Label *m_labelTimestamp;
	Gtk::CheckButton *m_chkProgram;
	Gtk::CheckButton *m_chkTracking;
	Gtk::Button *m_butAccept;
	Gtk::Button *m_butDrop;
	Gtk::CheckMenuItem* m_menuItemDropInAuto;
	Gtk::CheckMenuItem* m_menuItemDropFwdAuto;
	Gtk::CheckMenuItem* m_menuItemDropOutAuto;
	Gtk::MenuItem* m_menuItemLogin;
	Gtk::Statusbar* m_pStatusbar;
	Gtk::Label* m_labelTimeout;
	
	Gtk::Label* m_labelChainValue;
	Gtk::Label* m_labelLenValue;
	Gtk::Label* m_labelMACValue;
	Gtk::Label* m_labelProgramValue;
	Gtk::Label* m_labelTimestampValue;
	Gtk::Label* m_labelTCPFlagsValue;
	Gtk::Label* m_labelICMPTypeValue;
	Gtk::Label* m_labelProtocolValue;
	Gtk::Label* m_labelIPSrcValue;
	Gtk::Label* m_labelIPDstValue;
	Gtk::Label* m_labelHostSrcValue;
	Gtk::Label* m_labelHostDstValue;
	Gtk::Label* m_labelPortSrcValue;
	Gtk::Label* m_labelPortDstValue;
	Gtk::Label* m_labelIFaceInValue;
	Gtk::Label* m_labelIFaceOutValue;
	Gtk::Label* m_labelTrackingValue;

private:	
	bool m_bAuthOpen;
	bool m_bProcessing;
	std::list <SigC::Connection> m_signalList;	// used to disconnect all
												// handler in dtor

	CResolverThread m_resSrcThread;
	CResolverThread m_resDstThread;

	Dispatcher1 <bool> m_signalConnection;
	Dispatcher1 <int> m_signalAuthentication;
	Dispatcher1 <CRefPtr <const CPacket> > m_signalPacketAvail;
	Dispatcher0 m_signalNetworkThreadFinished;
	Dispatcher2 <CffIO::pCffIOError, bool> m_signalNetworkThreadError;
	
	Dispatcher1 <const char*> m_signalResolvedSrc;
	Dispatcher1 <const char*> m_signalResolvedDst;

	CRefPtr <const CPacket> m_pCurPacket;
	std::map <Glib::ustring, guint32> m_mapTimeout;	// since the gtk-combo isnt able to provide the current selected element
									// (as i know by now), lets do it on our own..

	CDlgSrc m_dlgSrc;
	CDlgIPTablesRules m_dlgIPTablesRules;
	CDlgUSpaceRules m_dlgUSpaceRules;
#ifdef WITHGCONF
	CGConfUI m_gconfUI;
#endif


public:
	CFireFlierClient();
	virtual ~CFireFlierClient();
	
	
protected:
#ifdef WITHGCONF
	void on_value_changed(const ustring& strKey, const Gnome::Conf::Value& value);
	bool on_delete(GdkEventAny*);
	void save_pos_and_size();
	void on_quit();
#endif
	void initGUI();
	void setLabels();
	void activateInterface();
	void clearInterface();
	void on_sendCmd(ff::Commands enCmd);
#ifdef ALREADY_12
	void on_dropAuto_toggled(ff::Chains enChain);
#endif // ALREADY_12
	void on_menuItemAbout_activate();
	// handler for any checkbox and the time combo
	void on_Rule_compile(Gtk::CheckButton* EventSrc = NULL);
	void on_timeout_changed();
	void on_radioRuleCmds_toggled(ff::Rulecommands enCmd);
	void on_dropAuto_activate(ff::Chains);
	// handler for view src, iptablesrules and uspacerules
	void on_Request(ff::Commands enCmd);
	bool on_idle();
	void on_about();
	void on_login();

// signal handlers for the network thread
	void on_Packet_avail(CRefPtr <const CPacket>);
	void on_Src_avail(const char* szSource, int nLen);
	void on_IPTablesRules_avail(char* szMsg, int nLen);
	void on_Connection(bool bConnected);
	void on_Authentication(int nAuthenticated);
	void on_NetworkThread_finished();
	void on_networkthread_error(CffIO::pCffIOError pErr, bool bDisconnected);

// signal handlers for the resolver threads
	// must be a Label* because SigC::bind calls the desctructor of the bound element_type
	// and this does not work for a Label&
	void on_resolved(const char* szHostName, Gtk::Label* label);

public:
};
#endif