X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/blobdiff_plain/ae183399278ee71fba31527cd18a7545ac9af2e4..bd878fc99a65d56028b96b1c2535fff45df6e9a1:/sbin/hammer2/hammer2.h diff --git a/sbin/hammer2/hammer2.h b/sbin/hammer2/hammer2.h index 7f451e59cd..e7642afcc6 100644 --- a/sbin/hammer2/hammer2.h +++ b/sbin/hammer2/hammer2.h @@ -37,12 +37,14 @@ * Rollup headers for hammer2 utility */ #include +#include #include #include #include #include #include #include +#include #include #include @@ -52,26 +54,38 @@ #include #include #include +#include #include #include #include #include -#include #include #include #include #include #include -#include +#include #include +#include +#include +#include + +#include + +#include "network.h" + +#define HAMMER2_DEFAULT_DIR "/etc/hammer2" +#define HAMMER2_PATH_REMOTE HAMMER2_DEFAULT_DIR "/remote" extern int DebugOpt; +extern int VerboseOpt; extern int NormalExit; int hammer2_ioctl_handle(const char *sel_path); -void hammer2_disconnect(void *(*func)(void *), void *arg); +void hammer2_demon(void *(*func)(void *), void *arg); +void hammer2_bswap_head(hammer2_msg_hdr_t *head); int cmd_remote_connect(const char *sel_path, const char *url); int cmd_remote_disconnect(const char *sel_path, const char *url); @@ -82,4 +96,49 @@ int cmd_pfs_create(const char *sel_path, const char *name, uint8_t pfs_type, const char *uuid_str); int cmd_pfs_delete(const char *sel_path, const char *name); -int cmd_helper(const char *sel_path); +int cmd_service(void); +int cmd_leaf(const char *sel_path); +int cmd_shell(const char *hostname); +int cmd_show(const char *devpath); +int cmd_rsainit(const char *dir_path); +int cmd_rsaenc(const char **keys, int nkeys); +int cmd_rsadec(const char **keys, int nkeys); + +void hammer2_ioq_init(hammer2_iocom_t *iocom, hammer2_ioq_t *ioq); +void hammer2_ioq_done(hammer2_iocom_t *iocom, hammer2_ioq_t *ioq); +void hammer2_iocom_init(hammer2_iocom_t *iocom, int sock_fd, int alt_fd); +void hammer2_iocom_done(hammer2_iocom_t *iocom); +hammer2_msg_t *hammer2_allocmsg(hammer2_iocom_t *iocom, + uint32_t cmd, int aux_size); +hammer2_msg_t *hammer2_allocreply(hammer2_msg_t *msg, + uint32_t cmd, int aux_size); +void hammer2_replymsg(hammer2_msg_t *msg, uint16_t error); +void hammer2_freemsg(hammer2_msg_t *msg); + +void hammer2_iocom_core(hammer2_iocom_t *iocom, + void (*iocom_recvmsg)(hammer2_iocom_t *), + void (*iocom_sendmsg)(hammer2_iocom_t *), + void (*iocom_altmsg)(hammer2_iocom_t *)); +hammer2_msg_t *hammer2_ioq_read(hammer2_iocom_t *iocom); +void hammer2_ioq_write(hammer2_msg_t *msg); + +void hammer2_ioq_stream(hammer2_msg_t *msg, int reply); +void hammer2_iocom_drain(hammer2_iocom_t *iocom); +void hammer2_iocom_flush(hammer2_iocom_t *iocom); + +void hammer2_crypto_negotiate(hammer2_iocom_t *iocom); +void hammer2_crypto_decrypt(hammer2_iocom_t *iocom, hammer2_ioq_t *ioq); +void hammer2_crypto_decrypt_aux(hammer2_iocom_t *iocom, hammer2_ioq_t *ioq, + hammer2_msg_t *msg, int already); +int hammer2_crypto_encrypt(hammer2_iocom_t *iocom, hammer2_ioq_t *ioq, + struct iovec *iov, int n); +void hammer2_crypto_encrypt_wrote(hammer2_iocom_t *iocom, hammer2_ioq_t *ioq, + int nact); + +const char *hammer2_time64_to_str(uint64_t htime64, char **strp); +const char *hammer2_uuid_to_str(uuid_t *uuid, char **strp); +const char *hammer2_iptype_to_str(uint8_t type); +const char *hammer2_pfstype_to_str(uint8_t type); + +void hammer2_shell_remote(hammer2_msg_t *msg); +void msg_printf(hammer2_msg_t *msg, const char *ctl, ...);