Changeset View
Changeset View
Standalone View
Standalone View
head/sbin/hastd/hast_proto.c
Show All 36 Lines | |||||
#include <strings.h> | #include <strings.h> | ||||
#include <hast.h> | #include <hast.h> | ||||
#include <ebuf.h> | #include <ebuf.h> | ||||
#include <nv.h> | #include <nv.h> | ||||
#include <pjdlog.h> | #include <pjdlog.h> | ||||
#include <proto.h> | #include <proto.h> | ||||
#ifdef HAVE_CRYPTO | |||||
#include "hast_checksum.h" | #include "hast_checksum.h" | ||||
#endif | |||||
#include "hast_compression.h" | #include "hast_compression.h" | ||||
#include "hast_proto.h" | #include "hast_proto.h" | ||||
struct hast_main_header { | struct hast_main_header { | ||||
/* Protocol version. */ | /* Protocol version. */ | ||||
uint8_t version; | uint8_t version; | ||||
/* Size of nv headers. */ | /* Size of nv headers. */ | ||||
uint32_t size; | uint32_t size; | ||||
} __packed; | } __packed; | ||||
typedef int hps_send_t(const struct hast_resource *, struct nv *nv, void **, | typedef int hps_send_t(const struct hast_resource *, struct nv *nv, void **, | ||||
size_t *, bool *); | size_t *, bool *); | ||||
typedef int hps_recv_t(const struct hast_resource *, struct nv *nv, void **, | typedef int hps_recv_t(const struct hast_resource *, struct nv *nv, void **, | ||||
size_t *, bool *); | size_t *, bool *); | ||||
struct hast_pipe_stage { | struct hast_pipe_stage { | ||||
const char *hps_name; | const char *hps_name; | ||||
hps_send_t *hps_send; | hps_send_t *hps_send; | ||||
hps_recv_t *hps_recv; | hps_recv_t *hps_recv; | ||||
}; | }; | ||||
static struct hast_pipe_stage pipeline[] = { | static struct hast_pipe_stage pipeline[] = { | ||||
{ "compression", compression_send, compression_recv }, | { "compression", compression_send, compression_recv }, | ||||
#ifdef HAVE_CRYPTO | |||||
{ "checksum", checksum_send, checksum_recv } | { "checksum", checksum_send, checksum_recv } | ||||
#endif | |||||
}; | }; | ||||
/* | /* | ||||
* Send the given nv structure via conn. | * Send the given nv structure via conn. | ||||
* We keep headers in nv structure and pass data in separate argument. | * We keep headers in nv structure and pass data in separate argument. | ||||
* There can be no data at all (data is NULL then). | * There can be no data at all (data is NULL then). | ||||
*/ | */ | ||||
int | int | ||||
▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines |