X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=command.h;h=5e1a4ce3edc1a8812948ada45eecd2f76df4f7be;hp=347dd81ceedc753eb7f89a204ae5372ddb079dc7;hb=bc78a94412b17dfd445d6bb88f752041df3cf7ba;hpb=e61e21f2aae608ff694c924cdeb2056ac1136b77 diff --git a/command.h b/command.h index 347dd81c..5e1a4ce3 100644 --- a/command.h +++ b/command.h @@ -1,19 +1,24 @@ /** \file command.h The structure of server and afs commands. */ -/** - * Defines one command of para_server. - */ -struct server_command { - /** The name of the command. */ - const char *name; - /** Pointer to the function that handles the command. */ - int (*handler)(struct rc4_context *, int, char * const * const); - /** The privileges a user must have to execute this command. */ - unsigned int perms; - /** One-line description of the command. */ - const char *description; - /** Summary of the command line options. */ - const char *usage; - /** The long help text. */ - const char *help; +/** Per connection data available to command handlers. */ +struct command_context { + /** Network address of the peer. */ + const char *peer; + /** The paraslash user that executes this command. */ + struct user *u; + /** Argument count. */ + int argc; + /** Argument vector. */ + char **argv; + /** File descriptor and crypto keys. */ + struct stream_cipher_context scc; }; + +int send_sb(struct stream_cipher_context *scc, void *buf, size_t numbytes, + int band, bool dont_free); +__printf_3_4 int send_sb_va(struct stream_cipher_context *scc, int band, + const char *fmt, ...); +int send_strerror(struct command_context *cc, int err); +int recv_sb(struct stream_cipher_context *scc, + enum sb_designator expected_band, + size_t max_size, struct iovec *result);