0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 04:02:15 +02:00

server APIs : added set_acl_id(), set_fwmark(), and changed

the signature of push_reply().
This commit is contained in:
James Yonan 2016-08-17 11:36:34 -07:00
parent a9d3f90f86
commit 5957ab8af1
3 changed files with 31 additions and 6 deletions

View File

@ -70,6 +70,12 @@ namespace openvpn {
// send control channel message
virtual void post_info_user(BufferPtr&& info) = 0;
// set ACL ID for user
virtual void set_acl_id(const unsigned int acl_id,
const std::string* username,
const bool challenge,
const bool throw_on_error) = 0;
};
// Base class for the client instance receiver. Note that all
@ -86,8 +92,9 @@ namespace openvpn {
virtual void auth_failed(const std::string& reason,
const bool tell_client) = 0;
virtual void push_reply(BufferPtr&& push_data,
const std::vector<IP::Route>& routes) = 0;
virtual void push_reply(std::vector<BufferPtr>&& push_msgs,
const std::vector<IP::Route>& routes,
const unsigned int initial_fwmark) = 0;
// push a halt or restart message to client
virtual void push_halt_restart_msg(const HaltRestart::Type type,
@ -98,6 +105,9 @@ namespace openvpn {
// send control channel message
virtual void post_info(BufferPtr&& info) = 0;
// set fwmark value in client instance
virtual void set_fwmark(const unsigned int fwmark) = 0;
// get client bandwidth stats
virtual PeerStats stats_poll() = 0;
};

View File

@ -362,8 +362,15 @@ namespace openvpn {
push_halt_restart_msg(HaltRestart::AUTH_FAILED, reason, tell_client);
}
virtual void push_reply(BufferPtr&& push_data,
const std::vector<IP::Route>& rtvec)
virtual void set_fwmark(const unsigned int fwmark)
{
if (TunLink::send)
TunLink::send->set_fwmark(fwmark);
}
virtual void push_reply(std::vector<BufferPtr>&& push_msgs,
const std::vector<IP::Route>& rtvec,
const unsigned int initial_fwmark)
{
if (halt)
return;
@ -371,9 +378,14 @@ namespace openvpn {
if (get_tun())
{
Base::init_data_channel();
if (initial_fwmark)
TunLink::send->set_fwmark(initial_fwmark);
TunLink::send->add_routes(rtvec);
push_data->null_terminate();
Base::control_send(std::move(push_data));
for (auto &msg : push_msgs)
{
msg->null_terminate();
Base::control_send(std::move(msg));
}
Base::flush(true);
set_housekeeping_timer();
}

View File

@ -69,6 +69,9 @@ namespace openvpn {
// add routes
virtual void add_routes(const std::vector<IP::Route>& rtvec) = 0;
// set fwmark
virtual void set_fwmark(const unsigned int fwmark) = 0;
virtual const std::string& tun_info() const = 0;
};