summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/rpki-client/extern.h9
-rw-r--r--usr.sbin/rpki-client/http.c10
-rw-r--r--usr.sbin/rpki-client/io.c6
-rw-r--r--usr.sbin/rpki-client/main.c30
-rw-r--r--usr.sbin/rpki-client/parser.c6
-rw-r--r--usr.sbin/rpki-client/rrdp.c18
-rw-r--r--usr.sbin/rpki-client/rsync.c6
7 files changed, 41 insertions, 44 deletions
diff --git a/usr.sbin/rpki-client/extern.h b/usr.sbin/rpki-client/extern.h
index 661be5e20eb..fbaf8d9396e 100644
--- a/usr.sbin/rpki-client/extern.h
+++ b/usr.sbin/rpki-client/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.74 2021/10/23 16:06:04 claudio Exp $ */
+/* $OpenBSD: extern.h,v 1.75 2021/10/23 20:01:16 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -535,14 +535,11 @@ char *hex_encode(const unsigned char *, size_t);
/* Functions for moving data between processes. */
-struct ibuf *io_buf_new(void);
+struct ibuf *io_new_buffer(void);
void io_simple_buffer(struct ibuf *, const void *, size_t);
void io_buf_buffer(struct ibuf *, const void *, size_t);
void io_str_buffer(struct ibuf *, const char *);
-void io_buf_close(struct msgbuf *, struct ibuf *);
-void io_simple_read(int, void *, size_t);
-void io_buf_read_alloc(int, void **, size_t *);
-void io_str_read(int, char **);
+void io_close_buffer(struct msgbuf *, struct ibuf *);
void io_read_buf(struct ibuf *, void *, size_t);
void io_read_str(struct ibuf *, char **);
void io_read_buf_alloc(struct ibuf *, void **, size_t *);
diff --git a/usr.sbin/rpki-client/http.c b/usr.sbin/rpki-client/http.c
index 4907904950f..2ab408a229e 100644
--- a/usr.sbin/rpki-client/http.c
+++ b/usr.sbin/rpki-client/http.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: http.c,v 1.44 2021/10/23 16:06:04 claudio Exp $ */
+/* $OpenBSD: http.c,v 1.45 2021/10/23 20:01:16 claudio Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
@@ -569,11 +569,11 @@ http_req_done(size_t id, enum http_result res, const char *last_modified)
{
struct ibuf *b;
- b = io_buf_new();
+ b = io_new_buffer();
io_simple_buffer(b, &id, sizeof(id));
io_simple_buffer(b, &res, sizeof(res));
io_str_buffer(b, last_modified);
- io_buf_close(&msgq, b);
+ io_close_buffer(&msgq, b);
}
/*
@@ -585,11 +585,11 @@ http_req_fail(size_t id)
struct ibuf *b;
enum http_result res = HTTP_FAILED;
- b = io_buf_new();
+ b = io_new_buffer();
io_simple_buffer(b, &id, sizeof(id));
io_simple_buffer(b, &res, sizeof(res));
io_str_buffer(b, NULL);
- io_buf_close(&msgq, b);
+ io_close_buffer(&msgq, b);
}
/*
diff --git a/usr.sbin/rpki-client/io.c b/usr.sbin/rpki-client/io.c
index 0d7ab89e64c..b9e43ca9568 100644
--- a/usr.sbin/rpki-client/io.c
+++ b/usr.sbin/rpki-client/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.15 2021/10/23 16:06:04 claudio Exp $ */
+/* $OpenBSD: io.c,v 1.16 2021/10/23 20:01:16 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -35,7 +35,7 @@
* Function always returns a new buffer.
*/
struct ibuf *
-io_buf_new(void)
+io_new_buffer(void)
{
struct ibuf *b;
@@ -83,7 +83,7 @@ io_str_buffer(struct ibuf *b, const char *p)
* Finish and enqueue a io buffer.
*/
void
-io_buf_close(struct msgbuf *msgbuf, struct ibuf *b)
+io_close_buffer(struct msgbuf *msgbuf, struct ibuf *b)
{
size_t len;
diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c
index e344d37c9ca..ff136994b2e 100644
--- a/usr.sbin/rpki-client/main.c
+++ b/usr.sbin/rpki-client/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.151 2021/10/23 16:06:04 claudio Exp $ */
+/* $OpenBSD: main.c,v 1.152 2021/10/23 20:01:16 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -124,14 +124,14 @@ entity_write_req(const struct entity *ent)
return;
}
- b = io_buf_new();
+ b = io_new_buffer();
io_simple_buffer(b, &ent->type, sizeof(ent->type));
io_str_buffer(b, ent->file);
io_simple_buffer(b, &ent->has_pkey, sizeof(int));
if (ent->has_pkey)
io_buf_buffer(b, ent->pkey, ent->pkeysz);
io_str_buffer(b, ent->descr);
- io_buf_close(&procq, b);
+ io_close_buffer(&procq, b);
}
/*
@@ -221,11 +221,11 @@ rrdp_file_resp(size_t id, int ok)
enum rrdp_msg type = RRDP_FILE;
struct ibuf *b;
- b = io_buf_new();
+ b = io_new_buffer();
io_simple_buffer(b, &type, sizeof(type));
io_simple_buffer(b, &id, sizeof(id));
io_simple_buffer(b, &ok, sizeof(ok));
- io_buf_close(&rrdpq, b);
+ io_close_buffer(&rrdpq, b);
}
void
@@ -235,7 +235,7 @@ rrdp_fetch(size_t id, const char *uri, const char *local,
enum rrdp_msg type = RRDP_START;
struct ibuf *b;
- b = io_buf_new();
+ b = io_new_buffer();
io_simple_buffer(b, &type, sizeof(type));
io_simple_buffer(b, &id, sizeof(id));
io_str_buffer(b, local);
@@ -243,7 +243,7 @@ rrdp_fetch(size_t id, const char *uri, const char *local,
io_str_buffer(b, s->session_id);
io_simple_buffer(b, &s->serial, sizeof(s->serial));
io_str_buffer(b, s->last_mod);
- io_buf_close(&rrdpq, b);
+ io_close_buffer(&rrdpq, b);
}
/*
@@ -254,11 +254,11 @@ rsync_fetch(size_t id, const char *uri, const char *local)
{
struct ibuf *b;
- b = io_buf_new();
+ b = io_new_buffer();
io_simple_buffer(b, &id, sizeof(id));
io_str_buffer(b, local);
io_str_buffer(b, uri);
- io_buf_close(&rsyncq, b);
+ io_close_buffer(&rsyncq, b);
}
/*
@@ -269,13 +269,13 @@ http_fetch(size_t id, const char *uri, const char *last_mod, int fd)
{
struct ibuf *b;
- b = io_buf_new();
+ b = io_new_buffer();
io_simple_buffer(b, &id, sizeof(id));
io_str_buffer(b, uri);
io_str_buffer(b, last_mod);
/* pass file as fd */
b->fd = fd;
- io_buf_close(&httpq, b);
+ io_close_buffer(&httpq, b);
}
/*
@@ -292,11 +292,11 @@ rrdp_http_fetch(size_t id, const char *uri, const char *last_mod)
if (pipe2(pi, O_CLOEXEC | O_NONBLOCK) == -1)
err(1, "pipe");
- b = io_buf_new();
+ b = io_new_buffer();
io_simple_buffer(b, &type, sizeof(type));
io_simple_buffer(b, &id, sizeof(id));
b->fd = pi[0];
- io_buf_close(&rrdpq, b);
+ io_close_buffer(&rrdpq, b);
http_fetch(id, uri, last_mod, pi[1]);
}
@@ -308,12 +308,12 @@ rrdp_http_done(size_t id, enum http_result res, const char *last_mod)
struct ibuf *b;
/* RRDP request, relay response over to the rrdp process */
- b = io_buf_new();
+ b = io_new_buffer();
io_simple_buffer(b, &type, sizeof(type));
io_simple_buffer(b, &id, sizeof(id));
io_simple_buffer(b, &res, sizeof(res));
io_str_buffer(b, last_mod);
- io_buf_close(&rrdpq, b);
+ io_close_buffer(&rrdpq, b);
}
/*
diff --git a/usr.sbin/rpki-client/parser.c b/usr.sbin/rpki-client/parser.c
index 5b2a96abb4a..fb69ce215ee 100644
--- a/usr.sbin/rpki-client/parser.c
+++ b/usr.sbin/rpki-client/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.15 2021/10/23 16:06:04 claudio Exp $ */
+/* $OpenBSD: parser.c,v 1.16 2021/10/23 20:01:16 claudio Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -603,7 +603,7 @@ proc_parser(int fd)
entp = TAILQ_FIRST(&q);
assert(entp != NULL);
- b = io_buf_new();
+ b = io_new_buffer();
io_simple_buffer(b, &entp->type, sizeof(entp->type));
switch (entp->type) {
@@ -656,7 +656,7 @@ proc_parser(int fd)
abort();
}
- io_buf_close(&msgq, b);
+ io_close_buffer(&msgq, b);
TAILQ_REMOVE(&q, entp, entries);
entity_free(entp);
}
diff --git a/usr.sbin/rpki-client/rrdp.c b/usr.sbin/rpki-client/rrdp.c
index 31c061073f8..579353fb167 100644
--- a/usr.sbin/rpki-client/rrdp.c
+++ b/usr.sbin/rpki-client/rrdp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rrdp.c,v 1.13 2021/10/23 16:06:04 claudio Exp $ */
+/* $OpenBSD: rrdp.c,v 1.14 2021/10/23 20:01:16 claudio Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
@@ -140,11 +140,11 @@ rrdp_done(size_t id, int ok)
enum rrdp_msg type = RRDP_END;
struct ibuf *b;
- b = io_buf_new();
+ b = io_new_buffer();
io_simple_buffer(b, &type, sizeof(type));
io_simple_buffer(b, &id, sizeof(id));
io_simple_buffer(b, &ok, sizeof(ok));
- io_buf_close(&msgq, b);
+ io_close_buffer(&msgq, b);
}
/*
@@ -161,12 +161,12 @@ rrdp_http_req(size_t id, const char *uri, const char *last_mod)
enum rrdp_msg type = RRDP_HTTP_REQ;
struct ibuf *b;
- b = io_buf_new();
+ b = io_new_buffer();
io_simple_buffer(b, &type, sizeof(type));
io_simple_buffer(b, &id, sizeof(id));
io_str_buffer(b, uri);
io_str_buffer(b, last_mod);
- io_buf_close(&msgq, b);
+ io_close_buffer(&msgq, b);
}
/*
@@ -178,13 +178,13 @@ rrdp_state_send(struct rrdp *s)
enum rrdp_msg type = RRDP_SESSION;
struct ibuf *b;
- b = io_buf_new();
+ b = io_new_buffer();
io_simple_buffer(b, &type, sizeof(type));
io_simple_buffer(b, &s->id, sizeof(s->id));
io_str_buffer(b, s->current.session_id);
io_simple_buffer(b, &s->current.serial, sizeof(s->current.serial));
io_str_buffer(b, s->current.last_mod);
- io_buf_close(&msgq, b);
+ io_close_buffer(&msgq, b);
}
static struct rrdp *
@@ -666,7 +666,7 @@ publish_done(struct rrdp *s, struct publish_xml *pxml)
/* only send files if the fetch did not fail already */
if (s->file_failed == 0) {
- b = io_buf_new();
+ b = io_new_buffer();
io_simple_buffer(b, &type, sizeof(type));
io_simple_buffer(b, &s->id, sizeof(s->id));
io_simple_buffer(b, &pxml->type, sizeof(pxml->type));
@@ -674,7 +674,7 @@ publish_done(struct rrdp *s, struct publish_xml *pxml)
io_simple_buffer(b, &pxml->hash, sizeof(pxml->hash));
io_str_buffer(b, pxml->uri);
io_buf_buffer(b, data, datasz);
- io_buf_close(&msgq, b);
+ io_close_buffer(&msgq, b);
s->file_pending++;
}
diff --git a/usr.sbin/rpki-client/rsync.c b/usr.sbin/rpki-client/rsync.c
index 839250b03e7..a1bdd7f3a66 100644
--- a/usr.sbin/rpki-client/rsync.c
+++ b/usr.sbin/rpki-client/rsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsync.c,v 1.27 2021/10/23 16:06:04 claudio Exp $ */
+/* $OpenBSD: rsync.c,v 1.28 2021/10/23 20:01:16 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -216,10 +216,10 @@ proc_rsync(char *prog, char *bind_addr, int fd)
ok = 0;
}
- b = io_buf_new();
+ b = io_new_buffer();
io_simple_buffer(b, &ids[i].id, sizeof(size_t));
io_simple_buffer(b, &ok, sizeof(ok));
- io_buf_close(&msgq, b);
+ io_close_buffer(&msgq, b);
free(ids[i].uri);
ids[i].uri = NULL;