]> git.saurik.com Git - apple/xnu.git/blob - bsd/netat/nbp.h
xnu-792.13.8.tar.gz
[apple/xnu.git] / bsd / netat / nbp.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 *
32 *
33 * ORIGINS: 82
34 *
35 * (C) COPYRIGHT Apple Computer, Inc. 1992-1996
36 * All Rights Reserved
37 *
38 */
39 /*
40 * Copyright (c) 1988, 1989 Apple Computer, Inc.
41 *
42 * The information contained herein is subject to change without
43 * notice and should not be construed as a commitment by Apple
44 * Computer, Inc. Apple Computer, Inc. assumes no responsibility
45 * for any errors that may appear.
46 *
47 * Confidential and Proprietary to Apple Computer, Inc.
48 */
49 /*
50 * Title: nbp.h
51 *
52 * Facility: Include file for NBP kernel module.
53 *
54 * Author: Kumar Vora, Creation Date: May-1-1989
55 *
56 * History:
57 * X01-001 Kumar Vora May-1-1989
58 * Initial Creation.
59 */
60
61 #ifndef _NETAT_NBP_H_
62 #define _NETAT_NBP_H_
63 #include <sys/appleapiopts.h>
64
65 #ifdef __APPLE_API_OBSOLETE
66
67 /* NBP packet types */
68
69 #define NBP_BRRQ 0x01 /* Broadcast request */
70 #define NBP_LKUP 0x02 /* Lookup */
71 #define NBP_LKUP_REPLY 0x03 /* Lookup reply */
72 #define NBP_FWDRQ 0x04 /* Forward Request (router only) */
73
74 /* *** the following may be discontinued in the near future *** */
75
76 #define NBP_CONFIRM 0x09 /* Confirm, not sent on wire */
77
78 #ifdef NOT_USED
79 #define NBP_REGISTER 0x07 /* Register a name */
80 #define NBP_DELETE 0x08 /* Delete a name */
81 #define NBP_STATUS_REPLY 0x0a /* Status on register/delete */
82 #define NBP_CLOSE_NOTE 0x0b /* Close notification from DDP */
83 #endif
84
85 /* *** **************************************************** *** */
86
87 /* Protocol defaults */
88
89 #define NBP_RETRY_COUNT 8 /* Maximum repeats */
90 #define NBP_RETRY_INTERVAL 1 /* Retry timeout */
91
92 /* Special (partial) wildcard character */
93 #define NBP_SPL_WILDCARD 0xC5
94 #define NBP_ORD_WILDCARD '='
95
96 /* Packet definitions */
97
98 #define NBP_TUPLE_MAX 15 /* Maximum number of tuples in one DDP packet */
99 #define NBP_HDR_SIZE 2
100
101 typedef struct at_nbp {
102 #if BYTE_ORDER == BIG_ENDIAN
103 unsigned
104 control : 4,
105 tuple_count : 4;
106 #endif
107 #if BYTE_ORDER == LITTLE_ENDIAN
108 unsigned
109 tuple_count : 4,
110 control : 4;
111 #endif
112 u_char at_nbp_id;
113 at_nbptuple_t tuple[NBP_TUPLE_MAX];
114 } at_nbp_t;
115
116 #define DEFAULT_ZONE(zone) (!(zone)->len || ((zone)->len == 1 && (zone)->str[0] == '*'))
117
118 #ifdef KERNEL_PRIVATE
119
120 /* Struct for name registry */
121 typedef struct _nve_ {
122 TAILQ_ENTRY(_nve_) nve_link; /* tailq macro glue */
123 gbuf_t *tag; /*pointer to the parent gbuf_t*/
124 /* *** there's no reason why tag has to
125 be an mbuf *** */
126 at_nvestr_t zone;
127 u_int zone_hash;
128 at_nvestr_t object;
129 u_int object_hash;
130 at_nvestr_t type;
131 u_int type_hash;
132 at_inet_t address;
133 u_char ddptype;
134 u_char enumerator;
135 int pid;
136 long unique_nbp_id; /* long to be compatible with OT */
137 } nve_entry_t;
138
139 #define NBP_WILD_OBJECT 0x01
140 #define NBP_WILD_TYPE 0x02
141 #define NBP_WILD_MASK 0x03
142
143 struct nbp_req;
144 typedef struct nbp_req nbp_req_t;
145 struct nbp_req {
146 int (*func)(nbp_req_t *, nve_entry_t *);
147 gbuf_t *response; /* the response datagram */
148 int space_unused; /* Space available in the resp */
149 /* packet. */
150 gbuf_t *request; /* The request datagram */
151 /* Saved for return address */
152 nve_entry_t nve;
153 u_char flags; /* Flags to indicate whether or */
154 /* not the request tuple has */
155 /* wildcards in it */
156 };
157
158 extern int nbp_insert_entry(nve_entry_t *);
159 extern u_int nbp_strhash (at_nvestr_t *);
160 extern nve_entry_t *nbp_find_nve(nve_entry_t *);
161 extern int nbp_fillin_nve(at_entity_t *, nve_entry_t *);
162
163 extern at_nvestr_t *getSPLocalZone(int);
164 extern at_nvestr_t *getLocalZone(int);
165
166 #endif /* KERNEL_PRIVATE */
167 #endif /* __APPLE_API_OBSOLETE */
168 #endif /* _NETAT_NBP_H_ */