]> arthur.barton.de Git - netatalk.git/blob - libatalk/dsi/dsi_cmdreply.c
4459206f7542539ea334692337ae5bd22b93f840
[netatalk.git] / libatalk / dsi / dsi_cmdreply.c
1 /*
2  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
3  * All rights reserved. See COPYRIGHT.
4  */
5
6 #include <stdio.h>
7 #include <atalk/dsi.h>
8 #include <netatalk/endian.h>
9
10 /* this assumes that the reply follows right after the command, saving
11  * on a couple assignments. specifically, command, requestID, and
12  * reserved field are assumed to already be set. */ 
13 int dsi_cmdreply(DSI *dsi, const int err)
14 {
15   dsi->header.dsi_flags = DSIFL_REPLY;
16   /*dsi->header.dsi_command = DSIFUNC_CMD;*/
17   dsi->header.dsi_len = htonl(dsi->datalen);
18   dsi->header.dsi_code = htonl(err);
19
20   return dsi_stream_send(dsi, dsi->data, dsi->datalen);
21 }