00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _FRDI_STRUCT_H
00024 #define _FRDI_STRUCT_H
00025
00026 #include "frdi_defines.h"
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096 struct card_struct
00097 {
00098 char suit;
00099 char pips;
00100 };
00101
00102 typedef struct card_struct card;
00103
00104 struct deck_struct
00105 {
00106 card cards[FRDI_STANDARD_DECK_SIZE];
00107 };
00108
00109 typedef struct deck_struct deck;
00110
00111 typedef mpz_t frdi_bigint;
00112
00113
00114
00115
00116 struct frdi__seed
00117 {
00118 gmp_randstate_t state;
00119 };
00120
00121 typedef struct frdi__seed frdi_seed;
00122
00123
00124
00125
00126
00127
00128
00129
00132 typedef void *(*frdi_thread_function)(void *);
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142 struct frdi__handler
00143 {
00144 void *(*handler_function)(void *);
00145 char *name;
00146 char *arg_type;
00147 char *ret_type;
00148 };
00149
00150 typedef struct frdi__handler frdi_handler;
00151
00152
00153 struct frdi__log
00154 {
00155 FILE *log_file;
00156 int flag_time;
00157 int flag_app;
00158 int flag_link;
00159 int flag_text;
00160 int flag_byte;
00161 int flag_thread;
00162 int verbose;
00163 pthread_mutex_t log_file_m;
00164 };
00165
00166 typedef struct frdi__log frdi_log;
00167
00168
00169 struct frdi__exception
00170 {
00171 jmp_buf location;
00172 int err_num;
00173 char *message;
00174 struct frdi__exception *parent;
00175 frdi_handler *handler;
00176 frdi_log *log;
00177 };
00178
00179 typedef struct frdi__exception frdi_exception;
00180
00181
00182
00183
00184
00185
00186
00187
00188 struct frdi__list_node
00189 {
00190 void *value;
00191 int size;
00192 struct frdi__list_node *last;
00193 struct frdi__list_node *next;
00194 frdi_handler *string;
00195 frdi_handler *free;
00196 };
00197
00198 typedef struct frdi__list_node frdi_list_node;
00199
00200
00201 struct frdi__list
00202 {
00203 int size;
00204 frdi_exception *eh;
00205 frdi_list_node *start;
00206 frdi_list_node *finish;
00207 frdi_handler *string;
00208 frdi_handler *free;
00209 };
00210
00211 typedef struct frdi__list frdi_list;
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221 struct frdi__dict
00222 {
00223 int size;
00224 frdi_exception *eh;
00225 frdi_list *keys;
00226 frdi_list *values;
00227 frdi_handler *key_string;
00228 frdi_handler *key_free;
00229 frdi_handler *value_string;
00230 frdi_handler *value_free;
00231 };
00232
00233 typedef struct frdi__dict frdi_dict;
00234
00235
00236
00237
00238
00239
00240
00241
00242 struct frdi__config
00243 {
00244 char *id;
00245 char *timestamp;
00246 char *version;
00247 char *client;
00248 char *server;
00249 int userport;
00250 int clientport;
00251 int serverport;
00252 int hostport;
00253 int verbose;
00254 char *name;
00255 char *description;
00256 char *logdir;
00257 char *logstem;
00258 int scenario;
00259 int flag_time;
00260 int flag_app;
00261 int flag_link;
00262 int flag_text;
00263 int flag_byte;
00264 int flag_thread;
00265 int flag_outcome;
00266 };
00267
00268
00269 typedef struct frdi__config frdi_config;
00270
00271
00272 struct frdi__app
00273 {
00274 frdi_config *config;
00275 frdi_log *log;
00276 frdi_exception *eh;
00277 frdi_seed *seed;
00278 void *self;
00279 pthread_mutex_t log_m;
00280 };
00281
00282 typedef struct frdi__app frdi_app;
00283
00284
00285
00286
00287
00288
00289
00290
00291 struct frdi__application
00292 {
00293 char *machine_name;
00294 char *machine_num;
00295 int port_number;
00296 };
00297
00298 typedef struct frdi__application frdi_application;
00299
00300
00301 struct frdi__listener
00302 {
00303 frdi_handler *spawner;
00304 int port_number;
00305 int socket_descriptor;
00306 pthread_t thread;
00307 int is_accepting;
00308 frdi_app *self;
00309 frdi_exception *eh;
00310 };
00311
00312 typedef struct frdi__listener frdi_listener;
00313
00314
00315 struct frdi__link
00316 {
00317 int authentication_mode;
00318 int encryption_mode;
00319 int encoding_mode;
00320 frdi_dict *authentication_data;
00321 frdi_dict *encryption_data;
00322 frdi_dict *encoding_data;
00323 };
00324
00325 typedef struct frdi__link frdi_link;
00326
00327
00328 struct frdi__connection
00329 {
00330 frdi_handler *receiver;
00331 frdi_application *remote;
00332 frdi_listener *listener;
00333 int socket_descriptor;
00334 pthread_t sender_thread;
00335 pthread_t receiver_thread;
00336 char send_buffer[FRDI_MESSAGE_TOTAL_SIZE];
00337 char receive_buffer[FRDI_MESSAGE_TOTAL_SIZE];
00338 int total_bytes_sent;
00339 int total_bytes_received;
00340 frdi_exception *eh_send;
00341 frdi_exception *eh_receive;
00342 int is_receiving;
00343 int is_disconnected;
00344 frdi_app *self;
00345 frdi_link *link;
00346 };
00347
00348 typedef struct frdi__connection frdi_connection;
00349
00350
00351 struct frdi__message
00352 {
00353 frdi_connection *connection;
00354 int size;
00355 void *data;
00356 };
00357
00358 typedef struct frdi__message frdi_message;
00359
00360 #ifdef NOT_NEEDED
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387 #endif
00388
00389
00390
00391
00392
00393
00394
00395 struct frdi__game_modulo
00396 {
00397 frdi_bigint *num;
00398 char *text;
00399 };
00400
00401 typedef struct frdi__game_modulo frdi_game_modulo;
00402
00403
00404 struct frdi__game_usertext
00405 {
00406 frdi_bigint *num;
00407 char *text;
00408 };
00409
00410 typedef struct frdi__game_usertext frdi_game_usertext;
00411
00412
00413 struct frdi__game_sharedtext
00414 {
00415 char *text;
00416 char *hostid;
00417 char *gameid;
00418 char *timeid;
00419 char *padding;
00420 };
00421
00422 typedef struct frdi__game_sharedtext frdi_game_sharedtext;
00423
00424
00425 struct frdi__game_digest
00426 {
00427 frdi_bigint *num;
00428 char *text;
00429 };
00430
00431 typedef struct frdi__game_digest frdi_game_digest;
00432
00433
00434 struct frdi__game_plaintext
00435 {
00436 char *text;
00437 frdi_game_sharedtext *sharedtext;
00438 frdi_game_usertext *usertext;
00439 frdi_game_digest *digest;
00440 };
00441
00442 typedef struct frdi__game_plaintext frdi_game_plaintext;
00443
00444
00445 struct frdi__game_properties
00446 {
00447 int size;
00448 frdi_game_modulo *modulo;
00449 frdi_game_sharedtext *sharedtext;
00450 };
00451
00452 typedef struct frdi__game_properties frdi_game_properties;
00453
00454
00455 struct frdi__game_input
00456 {
00457 frdi_bigint *num;
00458 char *text;
00459 };
00460
00461 typedef struct frdi__game_input frdi_game_input;
00462
00463
00464 struct frdi__game_output
00465 {
00466 frdi_bigint *num;
00467 char *text;
00468 };
00469
00470 typedef struct frdi__game_output frdi_game_output;
00471
00472
00473 #endif
00474
00475