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