1/* 2 * $Id: asp_init.c,v 1.4 2009-10-13 22:55:37 didg Exp $ 3 * 4 * Copyright (c) 1990,1991 Regents of The University of Michigan. 5 * All Rights Reserved. 6 * 7 * Permission to use, copy, modify, and distribute this software and 8 * its documentation for any purpose and without fee is hereby granted, 9 * provided that the above copyright notice appears in all copies and 10 * that both that copyright notice and this permission notice appear 11 * in supporting documentation, and that the name of The University 12 * of Michigan not be used in advertising or publicity pertaining to 13 * distribution of the software without specific, written prior 14 * permission. This software is supplied as is without expressed or 15 * implied warranties of any kind. 16 * 17 * Research Systems Unix Group 18 * The University of Michigan 19 * c/o Mike Clark 20 * 535 W. William Street 21 * Ann Arbor, Michigan 22 * +1-313-763-0525 23 * netatalk@itd.umich.edu 24 */ 25 26#ifdef HAVE_CONFIG_H 27#include "config.h" 28#endif /* HAVE_CONFIG_H */ 29 30#include <sys/types.h> 31#include <sys/time.h> 32#include <sys/uio.h> 33#include <sys/socket.h> 34#include <sys/param.h> 35#include <netatalk/at.h> 36#include <atalk/atp.h> 37#include <atalk/asp.h> 38#include <stdio.h> 39#include <stdlib.h> 40 41ASP asp_init(ATP atp) 42{ 43 ASP asp; 44 45 if (( asp = (struct ASP *)calloc(1, sizeof( struct ASP ))) == NULL ) { 46 return( NULL ); 47 } 48 49 asp->asp_atp = atp; 50#ifdef BSD4_4 51 asp->asp_sat.sat_len = sizeof( struct sockaddr_at ); 52#endif /* BSD4_4 */ 53 asp->asp_sat.sat_family = AF_APPLETALK; 54 asp->asp_sat.sat_addr.s_net = ATADDR_ANYNET; 55 asp->asp_sat.sat_addr.s_node = ATADDR_ANYNODE; 56 asp->asp_sat.sat_port = ATADDR_ANYPORT; 57 asp->asp_status = NULL; 58 asp->asp_slen = 0; 59 asp->asp_sid = 0; 60 asp->asp_flags = ASPFL_SLS; 61 asp->cmdlen = asp->datalen = 0; 62 asp->read_count = asp->write_count = 0; 63 asp->commands = asp->cmdbuf + 4; 64 65 return( asp ); 66} 67 68void asp_setstatus(ASP asp, char *status, const int slen) 69{ 70 asp->asp_status = status; 71 asp->asp_slen = slen; 72} 73