mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-03 14:45:12 -04:00
Started implementation of ban list. For now, just gathers the list of banned IPs from
the DHT and is not used to reject IPs yet (the DHT list is, even if DHT is desactivated). Next steps: GUI with switch controls, exchange of IP ban lists between friends, handling IP ranges. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8297 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
5200f30a32
commit
047977b645
13 changed files with 337 additions and 204 deletions
53
libretroshare/src/retroshare/rsbanlist.h
Normal file
53
libretroshare/src/retroshare/rsbanlist.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* libretroshare/src/services/p3banlist.h
|
||||
*
|
||||
* Exchange list of Peers for Banning / Whitelisting.
|
||||
*
|
||||
* Copyright 2011 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
class RsBanList;
|
||||
extern RsBanList *rsBanList ;
|
||||
|
||||
class BanListPeer
|
||||
{
|
||||
public:
|
||||
|
||||
struct sockaddr_storage addr;
|
||||
uint8_t masked_bytes ;
|
||||
uint32_t reason; // Dup Self, Dup Friend
|
||||
int level; // LOCAL, FRIEND, FoF.
|
||||
time_t mTs;
|
||||
bool state ; // true=>active, false=>just stored but inactive
|
||||
};
|
||||
|
||||
class RsBanList
|
||||
{
|
||||
public:
|
||||
virtual bool isAddressAccepted(const struct sockaddr_storage& addr) =0;
|
||||
virtual void getListOfBannedIps(std::list<BanListPeer>& list) =0;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue