nd.h (7c478bd9) nd.h (45916cd2)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
23 * Copyright 1992, 1997-2001, 2003 Sun Microsystems, Inc. All rights reserved.
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26/* Copyright (c) 1990 Mentat Inc. */
27
28#ifndef _INET_ND_H
29#define _INET_ND_H
30
31#pragma ident "%Z%%M% %I% %E% SMI"
32
33#include <sys/types.h>
23 * Use is subject to license terms.
24 */
25/* Copyright (c) 1990 Mentat Inc. */
26
27#ifndef _INET_ND_H
28#define _INET_ND_H
29
30#pragma ident "%Z%%M% %I% %E% SMI"
31
32#include <sys/types.h>
33#include <inet/common.h>
34#include <inet/led.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39#define ND_BASE ('N' << 8) /* base */
40#define ND_GET (ND_BASE + 0) /* Get a value */
41#define ND_SET (ND_BASE + 1) /* Set a value */
42
43#ifdef _KERNEL
44/* ND callback function prototypes */
45typedef int (*ndgetf_t)(queue_t *, MBLKP, caddr_t, cred_t *);
46typedef int (*ndsetf_t)(queue_t *, MBLKP, char *, caddr_t, cred_t *);
47
48/* Named dispatch table entry */
49typedef struct nde_s {
50 char *nde_name;
51 pfi_t nde_get_pfi;
52 pfi_t nde_set_pfi;
53 caddr_t nde_data;
54} NDE;
55
56/* Name dispatch table */
57typedef struct nd_s {
58 int nd_free_count; /* number of unused nd table entries */
59 int nd_size; /* size (in bytes) of current table */
60 NDE *nd_tbl; /* pointer to table in heap */
61} ND;
62
63#define NDE_ALLOC_COUNT 32
64#define NDE_ALLOC_SIZE (sizeof (NDE) * NDE_ALLOC_COUNT)
65
66/* 64K STREAM limit - the max ndd info header. */
67#define ND_MAX_BUF_LEN 65303
68
69/*
70 * See uts/common/inet/nd.c for comments on how to use these routines.
71 */
72extern boolean_t nd_load(caddr_t *, char *, ndgetf_t, ndsetf_t, caddr_t);
73extern void nd_unload(caddr_t *, char *);
74extern void nd_free(caddr_t *);
75extern int nd_getset(queue_t *, caddr_t, MBLKP);
76
77/*
78 * Canned nd_get and nd_set routines for use with nd_load().
79 */
80extern int nd_get_default(queue_t *, MBLKP, caddr_t, cred_t *);
81extern int nd_get_long(queue_t *, MBLKP, caddr_t, cred_t *);
82extern int nd_get_names(queue_t *, MBLKP, caddr_t, cred_t *);
83extern int nd_set_default(queue_t *, MBLKP, char *, caddr_t, cred_t *);
84extern int nd_set_long(queue_t *, MBLKP, char *, caddr_t, cred_t *);
85
86#endif /* _KERNEL */
87
88#ifdef __cplusplus
89}
90#endif
91
92#endif /* _INET_ND_H */
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40#define ND_BASE ('N' << 8) /* base */
41#define ND_GET (ND_BASE + 0) /* Get a value */
42#define ND_SET (ND_BASE + 1) /* Set a value */
43
44#ifdef _KERNEL
45/* ND callback function prototypes */
46typedef int (*ndgetf_t)(queue_t *, MBLKP, caddr_t, cred_t *);
47typedef int (*ndsetf_t)(queue_t *, MBLKP, char *, caddr_t, cred_t *);
48
49/* Named dispatch table entry */
50typedef struct nde_s {
51 char *nde_name;
52 pfi_t nde_get_pfi;
53 pfi_t nde_set_pfi;
54 caddr_t nde_data;
55} NDE;
56
57/* Name dispatch table */
58typedef struct nd_s {
59 int nd_free_count; /* number of unused nd table entries */
60 int nd_size; /* size (in bytes) of current table */
61 NDE *nd_tbl; /* pointer to table in heap */
62} ND;
63
64#define NDE_ALLOC_COUNT 32
65#define NDE_ALLOC_SIZE (sizeof (NDE) * NDE_ALLOC_COUNT)
66
67/* 64K STREAM limit - the max ndd info header. */
68#define ND_MAX_BUF_LEN 65303
69
70/*
71 * See uts/common/inet/nd.c for comments on how to use these routines.
72 */
73extern boolean_t nd_load(caddr_t *, char *, ndgetf_t, ndsetf_t, caddr_t);
74extern void nd_unload(caddr_t *, char *);
75extern void nd_free(caddr_t *);
76extern int nd_getset(queue_t *, caddr_t, MBLKP);
77
78/*
79 * Canned nd_get and nd_set routines for use with nd_load().
80 */
81extern int nd_get_default(queue_t *, MBLKP, caddr_t, cred_t *);
82extern int nd_get_long(queue_t *, MBLKP, caddr_t, cred_t *);
83extern int nd_get_names(queue_t *, MBLKP, caddr_t, cred_t *);
84extern int nd_set_default(queue_t *, MBLKP, char *, caddr_t, cred_t *);
85extern int nd_set_long(queue_t *, MBLKP, char *, caddr_t, cred_t *);
86
87#endif /* _KERNEL */
88
89#ifdef __cplusplus
90}
91#endif
92
93#endif /* _INET_ND_H */