]> arthur.barton.de Git - netatalk.git/blob - libatalk/dsi/dsi_cmdreply.c
1fb833ab7f33dd800d9ab6aaa6b7ed913ec25d33
[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 #ifdef HAVE_CONFIG_H
7 #include "config.h"
8 #endif
9
10 #include <stdio.h>
11 #include <atalk/dsi.h>
12 #include <netatalk/endian.h>
13
14 /* this assumes that the reply follows right after the command, saving
15  * on a couple assignments. specifically, command, requestID, and
16  * reserved field are assumed to already be set. */ 
17 int dsi_cmdreply(DSI *dsi, const int err)
18 {
19   dsi->header.dsi_flags = DSIFL_REPLY;
20   /*dsi->header.dsi_command = DSIFUNC_CMD;*/
21   dsi->header.dsi_len = htonl(dsi->datalen);
22   dsi->header.dsi_code = htonl(err);
23
24   return dsi_stream_send(dsi, dsi->data, dsi->datalen);
25 }