]> arthur.barton.de Git - netatalk.git/blob - etc/atalkd/aep.c
CVS id tags, define fixes, code beautification
[netatalk.git] / etc / atalkd / aep.c
1 /*
2  * $Id: aep.c,v 1.4 2001-06-25 20:13:45 rufustfirefly Exp $
3  *
4  * Copyright (c) 1990,1993 Regents of The University of Michigan.
5  * All Rights Reserved. See COPYRIGHT.
6  */
7
8 #ifdef HAVE_CONFIG_H
9 #include "config.h"
10 #endif /* HAVE_CONFIG_H */
11
12 #include <sys/syslog.h>
13 #include <sys/types.h>
14 #include <sys/socket.h>
15 #include <netatalk/at.h>
16 #include <atalk/aep.h>
17 #include <atalk/ddp.h>
18
19 #include "atserv.h"
20
21 int aep_packet( ap, from, data, len )
22     struct atport       *ap;
23     struct sockaddr_at  *from;
24     char                *data;
25     int                 len;
26 {
27     char                *end;
28
29     end = data + len;
30     if ( data + 2 > end || *data != DDPTYPE_AEP ||
31             *( data + 1 ) != AEPOP_REQUEST ) {
32         syslog( LOG_INFO, "aep_packet malformed packet" );
33         return 1;
34     }
35
36     *( data + 1 ) = AEPOP_REPLY;
37     if ( sendto( ap->ap_fd, data, len, 0, (struct sockaddr *)from,
38             sizeof( struct sockaddr_at )) < 0 ) {
39         syslog( LOG_ERR, "aep sendto: %m" );
40         return 1;
41     }
42
43     return 0;
44 }