1 /* 2 * Copyright 2018 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef FCP_SECAGG_SERVER_SECAGG_SERVER_COMPLETED_STATE_H_ 18 #define FCP_SECAGG_SERVER_SECAGG_SERVER_COMPLETED_STATE_H_ 19 20 #include <memory> 21 #include <string> 22 23 #include "fcp/secagg/server/secagg_server_state.h" 24 #include "fcp/secagg/shared/secagg_vector.h" 25 26 namespace fcp { 27 namespace secagg { 28 29 // This class is the State for the SecAggServer after it has successfully 30 // completed the protocol. The server cannot transition out of this state; a new 31 // SecAggServer object will be needed to start a new run of the protocol. 32 // This state stores information about the final state of the protocol, such as 33 // the number of inputs included in the output. 34 35 class SecAggServerCompletedState : public SecAggServerState { 36 public: 37 SecAggServerCompletedState( 38 std::unique_ptr<SecAggServerProtocolImpl> impl, 39 int number_of_clients_failed_after_sending_masked_input, 40 int number_of_clients_failed_before_sending_masked_input, 41 int number_of_clients_terminated_without_unmasking); 42 43 ~SecAggServerCompletedState() override; 44 45 // Returns true. 46 bool IsCompletedSuccessfully() const override; 47 48 int NumberOfIncludedInputs() const override; 49 50 bool IsNumberOfIncludedInputsCommitted() const override; 51 52 StatusOr<std::unique_ptr<SecAggVectorMap> > Result() override; 53 }; 54 } // namespace secagg 55 } // namespace fcp 56 57 #endif // FCP_SECAGG_SERVER_SECAGG_SERVER_COMPLETED_STATE_H_ 58