at_proto.c revision 15885
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/param.h>
25#include <sys/systm.h>
26#include <sys/protosw.h>
27#include <sys/domain.h>
28#include <sys/types.h>
29#include <sys/socket.h>
30
31#if defined( __FreeBSD__ )
32#include <sys/kernel.h>
33#include <net/if.h>
34#include <net/radix.h>
35#include <netinet/in.h>
36#include <netinet/if_ether.h>
37#include <net/route.h>
38#endif
39
40#include "at.h"
41#include "ddp.h"
42#include "at_var.h"
43#include "ddp_var.h"
44#include <netatalk/at_extern.h>
45
46
47#ifdef ultrix
48extern int		ddp_ifoutput();
49extern int		ddp_ifinput();
50extern int		ddp_ifioctl();
51#endif ultrix
52
53struct protosw		atalksw[] = {
54    {
55	/* Identifiers */
56	SOCK_DGRAM,	&atalkdomain,	ATPROTO_DDP,	PR_ATOMIC|PR_ADDR,
57	/*
58	 * protocol-protocol interface.
59	 * fields are pr_input, pr_output, pr_ctlinput, and pr_ctloutput.
60	 * pr_input can be called from the udp protocol stack for iptalk
61	 * packets bound for a local socket.
62	 * pr_output can be used by higher level appletalk protocols, should
63	 * they be included in the kernel.
64	 */
65	0,		ddp_output,	0,		0,
66	/* socket-protocol interface. */
67	ddp_usrreq,
68	/* utility routines. */
69	ddp_init,	0,		0,		0,
70#ifdef ultrix
71	/* interface hooks */
72	ddp_ifoutput,	ddp_ifinput,	ddp_ifioctl,	0,
73#endif ultrix
74    },
75};
76
77#if defined( __FreeBSD__ ) && defined ( NETATALKDEBUG )
78extern int at_inithead();
79#endif
80
81struct domain		atalkdomain = {
82    AF_APPLETALK,	"appletalk",	0,	0,	0,
83    atalksw, &atalksw[sizeof(atalksw)/sizeof(atalksw[0])]
84#if defined( __FreeBSD__ )
85#ifdef NETATALKDEBUG
86	, 0, at_inithead, 32, sizeof(struct sockaddr_at)
87#else
88	, 0, rn_inithead, 32, sizeof(struct sockaddr_at)
89#endif
90#endif
91};
92
93#if defined( __FreeBSD__ )
94DOMAIN_SET(atalk);
95#endif
96