ndppd/src/proxy.h

78 lines
1.8 KiB
C
Raw Normal View History

2011-09-13 21:26:12 +02:00
// ndppd - NDP Proxy Daemon
2012-01-26 11:21:07 +01:00
// Copyright (C) 2011 Daniel Adolfsson <daniel@priv.nu>
2011-09-13 21:26:12 +02:00
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
2011-09-13 21:26:12 +02:00
#include <string>
#include <vector>
#include <map>
#include <sys/poll.h>
#include "ndppd.h"
NDPPD_NS_BEGIN
2011-09-13 21:26:12 +02:00
class iface;
class rule;
class proxy
{
private:
std::weak_ptr<proxy> _ptr;
std::shared_ptr<iface> _ifa;
2011-09-13 21:26:12 +02:00
std::list<std::shared_ptr<rule> > _rules;
2011-09-13 21:26:12 +02:00
std::list<std::shared_ptr<session> > _sessions;
2011-09-13 21:26:12 +02:00
bool _router;
int _ttl, _timeout;
proxy();
2011-09-13 21:26:12 +02:00
public:
static std::shared_ptr<proxy> create(const std::shared_ptr<iface>& ifa);
2011-09-13 21:26:12 +02:00
static std::shared_ptr<proxy> open(const std::string& ifn);
2011-09-13 21:26:12 +02:00
void handle_solicit(const address& saddr, const address& daddr,
const address& taddr);
2011-09-13 21:26:12 +02:00
void remove_session(const std::shared_ptr<session>& se);
2011-09-14 10:53:21 +02:00
std::shared_ptr<rule> add_rule(const address& addr, const std::shared_ptr<iface>& ifa);
2011-09-13 21:26:12 +02:00
std::shared_ptr<rule> add_rule(const address& addr);
2011-09-13 21:26:12 +02:00
const std::shared_ptr<iface>& ifa() const;
bool router() const;
void router(bool val);
int timeout() const;
void timeout(int val);
int ttl() const;
void ttl(int val);
2011-09-13 21:26:12 +02:00
};
NDPPD_NS_END