libhcs
hcs_shares.h
Go to the documentation of this file.
1 
13 #ifndef HCS_SHARES
14 #define HCS_SHARES
15 
16 #include <gmp.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
26 typedef struct {
27  mpz_t *shares;
28  int *flag;
29  void **server_id;
30  unsigned long size;
31 } hcs_shares;
32 
39 hcs_shares* hcs_init_shares(unsigned long size);
40 
51 void hcs_set_share(hcs_shares *hs, mpz_t value, unsigned long index);
52 
60 void hcs_set_flag(hcs_shares *hs, unsigned long index);
61 
69 void hcs_clear_flag(hcs_shares *hs, unsigned long index);
70 
77 void hcs_toggle_flag(hcs_shares *hs, unsigned long index);
78 
86 int hcs_tst_flag(hcs_shares *hs, unsigned long index);
87 
93 void hcs_free_shares(hcs_shares *hs);
94 
95 #endif
96 
97 #ifdef __cplusplus
98 }
99 #endif
int hcs_tst_flag(hcs_shares *hs, unsigned long index)
Test if the server given by index is to be counted.
Stores a number of shares, with flags indicating if they are currently to be counted.
Definition: hcs_shares.h:26
unsigned long size
Number of shares in this array.
Definition: hcs_shares.h:30
void ** server_id
Optional id of each shares server.
Definition: hcs_shares.h:29
void hcs_toggle_flag(hcs_shares *hs, unsigned long index)
Toggle the flag on hs at index.
void hcs_free_shares(hcs_shares *hs)
Frees a hcs_shares and all associated memory.
void hcs_clear_flag(hcs_shares *hs, unsigned long index)
Clear the flag on hs at index.
int * flag
Flags corresponding to each value in shares.
Definition: hcs_shares.h:28
mpz_t * shares
An array of share values.
Definition: hcs_shares.h:27
void hcs_set_flag(hcs_shares *hs, unsigned long index)
Set the flag on hs at index.
hcs_shares * hcs_init_shares(unsigned long size)
Initialise a hcs_shares and return a pointer to the newly created structure.
void hcs_set_share(hcs_shares *hs, mpz_t value, unsigned long index)
Set a share value for the server given by id index.