summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-03-12 06:01:00 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-03-12 06:14:39 +0100
commit0801d1ec0b0d78fe038b59ede6695a7b8efc3f56 (patch)
tree3c529a7c4eb173393d0a1b3d35dd992313babde9
parent66b0b2158559ba6fb0cfd615781bd81784954905 (diff)
downloadecon-0801d1ec0b0d78fe038b59ede6695a7b8efc3f56.tar.gz
econ-0801d1ec0b0d78fe038b59ede6695a7b8efc3f56.tar.bz2
econ-0801d1ec0b0d78fe038b59ede6695a7b8efc3f56.zip
econserv: Use epkt_init at least to init iov
-rw-r--r--econserv.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/econserv.c b/econserv.c
index eb196de..cbe07ce 100644
--- a/econserv.c
+++ b/econserv.c
@@ -121,18 +121,6 @@ get_hwaddr(struct ecs *ecs)
}
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);