]> arthur.barton.de Git - netatalk.git/blob - libatalk/asp/asp_close.c
b32ae2e892ae2a8cf298af5b9fcf6cba7d504650
[netatalk.git] / libatalk / asp / asp_close.c
1 /*
2  * Copyright (c) 1990,1991 Regents of The University of Michigan.
3  * All Rights Reserved.
4  *
5  * Permission to use, copy, modify, and distribute this software and
6  * its documentation for any purpose and without fee is hereby granted,
7  * provided that the above copyright notice appears in all copies and
8  * that both that copyright notice and this permission notice appear
9  * in supporting documentation, and that the name of The University
10  * of Michigan not be used in advertising or publicity pertaining to
11  * distribution of the software without specific, written prior
12  * permission. This software is supplied as is without expressed or
13  * implied warranties of any kind.
14  *
15  *      Research Systems Unix Group
16  *      The University of Michigan
17  *      c/o Mike Clark
18  *      535 W. William Street
19  *      Ann Arbor, Michigan
20  *      +1-313-763-0525
21  *      netatalk@itd.umich.edu
22  */
23
24 #ifdef HAVE_CONFIG_H
25 #include "config.h"
26 #endif
27
28 #include <stdlib.h>
29 #include <string.h>
30 #include <sys/types.h>
31 #include <sys/time.h>
32 #include <sys/uio.h>
33 #include <netatalk/at.h>
34 #include <atalk/atp.h>
35 #include <atalk/asp.h>
36
37 int asp_close( asp )
38     ASP         asp;
39 {
40     struct atp_block    atpb;
41     struct iovec        iov[ 1 ];
42     int err = 0;
43
44     memset(asp->commands, 0, sizeof(u_int32_t));
45
46     atpb.atp_saddr = &asp->asp_sat;
47     iov[ 0 ].iov_base = asp->commands;
48     iov[ 0 ].iov_len = sizeof(u_int32_t);
49     atpb.atp_sresiov = iov;
50     atpb.atp_sresiovcnt = 1;
51
52     if (atp_sresp( asp->asp_atp, &atpb ) < 0)
53       err = -1;
54
55     if (atp_close( asp->asp_atp ) < 0)
56       err = -1;
57
58     free( asp );
59     return err;
60 }