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 /* HAVE_CONFIG_H */ 9 10#include <stdio.h> 11#include <atalk/dsi.h> 12#include <atalk/logger.h> 13#include <netatalk/endian.h> 14 15/* this assumes that the reply follows right after the command, saving 16 * on a couple assignments. specifically, command, requestID, and 17 * reserved field are assumed to already be set. */ 18int dsi_cmdreply(DSI *dsi, const int err) 19{ 20 int ret; 21 22 LOG(log_debug, logtype_dsi, "dsi_cmdreply(DSI ID: %u, len: %zd): START", 23 dsi->clientID, dsi->datalen); 24 25 dsi->header.dsi_flags = DSIFL_REPLY; 26 dsi->header.dsi_len = htonl(dsi->datalen); 27 dsi->header.dsi_code = htonl(err); 28 29 ret = dsi_stream_send(dsi, dsi->data, dsi->datalen); 30 31 LOG(log_debug, logtype_dsi, "dsi_cmdreply(DSI ID: %u, len: %zd): END", 32 dsi->clientID, dsi->datalen); 33 34 return ret; 35} 36