Mixe for Privacy and Anonymity in the Internet
CAIPList.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2000, The JAP-Team
3 All rights reserved.
4 Redistribution and use in source and binary forms, with or without modification,
5 are permitted provided that the following conditions are met:
6 
7  - Redistributions of source code must retain the above copyright notice,
8  this list of conditions and the following disclaimer.
9 
10  - Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation and/or
12  other materials provided with the distribution.
13 
14  - Neither the name of the University of Technology Dresden, Germany nor the names of its contributors
15  may be used to endorse or promote products derived from this software without specific
16  prior written permission.
17 
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
20 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
22 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
27 */
28 #ifndef __CA_IP_LIST
29 #define __CA_IP_LIST
30 #include "CAMutex.hpp"
31 
32 typedef struct _iplist_t IPLISTENTRY;
33 typedef struct _iplist_t* PIPLIST;
34 typedef volatile PIPLIST VOLATILE_PIPLIST;
35 
39 struct _iplist_t
40  {
42  UINT8 ip[2];
43  volatile UINT8 count;
44  };
45 
47 #define MAX_IP_CONNECTIONS CLIENTS_PER_IP
48 
61 class CAIPList
62  {
63  public:
64  CAIPList();
65  CAIPList(UINT32 allowedConnections);
66  ~CAIPList();
67  SINT32 insertIP(const UINT8 ip[4]);
68  SINT32 removeIP(const UINT8 ip[4]);
69  private:
72 #if defined (_DEBUG)
73  //used for 'encryption' of IP-address for privacy aware logging
74  UINT8* m_Random; //seems to be the best value for MD5, which operates on x*512-64 bit (52*8+4*8=512-64)
75 #endif
77 
78 
79  };
80 #endif
volatile PIPLIST VOLATILE_PIPLIST
Definition: CAIPList.hpp:34
struct _iplist_t * PIPLIST
Definition: CAIPList.hpp:33
signed int SINT32
Definition: basetypedefs.h:132
unsigned char UINT8
Definition: basetypedefs.h:135
unsigned int UINT32
Definition: basetypedefs.h:131
The purpose of this class is to store a list of IP-Addresses.
Definition: CAIPList.hpp:62
SINT32 insertIP(const UINT8 ip[4])
Inserts the IP-Address into the list.
Definition: CAIPList.cpp:103
~CAIPList()
Deletes the IPList and frees all used resources.
Definition: CAIPList.cpp:68
UINT32 m_allowedConnections
Definition: CAIPList.hpp:70
CAMutex * m_pMutex
Definition: CAIPList.hpp:76
volatile VOLATILE_PIPLIST * m_HashTable
Definition: CAIPList.hpp:71
CAIPList()
TODO: Fix LOG_TRAFFIC output which is not done anymore, as per default no log message are ommited....
Definition: CAIPList.cpp:39
SINT32 removeIP(const UINT8 ip[4])
Removes the IP-Address from the list.
Definition: CAIPList.cpp:189
This structure is used for building the IP-List.
Definition: CAIPList.hpp:40
UINT8 ip[2]
Next element, NULL if element is the last one.
Definition: CAIPList.hpp:42
VOLATILE_PIPLIST next
Definition: CAIPList.hpp:41
volatile UINT8 count
First two Bytes of the IP-Address.
Definition: CAIPList.hpp:43