]> git.saurik.com Git - apple/xnu.git/blame - bsd/netat/nbp.h
xnu-792.25.20.tar.gz
[apple/xnu.git] / bsd / netat / nbp.h
CommitLineData
1c79356b 1/*
5d5c5d0d
A
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
6601e61a 4 * @APPLE_LICENSE_HEADER_START@
1c79356b 5 *
6601e61a
A
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.
8f6c56a5 11 *
6601e61a
A
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
8f6c56a5
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
6601e61a
A
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.
8f6c56a5 19 *
6601e61a 20 * @APPLE_LICENSE_HEADER_END@
1c79356b
A
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_
9bccf70c 55#include <sys/appleapiopts.h>
1c79356b 56
91447636
A
57#ifdef __APPLE_API_OBSOLETE
58
1c79356b
A
59/* NBP packet types */
60
61#define NBP_BRRQ 0x01 /* Broadcast request */
62#define NBP_LKUP 0x02 /* Lookup */
63#define NBP_LKUP_REPLY 0x03 /* Lookup reply */
64#define NBP_FWDRQ 0x04 /* Forward Request (router only) */
65
66/* *** the following may be discontinued in the near future *** */
67
68#define NBP_CONFIRM 0x09 /* Confirm, not sent on wire */
69
70#ifdef NOT_USED
71#define NBP_REGISTER 0x07 /* Register a name */
72#define NBP_DELETE 0x08 /* Delete a name */
73#define NBP_STATUS_REPLY 0x0a /* Status on register/delete */
74#define NBP_CLOSE_NOTE 0x0b /* Close notification from DDP */
75#endif
76
77/* *** **************************************************** *** */
78
79/* Protocol defaults */
80
81#define NBP_RETRY_COUNT 8 /* Maximum repeats */
82#define NBP_RETRY_INTERVAL 1 /* Retry timeout */
83
84/* Special (partial) wildcard character */
85#define NBP_SPL_WILDCARD 0xC5
86#define NBP_ORD_WILDCARD '='
87
88/* Packet definitions */
89
90#define NBP_TUPLE_MAX 15 /* Maximum number of tuples in one DDP packet */
91#define NBP_HDR_SIZE 2
92
93typedef struct at_nbp {
0c530ab8
A
94#if BYTE_ORDER == BIG_ENDIAN
95 unsigned
96 control : 4,
97 tuple_count : 4;
98#endif
99#if BYTE_ORDER == LITTLE_ENDIAN
100 unsigned
101 tuple_count : 4,
102 control : 4;
103#endif
1c79356b
A
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
91447636 110#ifdef KERNEL_PRIVATE
1c79356b
A
111
112/* Struct for name registry */
113typedef 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
91447636
A
135struct nbp_req;
136typedef struct nbp_req nbp_req_t;
137struct nbp_req {
138 int (*func)(nbp_req_t *, nve_entry_t *);
1c79356b
A
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 */
91447636 148};
1c79356b
A
149
150extern int nbp_insert_entry(nve_entry_t *);
151extern u_int nbp_strhash (at_nvestr_t *);
152extern nve_entry_t *nbp_find_nve(nve_entry_t *);
91447636 153extern int nbp_fillin_nve(at_entity_t *, nve_entry_t *);
1c79356b
A
154
155extern at_nvestr_t *getSPLocalZone(int);
156extern at_nvestr_t *getLocalZone(int);
157
91447636
A
158#endif /* KERNEL_PRIVATE */
159#endif /* __APPLE_API_OBSOLETE */
1c79356b 160#endif /* _NETAT_NBP_H_ */