Voting Coordinator

typedef struct Voting_Coordinator_s* Voting_Coordinator

Initialization and Freeing

struct Voting_Coordinator_new_r Voting_Coordinator_new(uint32_t num_selections)

Create a new voting coordinator.

struct Voting_Coordinator_new_r

Public Members

Voting_Coordinator_status status
Voting_Coordinator coordinator
void Voting_Coordinator_free(Voting_Coordinator coordinator)

Free a ballot box.

Registering, Casting and Spoiling Ballots

enum Voting_Coordinator_status Voting_Coordinator_register_ballot(Voting_Coordinator coordinator, struct register_ballot_message message)

Register a ballot with the coordinator so that it may be cast or spoiled.

enum Voting_Coordinator_status Voting_Coordinator_cast_ballot(Voting_Coordinator coordinator, struct ballot_identifier ballot_id)

Mark the ballot specified by ballot_id as cast.

enum Voting_Coordinator_status Voting_Coordinator_spoil_ballot(Voting_Coordinator coordinator, struct ballot_identifier ballot_id)

Mark the ballot specified by ballot_id as spoiled.

Exporting Ballots

enum Voting_Coordinator_status Voting_Coordinator_export_ballots(Voting_Coordinator coordinator, FILE * out)

Write all of the cast and spoiled ballots to out.

Status Codes

enum Voting_Coordinator_status

Values:

VOTING_COORDINATOR_SUCCESS
VOTING_COORDINATOR_INSUFFICIENT_MEMORY
VOTING_COORDINATOR_INVALID_BALLOT_ID
VOTING_COORDINATOR_INVALID_BALLOT
VOTING_COORDINATOR_UNREGISTERED_BALLOT
VOTING_COORDINATOR_DUPLICATE_BALLOT
VOTING_COORDINATOR_TIMED_OUT_BALLOT
VOTING_COORDINATOR_IO_ERROR
VOTING_COORDINATOR_SERIALIZE_ERROR
VOTING_COORDINATOR_DESERIALIZE_ERROR