]> git.saurik.com Git - apple/xnu.git/blob - bsd/net/if_blue.h
xnu-201.42.3.tar.gz
[apple/xnu.git] / bsd / net / if_blue.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /* Copyright (c) 1997, 1998 Apple Computer, Inc. All Rights Reserved */
23 /*
24 * @(#)if_blue.h 1.1 (MacOSX) 6/10/43
25 * Justin Walker
26 * 970520 - First version
27 * 980130 - Second version - performance improvements
28 */
29
30 #ifndef _IF_BLUE_H
31 #define _IF_BLUE_H
32
33 #define BLUE_DEBUG 0
34
35 /*
36 * Y-adapter filter mechanism.
37 * Specifies the Atalk or IP network address of this node.
38 * If BF_ALLOC is set and BF_VALID is not, the corresponding
39 * protocol type should be captured.
40 */
41 struct BlueFilter
42 {
43 #define IFNAMSIZ 16
44 char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
45 short BF_flags;
46 unsigned long BF_address; /* IP address or Atalk Network # */
47 unsigned char BF_node; /* Atalk node # */
48 #ifdef notyet
49 struct ifnet *BF_if; /* Destination of "passed" pkts */
50 #endif
51 };
52
53 #define BF_ALLOC 0x01 /* Entry in use */
54 #define BF_DEALLOC 0x02 /* Clear matching entry */
55 #define BF_VALID 0x04 /* Address is valid */
56 #define BF_ATALK 0x08 /* Appletalk network address */
57 #define BF_IP 0x10 /* IP network address */
58
59 struct Ystats
60 { char YS_name[IFNAMSIZ]; /* if name, e.g. "en0" */
61 struct BlueFilter YS_filter[2];
62 pid_t YS_blue_pid;
63 int YS_pkts_up;
64 int YS_pkts_out;
65 int YS_pkts_looped_r2b;
66 int YS_pkts_looped_b2r;
67 int YS_no_bufs1;
68 int YS_no_bufs2;
69 int YS_full_sockbuf;
70 };
71
72 struct ifnet_blue
73 { struct ifnet ifb_ifn;
74 struct socket *ifb_so;
75 pid_t blue_pid;
76 int sig_to_send;
77 int sig_sent; /* Set when new pkt arrives; cleared when mt */
78 struct BlueFilter filter[2]; /* Only need to check IP, A/talk */
79 /* Stats */
80 int pkts_up;
81 int pkts_out;
82 int pkts_looped_r2b;
83 int pkts_looped_b2r;
84 int no_bufs1; /* splitter_input got null mbuf */
85 int no_bufs2; /* ndrv_output couldn't dup mbuf */
86 int full_sockbuf;
87 };
88
89 /* Preallocate slots in blue_if to simplify filtering */
90 #define BFS_ATALK 0x0 /* The Atalk filter */
91 #define BFS_IP 0x1 /* The IP filter */
92
93 #define SIOCSSPLITTER _IOW('i', 123, struct ifreq) /* set 'splitter' */
94 #define SIOCGSPLITTER _IOR('i', 122, struct ifreq) /* get 'splitter' */
95 #define SIOCGSPLTSTAT _IOWR('i', 121, struct Ystats)
96 #define SIOCSSPLTFILT _IOW('i', 120, struct BlueFilter)
97 #define SIOCZSPLTSTAT _IO('i', 119) /* Clear stats */
98
99 /*
100 * Config structure for the Y adapter - NYI
101 */
102 struct if_splitter
103 { char ifs_on; /* 1=>on */
104 char ifs_qmax; /* !0 => maxqlen */
105 short ifs_wait; /* Time to wait for signal */
106 short ifs_sig; /* Signal to send */
107 short ifs_pad; /* Extra space */
108 };
109
110 #ifdef KERNEL
111 extern struct ifqueue blueq; /* Place to put incoming BB packets */
112
113 #define BFCount 10
114 extern struct BlueFilter RhapFilter[]; /* Filters for MacOSX side */
115 extern int BFIx;
116 #endif
117 #endif /* _IF_BLUE_H */