]>
Commit | Line | Data |
---|---|---|
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 | /* | |
23 | * | |
24 | * | |
25 | * ORIGINS: 82 | |
26 | * | |
27 | * (C) COPYRIGHT Apple Computer, Inc. 1992-1996 | |
28 | * All Rights Reserved | |
29 | * | |
30 | */ | |
31 | /* | |
32 | * Copyright (c) 1988, 1989 Apple Computer, Inc. | |
33 | * | |
34 | * The information contained herein is subject to change without | |
35 | * notice and should not be construed as a commitment by Apple | |
36 | * Computer, Inc. Apple Computer, Inc. assumes no responsibility | |
37 | * for any errors that may appear. | |
38 | * | |
39 | * Confidential and Proprietary to Apple Computer, Inc. | |
40 | */ | |
41 | /* | |
42 | * Title: nbp.h | |
43 | * | |
44 | * Facility: Include file for NBP kernel module. | |
45 | * | |
46 | * Author: Kumar Vora, Creation Date: May-1-1989 | |
47 | * | |
48 | * History: | |
49 | * X01-001 Kumar Vora May-1-1989 | |
50 | * Initial Creation. | |
51 | */ | |
52 | ||
53 | #ifndef _NETAT_NBP_H_ | |
54 | #define _NETAT_NBP_H_ | |
55 | ||
56 | /* NBP packet types */ | |
57 | ||
58 | #define NBP_BRRQ 0x01 /* Broadcast request */ | |
59 | #define NBP_LKUP 0x02 /* Lookup */ | |
60 | #define NBP_LKUP_REPLY 0x03 /* Lookup reply */ | |
61 | #define NBP_FWDRQ 0x04 /* Forward Request (router only) */ | |
62 | ||
63 | /* *** the following may be discontinued in the near future *** */ | |
64 | ||
65 | #define NBP_CONFIRM 0x09 /* Confirm, not sent on wire */ | |
66 | ||
67 | #ifdef NOT_USED | |
68 | #define NBP_REGISTER 0x07 /* Register a name */ | |
69 | #define NBP_DELETE 0x08 /* Delete a name */ | |
70 | #define NBP_STATUS_REPLY 0x0a /* Status on register/delete */ | |
71 | #define NBP_CLOSE_NOTE 0x0b /* Close notification from DDP */ | |
72 | #endif | |
73 | ||
74 | /* *** **************************************************** *** */ | |
75 | ||
76 | /* Protocol defaults */ | |
77 | ||
78 | #define NBP_RETRY_COUNT 8 /* Maximum repeats */ | |
79 | #define NBP_RETRY_INTERVAL 1 /* Retry timeout */ | |
80 | ||
81 | /* Special (partial) wildcard character */ | |
82 | #define NBP_SPL_WILDCARD 0xC5 | |
83 | #define NBP_ORD_WILDCARD '=' | |
84 | ||
85 | /* Packet definitions */ | |
86 | ||
87 | #define NBP_TUPLE_MAX 15 /* Maximum number of tuples in one DDP packet */ | |
88 | #define NBP_HDR_SIZE 2 | |
89 | ||
90 | typedef struct at_nbp { | |
91 | unsigned control : 4, | |
92 | tuple_count : 4; | |
93 | u_char at_nbp_id; | |
94 | at_nbptuple_t tuple[NBP_TUPLE_MAX]; | |
95 | } at_nbp_t; | |
96 | ||
97 | #define DEFAULT_ZONE(zone) (!(zone)->len || ((zone)->len == 1 && (zone)->str[0] == '*')) | |
98 | ||
99 | #ifdef KERNEL | |
100 | ||
101 | /* Struct for name registry */ | |
102 | typedef struct _nve_ { | |
103 | TAILQ_ENTRY(_nve_) nve_link; /* tailq macro glue */ | |
104 | gbuf_t *tag; /*pointer to the parent gbuf_t*/ | |
105 | /* *** there's no reason why tag has to | |
106 | be an mbuf *** */ | |
107 | at_nvestr_t zone; | |
108 | u_int zone_hash; | |
109 | at_nvestr_t object; | |
110 | u_int object_hash; | |
111 | at_nvestr_t type; | |
112 | u_int type_hash; | |
113 | at_inet_t address; | |
114 | u_char ddptype; | |
115 | u_char enumerator; | |
116 | int pid; | |
117 | long unique_nbp_id; /* long to be compatible with OT */ | |
118 | } nve_entry_t; | |
119 | ||
120 | #define NBP_WILD_OBJECT 0x01 | |
121 | #define NBP_WILD_TYPE 0x02 | |
122 | #define NBP_WILD_MASK 0x03 | |
123 | ||
124 | typedef struct nbp_req { | |
125 | int (*func)(); | |
126 | gbuf_t *response; /* the response datagram */ | |
127 | int space_unused; /* Space available in the resp */ | |
128 | /* packet. */ | |
129 | gbuf_t *request; /* The request datagram */ | |
130 | /* Saved for return address */ | |
131 | nve_entry_t nve; | |
132 | u_char flags; /* Flags to indicate whether or */ | |
133 | /* not the request tuple has */ | |
134 | /* wildcards in it */ | |
135 | } nbp_req_t; | |
136 | ||
137 | extern int nbp_insert_entry(nve_entry_t *); | |
138 | extern u_int nbp_strhash (at_nvestr_t *); | |
139 | extern nve_entry_t *nbp_find_nve(nve_entry_t *); | |
140 | extern int nbp_fillin_nve(); | |
141 | ||
142 | extern at_nvestr_t *getSPLocalZone(int); | |
143 | extern at_nvestr_t *getLocalZone(int); | |
144 | ||
145 | #endif /* KERNEL */ | |
146 | #endif /* _NETAT_NBP_H_ */ |