/******************************************************************************* aiounicast_nonblock.hh, asynchronous unicast with nonblocking file descriptors This file is part of LibTMCG. Copyright (C) 2016, 2017, 2018, 2019 Heiko Stamer LibTMCG 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 2 of the License, or (at your option) any later version. LibTMCG 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 LibTMCG; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. *******************************************************************************/ #ifndef INCLUDED_aiounicast_nonblock_HH #define INCLUDED_aiounicast_nonblock_HH // C and STL header #include #include #include #include // GNU multiple precision library #include // GNU crypto library #include // abstract base class #include "aiounicast.hh" class aiounicast_nonblock : public aiounicast { private: size_t aio_schedule_current; size_t aio_schedule_buffer; size_t buf_in_size; std::vector buf_in, iv_out; std::vector buf_ptr; std::vector buf_flag; std::vector iv_flag_out, iv_flag_in; std::vector< std::list > buf_mpz; size_t maclen, keylen, blklen; std::vector mac_in, mac_out; std::vector mac_sqn_in, mac_sqn_out; std::vector enc_in, enc_out; public: std::vector bad_auth; aiounicast_nonblock (const size_t n_in, const size_t j_in, const std::vector &fd_in_in, const std::vector &fd_out_in, const std::vector &key_in, const size_t aio_default_scheduler_in = aio_scheduler_roundrobin, const time_t aio_default_timeout_in = aio_timeout_very_long, const bool aio_is_authenticated_in = true, const bool aio_is_encrypted_in = true, const bool aio_is_chunked_in = false); bool Send (mpz_srcptr m, const size_t i_in, time_t timeout = aio_timeout_default); bool Send (const std::vector &m, const size_t i_in, time_t timeout = aio_timeout_default); bool Receive (mpz_ptr m, size_t &i_out, size_t scheduler = aio_scheduler_default, time_t timeout = aio_timeout_default); bool Receive (std::vector &m, size_t &i_out, size_t scheduler = aio_scheduler_default, time_t timeout = aio_timeout_default); void Reset (const size_t i_in, const bool input); ~aiounicast_nonblock (); }; #endif