hammer2 - Add media dump command, improve help output
[dragonfly.git] / sbin / hammer2 / hammer2.h
index bfacbab..e7642af 100644 (file)
 #include <pthread.h>
 #include <poll.h>
 
+#include <libutil.h>
+
 #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);
@@ -90,31 +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_node(void);
+int cmd_service(void);
 int cmd_leaf(const char *sel_path);
-int cmd_debug(void);
+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_iocom_allocmsg(hammer2_iocom_t *iocom,
+hammer2_msg_t *hammer2_allocmsg(hammer2_iocom_t *iocom,
                        uint32_t cmd, int aux_size);
-void hammer2_iocom_reallocmsg(hammer2_iocom_t *iocom, hammer2_msg_t *msg,
-                       int aux_size);
-void hammer2_iocom_freemsg(hammer2_iocom_t *iocom, hammer2_msg_t *msg);
+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 *iocon);
-void hammer2_ioq_write(hammer2_iocom_t *iocon, hammer2_msg_t *msg);
-void hammer2_ioq_reply(hammer2_iocom_t *iocom, hammer2_msg_t *msg);
-void hammer2_ioq_reply_term(hammer2_iocom_t *iocom, hammer2_msg_t *msg,
-                       uint16_t error);
-void hammer2_ioq_write_drain(hammer2_iocom_t *iocon);
-
-void hammer2_debug_remote(hammer2_iocom_t *iocom, hammer2_msg_t *msg);
-void iocom_printf(hammer2_iocom_t *iocom, hammer2_msg_t *msg,
-                       const char *ctl, ...);
+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, ...);