seqWindow.h

Go to the documentation of this file.
00001 /*
00002  *  anytun
00003  *
00004  *  The secure anycast tunneling protocol (satp) defines a protocol used
00005  *  for communication between any combination of unicast and anycast
00006  *  tunnel endpoints.  It has less protocol overhead than IPSec in Tunnel
00007  *  mode and allows tunneling of every ETHER TYPE protocol (e.g.
00008  *  ethernet, ip, arp ...). satp directly includes cryptography and
00009  *  message authentication based on the methodes used by SRTP.  It is
00010  *  intended to deliver a generic, scaleable and secure solution for
00011  *  tunneling and relaying of packets of any protocol.
00012  *
00013  *
00014  *  Copyright (C) 2007 anytun.org <satp@wirdorange.org>
00015  *
00016  *  This program is free software; you can redistribute it and/or modify
00017  *  it under the terms of the GNU General Public License version 2
00018  *  as published by the Free Software Foundation.
00019  *
00020  *  This program is distributed in the hope that it will be useful,
00021  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  *  GNU General Public License for more details.
00024  *
00025  *  You should have received a copy of the GNU General Public License
00026  *  along with this program (see the file COPYING included with this
00027  *  distribution); if not, write to the Free Software Foundation, Inc.,
00028  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00029  */
00030 
00031 #ifndef _SEQ_WINDOW_H_
00032 #define _SEQ_WINDOW_H_
00033 
00034 #include <map>
00035 #include <deque>
00036 
00037 #include "threadUtils.hpp"
00038 #include "datatypes.h"
00039 
00040 class SeqWindow
00041 {
00042 public:
00043   typedef std::deque<seq_nr_t> SeqDeque;
00044   typedef std::map<sender_id_t, SeqDeque> SenderMap;
00045 
00046   SeqWindow(window_size_t w);
00047   ~SeqWindow();
00048 
00049   SeqDeque::size_type getLength(sender_id_t sender);
00050   bool hasSeqNr(sender_id_t sender, seq_nr_t seq);
00051   void addSeqNr(sender_id_t sender, seq_nr_t seq);
00052   void clear(sender_id_t sender);
00053   void clear();
00054 
00055 private:
00056   SeqWindow(const SeqWindow &s);
00057   void operator=(const SeqWindow &s);
00058 
00059   window_size_t window_size_;
00060   Mutex mutex_;
00061   SenderMap sender_;
00062 };
00063 
00064 #endif

Generated on Sun Oct 7 23:43:49 2007 for anytun by  doxygen 1.5.1