protocol

protocol tests
Log | Files | Refs | Submodules | README | git clone https://git.ne02ptzero.me/git/protocol

commit f2a13846ba5e2d9415a3c8ba2cb763d6d5015680
parent 1bfd5a910093c55c60969037c1a5a8a0f8932d9c
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Tue, 28 Feb 2017 19:05:34 +0100

Add(write_payload_req_get_file)

Diffstat:
Msrc/write_package.c | 17++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/write_package.c b/src/write_package.c @@ -80,12 +80,27 @@ static void *write_payload_req_get_pkg(void *pkg, size_t *count) { return ret; } +static void *write_payload_req_get_file(void *pkg, size_t *count) { + req_get_file_t *req = pkg; + void *ret; + + ret = malloc(sizeof(req->id) + sizeof(req->path_len) + req->path_len); + assert(ret != NULL); + + write_member(req->id, ret, *count); + write_member(req->path_len, ret, *count); + write_string(req->path, ret, req->path_len, *count); + + return ret; +} + typedef void *(*write_callback)(void *, size_t *); static const write_callback arr[] = { &write_payload_auth, &write_payload_auth_ack, &write_payload_error, - &write_payload_req_get_pkg + &write_payload_req_get_pkg, + &write_payload_req_get_file }; void *write_payload(package_t *pkg, size_t *count) {