From e6f5d45855b4a8091b52b3fc91451d2d132a5a6d Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Mon, 27 Feb 2017 22:59:52 +0100 Subject: lib: Split CACEP into request/response protocol --- src/lib/cacep.c | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) (limited to 'src/lib/cacep.c') diff --git a/src/lib/cacep.c b/src/lib/cacep.c index badeccc0..abff0aaa 100644 --- a/src/lib/cacep.c +++ b/src/lib/cacep.c @@ -93,46 +93,26 @@ static int send_msg(int fd, return 0; } -int cacep_connect(int fd, - const struct conn_info * in, - struct conn_info * out) +int cacep_snd(int fd, + const struct conn_info * in) { - if (in == NULL || out == NULL) + if (in == NULL) return -EINVAL; if (send_msg(fd, in)) return -1; - if (read_msg(fd, out)) - return -1; - - if (strcmp(in->ae_name, out->ae_name) || - strcmp(in->protocol, out->protocol) || - in->pref_version != out->pref_version || - in->pref_syntax != out->pref_syntax) - return -EPROTO; - return 0; } -int cacep_listen(int fd, - const struct conn_info * in, - struct conn_info * out) +int cacep_rcv(int fd, + struct conn_info * out) { - if (in == NULL || out == NULL) + if (out == NULL) return -EINVAL; - if (send_msg(fd, in)) - return -1; - if (read_msg(fd, out)) return -1; - if (strcmp(in->ae_name, out->ae_name) || - strcmp(in->protocol, out->protocol) || - in->pref_version != out->pref_version || - in->pref_syntax != out->pref_syntax) - return -EPROTO; - return 0; } -- cgit v1.2.3