HEAD: rearrange things a bit so we can have a libwvbase.so, which contains
[wvapps.git] / wvipsec / wvesp.cc
blobf5f08f9d231bf9422d953b062f70a9a8bc91d26b
1 /*
2 * Net Integration Lame Duck Software:
3 * Copyright (C) 1997-2003 Net Integration Technologies, Inc.
4 *
5 * Classes for establishing an IPSec tunnel in userspace, reading to and
6 * from /dev/tun
7 */
9 #include "wvesp.h"
10 #include "wvcrypto.h"
11 #include "wvespstream.h"
12 #include "wvipsecguide.h"
14 WvEsp::WvEsp(WvIpSecGuide *_parent, WvConf &_cfg)
15 : cfg(_cfg), log("WvEsp", WvLog::Debug3)
17 log("Constructor()\n");
19 enc = dec = NULL;
20 tundev = NULL;
22 _parent->selectlist.append(&selectlist, false);
26 WvEsp::~WvEsp()
28 log("Destructor\n");
32 void WvEsp::tundev_callback(WvStream &s, void *unused)
34 log("tundev_callback\n");
39 void WvEsp::set_tundev(WvStream *_tundev)
41 log("set_tundev\n");
42 if (tundev)
44 selectlist.unlink(tundev);
45 tundev->setcallback(WvStreamCallback(), NULL);
46 tundev->queuemin(0);
49 // prepare new tunnel
50 tundev = _tundev;
51 if (tundev)
53 tundev->force_select(true, false, false);
54 tundev->queuemin(0);
55 tundev->setcallback(WvStreamCallback(this,
56 &WvEsp::tundev_callback), 0);
57 selectlist.append(tundev, false, "tun device");
62 void WvEsp::recv_handler()
64 log("recv_handler\n");
69 void WvEsp::send_handler()
71 log("send_handler\n");