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