]> git.saurik.com Git - apple/xnu.git/blame - bsd/netat/nbp.h
xnu-792.2.4.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 *
e5568f75
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.
1c79356b 11 *
e5568f75
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
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
e5568f75
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.
1c79356b
A
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 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 {
94 unsigned control : 4,
95 tuple_count : 4;
96 u_char at_nbp_id;
97 at_nbptuple_t tuple[NBP_TUPLE_MAX];
98} at_nbp_t;
99
100#define DEFAULT_ZONE(zone) (!(zone)->len || ((zone)->len == 1 && (zone)->str[0] == '*'))
101
91447636 102#ifdef KERNEL_PRIVATE
1c79356b
A
103
104/* Struct for name registry */
105typedef struct _nve_ {
106 TAILQ_ENTRY(_nve_) nve_link; /* tailq macro glue */
107 gbuf_t *tag; /*pointer to the parent gbuf_t*/
108 /* *** there's no reason why tag has to
109 be an mbuf *** */
110 at_nvestr_t zone;
111 u_int zone_hash;
112 at_nvestr_t object;
113 u_int object_hash;
114 at_nvestr_t type;
115 u_int type_hash;
116 at_inet_t address;
117 u_char ddptype;
118 u_char enumerator;
119 int pid;
120 long unique_nbp_id; /* long to be compatible with OT */
121} nve_entry_t;
122
123#define NBP_WILD_OBJECT 0x01
124#define NBP_WILD_TYPE 0x02
125#define NBP_WILD_MASK 0x03
126
91447636
A
127struct nbp_req;
128typedef struct nbp_req nbp_req_t;
129struct nbp_req {
130 int (*func)(nbp_req_t *, nve_entry_t *);
1c79356b
A
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 */
91447636 140};
1c79356b
A
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 *);
91447636 145extern int nbp_fillin_nve(at_entity_t *, nve_entry_t *);
1c79356b
A
146
147extern at_nvestr_t *getSPLocalZone(int);
148extern at_nvestr_t *getLocalZone(int);
149
91447636
A
150#endif /* KERNEL_PRIVATE */
151#endif /* __APPLE_API_OBSOLETE */
1c79356b 152#endif /* _NETAT_NBP_H_ */