]> arthur.barton.de Git - netatalk.git/blob - libatalk/asp/asp_init.c
Initial revision
[netatalk.git] / libatalk / asp / asp_init.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 #include <sys/types.h>
25 #include <sys/time.h>
26 #include <sys/uio.h>
27 #include <sys/socket.h>
28 #include <sys/param.h>
29 #include <netatalk/at.h>
30 #include <atalk/atp.h>
31 #include <atalk/asp.h>
32 #include <stdio.h>
33 #include <stdlib.h>
34
35 ASP asp_init( atp )
36     ATP         atp;
37 {
38     ASP         asp;
39
40     if (( asp = (struct ASP *)calloc(1, sizeof( struct ASP ))) == NULL ) {
41         return( NULL );
42     }
43
44     asp->asp_atp = atp;
45 #ifdef BSD4_4
46     asp->asp_sat.sat_len = sizeof( struct sockaddr_at );
47 #endif BSD4_4
48     asp->asp_sat.sat_family = AF_APPLETALK;
49     asp->asp_sat.sat_addr.s_net = ATADDR_ANYNET;
50     asp->asp_sat.sat_addr.s_node = ATADDR_ANYNODE;
51     asp->asp_sat.sat_port = ATADDR_ANYPORT;
52     asp->asp_status = NULL;
53     asp->asp_slen = 0;
54     asp->asp_sid = 0;
55     asp->asp_flags = ASPFL_SLS;
56     asp->cmdlen = asp->datalen = 0;
57     asp->read_count = asp->write_count = 0;
58     asp->commands = asp->cmdbuf + 4;
59
60     return( asp );
61 }
62
63 void asp_setstatus( asp, status, slen )
64     ASP         asp;
65     char        *status;
66     const int   slen;
67 {
68     asp->asp_status = status;
69     asp->asp_slen = slen;
70 }