Make send_get_hello public, so we can use it in send_receive

This commit is contained in:
Ian Gulliver
2016-03-02 22:30:45 -08:00
parent 2f6db632b2
commit 77b9decbcd
2 changed files with 9 additions and 11 deletions

View File

@@ -34,7 +34,6 @@ struct send {
}; };
static void send_new(int, void *, struct peer *); static void send_new(int, void *, struct peer *);
static void send_get_hello(struct buf **, void *);
static struct flow _send_flow = { static struct flow _send_flow = {
.name = "send", .name = "send",
@@ -121,13 +120,6 @@ static void send_new(int fd, void *passthrough, struct peer *on_close) {
fprintf(stderr, "S %s (%s): New send connection\n", send->id, serializer->name); fprintf(stderr, "S %s (%s): New send connection\n", send->id, serializer->name);
} }
static void send_get_hello(struct buf **buf_pp, void *passthrough) {
struct serializer *serializer = (struct serializer *) passthrough;
if (serializer->hello) {
serializer->hello(buf_pp);
}
}
void send_init() { void send_init() {
assert(signal(SIGPIPE, SIG_IGN) != SIG_ERR); assert(signal(SIGPIPE, SIG_IGN) != SIG_ERR);
for (size_t i = 0; i < NUM_SERIALIZERS; i++) { for (size_t i = 0; i < NUM_SERIALIZERS; i++) {
@@ -153,6 +145,13 @@ void *send_get_serializer(char *name) {
return NULL; return NULL;
} }
void send_get_hello(struct buf **buf_pp, void *passthrough) {
struct serializer *serializer = (struct serializer *) passthrough;
if (serializer->hello) {
serializer->hello(buf_pp);
}
}
void send_write(struct packet *packet) { void send_write(struct packet *packet) {
packet_sanity_check(packet); packet_sanity_check(packet);
for (size_t i = 0; i < NUM_SERIALIZERS; i++) { for (size_t i = 0; i < NUM_SERIALIZERS; i++) {

View File

@@ -1,14 +1,13 @@
#pragma once #pragma once
#include <stdbool.h> struct buf;
struct flow; struct flow;
struct packet; struct packet;
struct peer;
void send_init(void); void send_init(void);
void send_cleanup(void); void send_cleanup(void);
void *send_get_serializer(char *); void *send_get_serializer(char *);
void send_get_hello(struct buf **, void *);
void send_write(struct packet *); void send_write(struct packet *);
void send_print_usage(void); void send_print_usage(void);
extern struct flow *send_flow; extern struct flow *send_flow;