James Yonan
3bcf8743c1
More conversions of threads/mutexes from boost to C++11 std.
...
As part of this work, removed openvpn/common/thread.hpp
2015-05-10 20:04:22 -06:00
James Yonan
7a6053f4b5
class RC: redefined thread_safe_refcount in a C++11 way.
2015-05-10 15:33:06 -06:00
James Yonan
e7b3af3e01
class Base64: added encode() method that accepts a raw unsigned
...
char * buffer.
2015-05-10 15:30:30 -06:00
James Yonan
6baf23462f
Added render_hex_sep() method that allows a separator between
...
each byte.
2015-05-01 13:41:25 -06:00
James Yonan
d441693725
Added a second SetUserGroup constructor that accepts std::string
...
arguments instead of const char *. Made both constructors
explicit.
2015-04-30 10:34:07 -06:00
James Yonan
36576a26c5
Break up existing daemonize() method into two methods:
...
1. log_setup -- redirect stdin/stdout/stderr
2. daemonize -- actually call daemon()
For compatibility, the old daemonize() method is still
available and is now internally composed using the new
methods.
2015-04-30 10:29:51 -06:00
James Yonan
6b8d51e5d9
Added event_loop_wait_barrier().
2015-04-25 10:09:08 -06:00
James Yonan
46498b6bbf
Refactored RunContext to eliminate possibility of race between
...
set_thread and set_server.
2015-04-25 10:03:33 -06:00
James Yonan
709486cd1a
Added some extra logging to RunContext::do_cancel() to show
...
number of threads we called thread_safe_stop() on compared
to the total number of threads.
2015-04-24 01:26:42 -06:00
James Yonan
c7bc3aff22
Don't use #include <cassert>, instead throw Exception()
...
instead of assert().
2015-04-24 01:24:48 -06:00
James Yonan
0fde33173a
C++11 update: mass replace of boost::uint/int to std::uint/int.
2015-04-23 17:55:07 -06:00
James Yonan
a51c0bf0bf
Mostly complete transition from boost::thread to std::thread.
2015-04-23 17:07:56 -06:00
James Yonan
89cf6bb369
Changed BOOST_ASSERT usage to assert() (#include <cassert>).
2015-04-23 15:42:12 -06:00
James Yonan
36550cd35e
Update to C++11 noncopyable semantics.
...
Instead of inheriting from boost::noncopyable,
use the C++11 delete qualifier:
Class(const Class&) = delete;
Class& operator=(const Class&) = delete;
2015-04-23 15:10:43 -06:00
James Yonan
f12c2ab7eb
C++11 update -- in rc.hpp, change boost::detail::atomic_count
...
to std::atomic<long>.
2015-04-23 14:37:28 -06:00
James Yonan
9d9c51d6f4
C++11 update -- converted boost::unordered_map usage to
...
std::unordered_map.
2015-04-23 14:08:54 -06:00
James Yonan
4b02f237eb
minor C++11 update: Changed BOOST_STATIC_ASSERT to static_assert.
2015-04-23 13:03:09 -06:00
James Yonan
069de90ffd
minor C++11 updates:
...
* rename BOOST_NOEXCEPT to noexcept
* verify that certain classes are noexcept move constructable
including Option, Buffer, BufferAllocated, RunContext::Thread
2015-04-23 12:49:25 -06:00
James Yonan
95e11e9172
Added openvpn/common/stat.hpp with file_exists() method.
2015-04-22 17:53:12 -06:00
James Yonan
b27ce6ad93
New string methods:
...
string::unix2dos() -- convert \n to \r\n
string::split_host_port() -- split host:port
2015-04-22 01:51:57 -06:00
James Yonan
d6fa2307b1
Use a switch in string::is_space().
2015-04-22 01:51:07 -06:00
James Yonan
664b276716
render_hex() methods now take an optional caps argument to
...
control whether hex chars a-f are rendered as lowercase or
uppercase.
Renamed the template form of render_hex() to render_hex_generic(),
to avoid ambiguity from new caps parameter.
2015-04-21 00:42:15 -06:00
James Yonan
1e54bba2bc
Added ServerThreadBase to runcontext.hpp.
2015-04-19 11:20:47 -06:00
James Yonan
7b4d98d1eb
Added missing include to asiodispatch.hpp.
2015-04-15 22:18:32 -06:00
James Yonan
d1bd2d8d3c
Added operator[] to ScopedPtr.
2015-04-12 10:52:59 -06:00
James Yonan
6f35bbd9d1
Extend daemonize() to do initial log rotate.
2015-04-09 21:45:19 -06:00
James Yonan
f2d03f292a
Added string::replace_spaces method.
2015-04-09 15:22:38 -06:00
James Yonan
a206d08820
Added OptionList::get_optional_noexcept method.
2015-04-09 15:21:56 -06:00
James Yonan
1d6096609b
Added additional parse_user_pass() convenience method.
2015-03-27 01:20:30 -06:00
James Yonan
688588bd12
Added sockopt.hpp with common setsockopt functions
...
(reuseport, reuseaddr, tcp_nodelay).
2015-03-19 14:04:31 -06:00
James Yonan
f683eca1d7
Added SignalBlockerDefault to handle common usage case.
2015-03-19 13:58:31 -06:00
James Yonan
987867082c
Use C++11 std::thread (instead of boost::thread) if USE_STD_THREAD
...
if defined.
2015-03-19 13:56:38 -06:00
James Yonan
d1072035b3
Added openvpn/common/inotify.hpp.
...
Created initial method INotify::mask_to_string() to convert
an inotify mask to a human-readable string for debugging.
2015-02-10 15:58:58 -07:00
James Yonan
c8ffeea283
Added string::len_without_trailing_nulls method.
2015-02-10 15:57:42 -07:00
James Yonan
26b792436a
Added ScopedFD::reset() method.
2015-02-10 15:57:09 -07:00
James Yonan
58031408d7
ScopedFD::close() should not be virtual.
2015-02-10 15:56:49 -07:00
James Yonan
01a381ef44
Added nondigit_term bool to parse_number() to allow parsing
...
of numbers that are terminated by non-number chars. Previously
only '\0' could terminate a number.
2015-02-10 15:55:32 -07:00
James Yonan
2226a34850
In asiodispatch.hpp, added dispatcher for asio async_read
...
without argument: asio_dispatch_read_noarg().
2015-02-10 15:54:34 -07:00
James Yonan
90d98c8fac
class OptionList now inherits from RCCopyable.
2015-02-03 17:34:13 -07:00
James Yonan
d5f249b3a4
Added class RunContext for managing threads in a
...
multi-threaded server.
2015-02-01 01:48:18 -07:00
James Yonan
169612f842
Add virtual void post_close() method to ScopedFD so derived
...
classes can do post-close actions.
2015-01-24 20:07:36 -07:00
James Yonan
79b9deb2bc
Added SIGUSR1/SIGUSR2 to class ASIOSignals.
...
Also added register_signals_all() method.
2015-01-16 01:52:59 -07:00
James Yonan
69d0a9cefb
Added SetUserGroup class for downgrading UID/GID.
2015-01-14 23:50:40 -07:00
James Yonan
fbfc84f460
Refactored PThreadCond and added PThreadBarrier for cases
...
where all threads need to reach a known point before
executing some action.
2015-01-14 23:17:20 -07:00
James Yonan
8d61382731
Core version number updated to 3.0.3.
2015-01-14 12:12:34 -07:00
James Yonan
915d0220a4
Added methods for daemonization and redirecting stdout/stderr
...
to a log file.
2015-01-13 23:18:57 -07:00
James Yonan
e0910bf6c4
Added PolarSSL AuthCert support (server-side only).
2015-01-12 23:20:23 -07:00
James Yonan
e817a9dc0b
Added dump_hex methods.
2015-01-12 23:16:51 -07:00
James Yonan
9004e8cbea
Added PThreadCond, a wrapper for pthread conditions.
2015-01-12 18:39:32 -07:00
James Yonan
58de6a371d
Added class OptionList convenience method get_num()
...
with range checking.
2015-01-12 18:35:53 -07:00