]> git.saurik.com Git - apple/xnu.git/blob - bsd/netat/nbp.h
f92a945032f0657cc85c4604be1b54c3819766fd
[apple/xnu.git] / bsd / netat / nbp.h
1 /*
2 * Copyright (c) 2006 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 unsigned control : 4,
103 tuple_count : 4;
104 u_char at_nbp_id;
105 at_nbptuple_t tuple[NBP_TUPLE_MAX];
106 } at_nbp_t;
107
108 #define DEFAULT_ZONE(zone) (!(zone)->len || ((zone)->len == 1 && (zone)->str[0] == '*'))
109
110 #ifdef KERNEL_PRIVATE
111
112 /* Struct for name registry */
113 typedef struct _nve_ {
114 TAILQ_ENTRY(_nve_) nve_link; /* tailq macro glue */
115 gbuf_t *tag; /*pointer to the parent gbuf_t*/
116 /* *** there's no reason why tag has to
117 be an mbuf *** */
118 at_nvestr_t zone;
119 u_int zone_hash;
120 at_nvestr_t object;
121 u_int object_hash;
122 at_nvestr_t type;
123 u_int type_hash;
124 at_inet_t address;
125 u_char ddptype;
126 u_char enumerator;
127 int pid;
128 long unique_nbp_id; /* long to be compatible with OT */
129 } nve_entry_t;
130
131 #define NBP_WILD_OBJECT 0x01
132 #define NBP_WILD_TYPE 0x02
133 #define NBP_WILD_MASK 0x03
134
135 struct nbp_req;
136 typedef struct nbp_req nbp_req_t;
137 struct nbp_req {
138 int (*func)(nbp_req_t *, nve_entry_t *);
139 gbuf_t *response; /* the response datagram */
140 int space_unused; /* Space available in the resp */
141 /* packet. */
142 gbuf_t *request; /* The request datagram */
143 /* Saved for return address */
144 nve_entry_t nve;
145 u_char flags; /* Flags to indicate whether or */
146 /* not the request tuple has */
147 /* wildcards in it */
148 };
149
150 extern int nbp_insert_entry(nve_entry_t *);
151 extern u_int nbp_strhash (at_nvestr_t *);
152 extern nve_entry_t *nbp_find_nve(nve_entry_t *);
153 extern int nbp_fillin_nve(at_entity_t *, nve_entry_t *);
154
155 extern at_nvestr_t *getSPLocalZone(int);
156 extern at_nvestr_t *getLocalZone(int);
157
158 #endif /* KERNEL_PRIVATE */
159 #endif /* __APPLE_API_OBSOLETE */
160 #endif /* _NETAT_NBP_H_ */