2 * Copyright (c) 1990,1991 Regents of The University of Michigan.
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.
15 * Research Systems Unix Group
16 * The University of Michigan
18 * 535 W. William Street
21 * netatalk@itd.umich.edu
26 #include <sys/types.h>
28 #include <sys/param.h>
30 #include <netatalk/at.h>
31 #include <netatalk/endian.h>
33 #include <atalk/netddp.h>
34 #include <atalk/ddp.h>
35 #include <atalk/atp.h>
37 #include "atp_internals.h"
39 ATP atp_open(port, saddr)
41 const struct at_addr *saddr;
43 struct sockaddr_at addr;
50 printf( "<%d> atp_open\n", getpid());
53 memset(&addr, 0, sizeof(addr));
56 memcpy(&addr.sat_addr, saddr, sizeof(struct at_addr));
57 if ((s = netddp_open(&addr, NULL)) < 0)
60 if (( atp = (ATP) atp_alloc_buf()) == NULL ) {
65 /* initialize the atp handle */
66 memset(atp, 0, sizeof( struct atp_handle ));
67 memcpy(&atp->atph_saddr, &addr, sizeof(addr));
71 gettimeofday( &tv, (struct timezone *) 0 );
73 atp->atph_tid = tv.tv_sec ^ ((( pid << 8 ) & 0xff00 ) | ( pid >> 8 ));