X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fserver%2Fio.h;h=ad1344fcabf9d9bfee69e2a290198b6f1a124ad8;hb=fa079cbd21aacfc0d28a5af98cc3df4a7633f563;hp=78cb068279d4899490c5a1f1dcb267f7ac90eb57;hpb=dd9d65ee727ac7e95801da0f8b5bae7009811802;p=plomrogue diff --git a/src/server/io.h b/src/server/io.h index 78cb068..ad1344f 100644 --- a/src/server/io.h +++ b/src/server/io.h @@ -1,18 +1,39 @@ /* io.h: * - * Communication of the server with the outside world via input fifo and output - * file. + * Communication of the server with the outside world and its client via input, + * output and world state files. */ #ifndef IO_H #define IO_H +#include /* size_t */ +#include /* uint8_t, uint32_t */ +#include /* FILE */ +#include "cleanup.h" /* enum cleanup_flag */ + +/* Wrapper to reading in config files from "path" for DB entries of "size + * starting at "entry_start", to be unset by "cleanup" and reading in individual + * entry data line by line via "read"(). Assumes all entries start with the + * items collected in the EntrySkeleton struct. + */ +struct EntrySkeleton +{ + uint8_t id; + struct EntrySkeleton * next; +}; +extern void read_config_file(char * path, enum cleanup_flag cleanup, + void (* read) (char *, uint32_t, char *, + struct EntrySkeleton *, FILE *), + size_t size, struct EntrySkeleton ** entry_start); + /* Return single \0-terminated string read from input queue (world.queue); or, * if queue is empty and world.turn is unequal world.last_update_turn, update - * output file at world.path_out (and update world.last_update_turn), then read - * file at world.path_in for the next load of bytes to put onto the input queue. + * world state file at world.path_worldstate (and update world.last_update_turn + * and write a single dot line to output file at world.path_out), then read file + * at world.path_in for the next load of bytes to put onto the input queue. * * Reading the file at world.path_in may put many \0-terminated strings on the * queue at once. Successive calls of io_round() will make these available one