ZeroTierOne/netcon/NetconService.hpp

82 lines
1.9 KiB
C++
Raw Normal View History

2015-09-10 17:56:01 +00:00
/*
* ZeroTier One - Network Virtualization Everywhere
* Copyright (C) 2011-2015 ZeroTier, Inc.
*
* 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/>.
*
* --
*
* ZeroTier may be used and distributed under the terms of the GPLv3, which
* are available at: http://www.gnu.org/licenses/gpl-3.0.html
*
* If you would like to embed ZeroTier into a commercial application or
* redistribute it in a modified binary form, please contact ZeroTier Networks
* LLC. Start here: http://www.zerotier.com/
*/
#include <sys/poll.h>
#include <string>
2015-09-10 20:52:18 +00:00
#include "../osdep/Phy.hpp"
2015-09-11 00:02:13 +00:00
#include "NetconEthernetTap.hpp"
2015-09-10 20:52:18 +00:00
2015-09-10 17:56:01 +00:00
#include "Intercept.h"
#include "LWIPStack.hpp"
2015-09-11 00:02:13 +00:00
#ifndef _NETCON_SERVICE_HPP
#define _NETCON_SERVICE_HPP
2015-09-10 17:56:01 +00:00
using namespace std;
2015-09-10 20:52:18 +00:00
namespace ZeroTier {
2015-09-11 00:02:13 +00:00
class NetconEthernetTap;
2015-09-10 21:44:01 +00:00
// prototypes
class TcpConnection;
2015-09-10 20:52:18 +00:00
2015-09-23 19:23:26 +00:00
/*
*
2015-09-23 19:23:26 +00:00
*/
class TcpConnection
2015-09-10 20:52:18 +00:00
{
2015-09-10 21:44:01 +00:00
public:
2015-09-24 21:33:25 +00:00
int perceived_fd;
2015-09-10 20:52:18 +00:00
int their_fd;
bool pending;
PhySocket *rpcSock;
PhySocket *dataSock;
2015-09-10 20:52:18 +00:00
struct tcp_pcb *pcb;
2015-09-10 17:56:01 +00:00
unsigned char buf[DEFAULT_READ_BUFFER_SIZE];
int idx;
2015-09-10 20:52:18 +00:00
};
2015-09-10 17:56:01 +00:00
2015-09-23 19:23:26 +00:00
/*
* A helper class for passing a reference to _phy to LWIP callbacks as a "state"
2015-09-23 19:23:26 +00:00
*/
class Larg
2015-09-10 17:56:01 +00:00
{
2015-09-10 22:48:45 +00:00
public:
NetconEthernetTap *tap;
TcpConnection *conn;
Larg(NetconEthernetTap *_tap, TcpConnection *conn) : tap(_tap), conn(conn) {}
};
2015-09-10 20:52:18 +00:00
} // namespace ZeroTier
2015-09-11 00:02:13 +00:00
2015-09-10 17:56:01 +00:00
#endif