From 0801d1ec0b0d78fe038b59ede6695a7b8efc3f56 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 12 Mar 2013 06:01:00 +0100 Subject: econserv: Use epkt_init at least to init iov --- econserv.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/econserv.c b/econserv.c index eb196de..cbe07ce 100644 --- a/econserv.c +++ b/econserv.c @@ -120,18 +120,6 @@ get_hwaddr(struct ecs *ecs) memcpy(ecs->proj_uniq, m, 6); } -static void -init_header(struct econ_header *ehdr, int commandID) -{ - memset(ehdr, 0, sizeof *ehdr); - - strncpy(ehdr->magicnum, ECON_MAGIC_NUMBER, ECON_MAGICNUM_SIZE); - strncpy(ehdr->version, ECON_PROTO_VERSION, ECON_PROTOVER_MAXLEN); - - ehdr->datasize = 0; - ehdr->commandID = commandID; -} - static void handle_input(struct ecs *ecs, char *in, int fd, struct sockaddr *src_addr, socklen_t addrlen) @@ -304,17 +292,6 @@ recv_udp(struct ecs *ecs) (struct sockaddr *) &src_addr, addrlen); } -static void -init_iov(struct ecs *ecs) -{ - ecs->epkt.iov[0].iov_base = &ecs->epkt.hdr; - ecs->epkt.iov[0].iov_len = sizeof ecs->epkt.hdr; - ecs->epkt.iov[1].iov_base = &ecs->epkt.cmd; - ecs->epkt.iov[1].iov_len = sizeof ecs->epkt.cmd; - ecs->epkt.iov[2].iov_base = &ecs->epkt.rec; - ecs->epkt.iov[2].iov_len = sizeof ecs->epkt.rec; -} - int main(int argc, char *argv[]) { struct ecs ecs; @@ -332,8 +309,7 @@ int main(int argc, char *argv[]) ecs.name = "benp"; ecs.client_fd = ecs.client_fd_data[0] = ecs.client_fd_data[1] = -1; ecs.state = E_PSTAT_NOUSE; - init_iov(&ecs); - init_header(&ecs.epkt.hdr, E_CMD_CLIENTINFO); + epkt_init(&ecs.epkt, E_CMD_CLIENTINFO); ecs.fd = bind_socket(SOCK_STREAM, host, control_port); assert(ecs.fd >= 0); -- cgit