2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 $Date: 2009/06/23 11:32:27 $
24 * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
39 #include <sys/inttypes.h>
42 #include "base_plugin.h"
43 #include "base_settings.h"
44 #include "../../../traffcounter.h"
48 extern "C" BASE_PLUGIN * GetPlugin();
50 #define BUFF_LEN (128)
52 //-----------------------------------------------------------------------------
61 memset(buffer, 0, BUFF_LEN);
65 //memset(&polld, 0, sizeof(pollfd));
68 BPF_DATA(const BPF_DATA & bd)
74 memcpy(buffer, bd.buffer, BUFF_LEN);
78 //memcpy(&polld, &bd.polld, sizeof(pollfd));
85 uint8_t buffer[BUFF_LEN];
91 //-----------------------------------------------------------------------------
92 class BPF_CAP_SETTINGS
95 virtual ~BPF_CAP_SETTINGS(){};
96 const string& GetStrError() const { return errorStr; }
97 int ParseSettings(const MODULE_SETTINGS & s);
98 string GetIface(unsigned int num);
101 vector<string> iface;
102 mutable string errorStr;
104 //-----------------------------------------------------------------------------
105 class BPF_CAP :public BASE_PLUGIN
109 virtual ~BPF_CAP(){};
111 void SetUsers(USERS *){};
112 void SetTariffs(TARIFFS *){};
113 void SetAdmins(ADMINS *){};
114 void SetTraffcounter(TRAFFCOUNTER * tc);
115 void SetStore(BASE_STORE *){};
116 void SetStgSettings(const SETTINGS *){};
120 int Reload() { return 0; };
123 void SetSettings(const MODULE_SETTINGS & s);
126 const string & GetStrError() const;
127 const string GetVersion() const;
128 uint16_t GetStartPosition() const;
129 uint16_t GetStopPosition() const;
132 static void * Run(void *);
134 //int BPFCapOpen(int n);
135 int BPFCapOpen(BPF_DATA * bd);
137 int BPFCapRead(char * buffer, int blen, char ** iface);
138 int BPFCapRead(char * buffer, int blen, char ** iface, BPF_DATA * bd);
140 BPF_CAP_SETTINGS capSettings;
142 mutable string errorStr;
144 vector<BPF_DATA> bpfData;
145 vector<pollfd> polld;
151 MODULE_SETTINGS settings;
153 TRAFFCOUNTER * traffCnt;
155 //-----------------------------------------------------------------------------