X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=hostinfod%2Fhostinfod.h;h=103783ef0057b264fccf240ebe301d16d171811f;hb=dcbfcc566fa812fd3085c89a8cfed7fe34bb05e8;hp=f1da3e459c10d82ec79d54a6c4e821d2473b78ca;hpb=11bf652b21fb6e20dc072c7e250aeb26821b818e;p=virt-hostinfo.git diff --git a/hostinfod/hostinfod.h b/hostinfod/hostinfod.h index f1da3e4..103783e 100644 --- a/hostinfod/hostinfod.h +++ b/hostinfod/hostinfod.h @@ -19,8 +19,44 @@ #ifndef HOSTINFOD_H #define HOSTINFOD_H +#include + #include #include +#include +#include +#include + +enum guest_state { + guest_state_connecting, /* Connecting to socket. */ + guest_state_request, /* Waiting or reading the request. */ + guest_state_reply, /* Sending the reply. */ + guest_state_dead /* Connection is dead. */ +}; + +struct guest_description { + int counter; + apr_pool_t *pool; /* Pool for lifetime of guest connection. */ + const char *name; /* "driver-name" */ + const char *sock_path; /* Full path to socket. */ + int sock; /* Real socket. */ + apr_socket_t *aprsock; /* APR socket. */ + apr_pollfd_t pollfd; /* APR poll descriptor. */ + enum guest_state state; /* State of the connection. */ + + /* Increments every time guest does something bad, decremented once per min */ + unsigned penalty; + time_t last_penalty_decr; + + unsigned request_max; /* Max. length of request buffer. */ + unsigned request_posn; /* Position in request buffer. */ + char *request; /* Request buffer. */ + + unsigned reply_alloc; /* Allocated for reply buffer. */ + unsigned reply_size; /* Size used in reply buffer. */ + unsigned reply_posn; /* Position in reply buffer. */ + char *reply; /* Reply buffer. */ +}; /* main.c */ extern const char *conf_file; @@ -57,4 +93,7 @@ extern void read_main_conf_file (void); extern int sockets_inotify_fd; extern void monitor_socket_dir (void); +/* commands.c */ +extern void execute_command (time_t now, struct guest_description *hval, const char *command); + #endif /* HOSTINFOD_H */