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/>.
|
2012-01-31 20:17:19 +01:00
|
|
|
#pragma once
|
2011-09-13 21:26:12 +02:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#include <sys/poll.h>
|
|
|
|
|
|
|
|
#include "ndppd.h"
|
|
|
|
|
2012-01-31 20:17:19 +01:00
|
|
|
NDPPD_NS_BEGIN
|
2011-09-13 21:26:12 +02:00
|
|
|
|
|
|
|
class iface;
|
|
|
|
class rule;
|
|
|
|
|
2012-02-03 14:29:37 +01:00
|
|
|
class proxy {
|
2011-09-13 21:26:12 +02:00
|
|
|
public:
|
2012-02-02 20:35:09 +01:00
|
|
|
static ptr<proxy> create(const ptr<iface>& ifa);
|
2011-09-13 21:26:12 +02:00
|
|
|
|
2012-02-02 20:35:09 +01:00
|
|
|
static ptr<proxy> open(const std::string& ifn);
|
2011-09-13 21:26:12 +02:00
|
|
|
|
2012-01-28 20:25:57 +01:00
|
|
|
void handle_solicit(const address& saddr, const address& daddr,
|
|
|
|
const address& taddr);
|
2011-09-13 21:26:12 +02:00
|
|
|
|
2012-02-02 20:35:09 +01:00
|
|
|
void remove_session(const ptr<session>& se);
|
2011-09-14 10:53:21 +02:00
|
|
|
|
2012-02-02 20:35:09 +01:00
|
|
|
ptr<rule> add_rule(const address& addr, const ptr<iface>& ifa);
|
2011-09-13 21:26:12 +02:00
|
|
|
|
2012-02-03 14:29:37 +01:00
|
|
|
ptr<rule> add_rule(const address& addr, bool aut = false);
|
2011-09-13 21:26:12 +02:00
|
|
|
|
2012-02-02 20:35:09 +01:00
|
|
|
const ptr<iface>& ifa() const;
|
2011-09-18 02:25:43 +02:00
|
|
|
|
2012-01-28 20:25:57 +01:00
|
|
|
bool router() const;
|
2011-09-18 02:25:43 +02:00
|
|
|
|
2012-01-28 20:25:57 +01:00
|
|
|
void router(bool val);
|
2017-07-01 09:28:39 +02:00
|
|
|
|
|
|
|
bool autowire() const;
|
|
|
|
|
|
|
|
void autowire(bool val);
|
2011-09-18 03:33:18 +02:00
|
|
|
|
2012-01-28 20:25:57 +01:00
|
|
|
int timeout() const;
|
2011-09-18 03:33:18 +02:00
|
|
|
|
2012-01-28 20:25:57 +01:00
|
|
|
void timeout(int val);
|
2011-09-18 03:33:18 +02:00
|
|
|
|
2012-01-28 20:25:57 +01:00
|
|
|
int ttl() const;
|
2011-09-18 03:33:18 +02:00
|
|
|
|
2012-01-28 20:25:57 +01:00
|
|
|
void ttl(int val);
|
2012-02-03 22:25:00 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
static std::list<ptr<proxy> > _list;
|
|
|
|
|
|
|
|
weak_ptr<proxy> _ptr;
|
|
|
|
|
|
|
|
ptr<iface> _ifa;
|
|
|
|
|
|
|
|
std::list<ptr<rule> > _rules;
|
|
|
|
|
|
|
|
std::list<ptr<session> > _sessions;
|
|
|
|
|
|
|
|
bool _router;
|
2017-07-01 09:28:39 +02:00
|
|
|
|
|
|
|
bool _autowire;
|
2012-02-03 22:25:00 +01:00
|
|
|
|
|
|
|
int _ttl, _timeout;
|
|
|
|
|
|
|
|
proxy();
|
2011-09-13 21:26:12 +02:00
|
|
|
};
|
|
|
|
|
2012-01-31 20:17:19 +01:00
|
|
|
NDPPD_NS_END
|