/* * Input.h * */ #ifndef PROCESSOR_INPUT_H_ #define PROCESSOR_INPUT_H_ #include using namespace std; #include "Tools/Buffer.h" #include "Tools/time-func.h" #include "Tools/PointerVector.h" class ArithmeticProcessor; template class InputBase { typedef typename T::clear clear; Player* P; protected: Buffer buffer; Timer timer; public: vector os; int values_input; template static void input(SubProcessor& Proc, const vector& args, int size); static int get_player(SubProcessor& Proc, int arg, bool player_from_arg); static void input_mixed(SubProcessor& Proc, const vector& args, int size, bool player_from_reg); template static void prepare(SubProcessor& Proc, int player, const int* params, int size); template static void finalize(SubProcessor& Proc, int player, const int* params, int size); InputBase(ArithmeticProcessor* proc = 0); virtual ~InputBase(); virtual void reset(int player) = 0; void reset_all(Player& P); virtual void add_mine(const typename T::open_type& input, int n_bits = -1) = 0; virtual void add_other(int player) = 0; void add_from_all(const clear& input); virtual void send_mine() = 0; virtual void exchange(); virtual T finalize_mine() = 0; virtual void finalize_other(int player, T& target, octetStream& o, int n_bits = -1) = 0; T finalize(int player, int n_bits = -1); void raw_input(SubProcessor& proc, const vector& args, int size); }; template class Input : public InputBase { typedef typename T::open_type open_type; typedef typename T::clear clear; typedef typename T::MAC_Check MAC_Check; SubProcessor* proc; MAC_Check& MC; Preprocessing& prep; Player& P; vector< PointerVector > shares; open_type rr, t, xi; public: Input(SubProcessor& proc); Input(SubProcessor& proc, MAC_Check& mc); Input(SubProcessor* proc, Player& P); Input(MAC_Check& MC, Preprocessing& prep, Player& P); void reset(int player); void add_mine(const open_type& input, int n_bits = -1); void add_other(int player); void send_mine(); T finalize_mine(); void finalize_other(int player, T& target, octetStream& o, int n_bits = -1); }; #endif /* PROCESSOR_INPUT_H_ */