xnu-344.2.tar.gz
[apple/xnu.git] / bsd / netat / nbp.h
CommitLineData
1c79356b
A
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_
9bccf70c 55#include <sys/appleapiopts.h>
1c79356b
A
56
57/* NBP packet types */
58
59#define NBP_BRRQ 0x01 /* Broadcast request */
60#define NBP_LKUP 0x02 /* Lookup */
61#define NBP_LKUP_REPLY 0x03 /* Lookup reply */
62#define NBP_FWDRQ 0x04 /* Forward Request (router only) */
63
64/* *** the following may be discontinued in the near future *** */
65
66#define NBP_CONFIRM 0x09 /* Confirm, not sent on wire */
67
68#ifdef NOT_USED
69#define NBP_REGISTER 0x07 /* Register a name */
70#define NBP_DELETE 0x08 /* Delete a name */
71#define NBP_STATUS_REPLY 0x0a /* Status on register/delete */
72#define NBP_CLOSE_NOTE 0x0b /* Close notification from DDP */
73#endif
74
75/* *** **************************************************** *** */
76
77/* Protocol defaults */
78
79#define NBP_RETRY_COUNT 8 /* Maximum repeats */
80#define NBP_RETRY_INTERVAL 1 /* Retry timeout */
81
82/* Special (partial) wildcard character */
83#define NBP_SPL_WILDCARD 0xC5
84#define NBP_ORD_WILDCARD '='
85
86/* Packet definitions */
87
88#define NBP_TUPLE_MAX 15 /* Maximum number of tuples in one DDP packet */
89#define NBP_HDR_SIZE 2
90
91typedef struct at_nbp {
92 unsigned control : 4,
93 tuple_count : 4;
94 u_char at_nbp_id;
95 at_nbptuple_t tuple[NBP_TUPLE_MAX];
96} at_nbp_t;
97
98#define DEFAULT_ZONE(zone) (!(zone)->len || ((zone)->len == 1 && (zone)->str[0] == '*'))
99
100#ifdef KERNEL
9bccf70c 101#ifdef __APPLE_API_PRIVATE
1c79356b
A
102
103/* Struct for name registry */
104typedef struct _nve_ {
105 TAILQ_ENTRY(_nve_) nve_link; /* tailq macro glue */
106 gbuf_t *tag; /*pointer to the parent gbuf_t*/
107 /* *** there's no reason why tag has to
108 be an mbuf *** */
109 at_nvestr_t zone;
110 u_int zone_hash;
111 at_nvestr_t object;
112 u_int object_hash;
113 at_nvestr_t type;
114 u_int type_hash;
115 at_inet_t address;
116 u_char ddptype;
117 u_char enumerator;
118 int pid;
119 long unique_nbp_id; /* long to be compatible with OT */
120} nve_entry_t;
121
122#define NBP_WILD_OBJECT 0x01
123#define NBP_WILD_TYPE 0x02
124#define NBP_WILD_MASK 0x03
125
126typedef struct nbp_req {
127 int (*func)();
128 gbuf_t *response; /* the response datagram */
129 int space_unused; /* Space available in the resp */
130 /* packet. */
131 gbuf_t *request; /* The request datagram */
132 /* Saved for return address */
133 nve_entry_t nve;
134 u_char flags; /* Flags to indicate whether or */
135 /* not the request tuple has */
136 /* wildcards in it */
137} nbp_req_t;
138
139extern int nbp_insert_entry(nve_entry_t *);
140extern u_int nbp_strhash (at_nvestr_t *);
141extern nve_entry_t *nbp_find_nve(nve_entry_t *);
142extern int nbp_fillin_nve();
143
144extern at_nvestr_t *getSPLocalZone(int);
145extern at_nvestr_t *getLocalZone(int);
146
9bccf70c 147#endif /* __APPLE_API_PRIVATE */
1c79356b
A
148#endif /* KERNEL */
149#endif /* _NETAT_NBP_H_ */