xref: /titanic_51/usr/src/uts/common/inet/nd.h (revision 45916cd2fec6e79bca5dee0421bd39e3c2910d1e)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*45916cd2Sjpk  * Common Development and Distribution License (the "License").
6*45916cd2Sjpk  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*45916cd2Sjpk  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate /* Copyright (c) 1990 Mentat Inc. */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef _INET_ND_H
287c478bd9Sstevel@tonic-gate #define	_INET_ND_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #include <sys/types.h>
33*45916cd2Sjpk #include <inet/common.h>
34*45916cd2Sjpk #include <inet/led.h>
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
377c478bd9Sstevel@tonic-gate extern "C" {
387c478bd9Sstevel@tonic-gate #endif
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #define	ND_BASE		('N' << 8)	/* base */
417c478bd9Sstevel@tonic-gate #define	ND_GET		(ND_BASE + 0)	/* Get a value */
427c478bd9Sstevel@tonic-gate #define	ND_SET		(ND_BASE + 1)	/* Set a value */
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
457c478bd9Sstevel@tonic-gate /* ND callback function prototypes */
467c478bd9Sstevel@tonic-gate typedef	int (*ndgetf_t)(queue_t *, MBLKP, caddr_t, cred_t *);
477c478bd9Sstevel@tonic-gate typedef	int (*ndsetf_t)(queue_t *, MBLKP, char *, caddr_t, cred_t *);
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate /* Named dispatch table entry */
507c478bd9Sstevel@tonic-gate typedef struct  nde_s {
517c478bd9Sstevel@tonic-gate 	char    *nde_name;
527c478bd9Sstevel@tonic-gate 	pfi_t	nde_get_pfi;
537c478bd9Sstevel@tonic-gate 	pfi_t	nde_set_pfi;
547c478bd9Sstevel@tonic-gate 	caddr_t nde_data;
557c478bd9Sstevel@tonic-gate } NDE;
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate /* Name dispatch table */
587c478bd9Sstevel@tonic-gate typedef struct  nd_s {
597c478bd9Sstevel@tonic-gate 	int	nd_free_count;	/* number of unused nd table entries */
607c478bd9Sstevel@tonic-gate 	int	nd_size;	/* size (in bytes) of current table */
617c478bd9Sstevel@tonic-gate 	NDE	*nd_tbl;	/* pointer to table in heap */
627c478bd9Sstevel@tonic-gate } ND;
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate #define	NDE_ALLOC_COUNT 32
657c478bd9Sstevel@tonic-gate #define	NDE_ALLOC_SIZE  (sizeof (NDE) * NDE_ALLOC_COUNT)
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate /* 64K STREAM limit - the max ndd info header. */
687c478bd9Sstevel@tonic-gate #define	ND_MAX_BUF_LEN	65303
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate /*
717c478bd9Sstevel@tonic-gate  * See uts/common/inet/nd.c for comments on how to use these routines.
727c478bd9Sstevel@tonic-gate  */
737c478bd9Sstevel@tonic-gate extern boolean_t	nd_load(caddr_t *, char *, ndgetf_t, ndsetf_t, caddr_t);
747c478bd9Sstevel@tonic-gate extern void		nd_unload(caddr_t *, char *);
757c478bd9Sstevel@tonic-gate extern void		nd_free(caddr_t *);
767c478bd9Sstevel@tonic-gate extern int		nd_getset(queue_t *, caddr_t, MBLKP);
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate /*
797c478bd9Sstevel@tonic-gate  * Canned nd_get and nd_set routines for use with nd_load().
807c478bd9Sstevel@tonic-gate  */
817c478bd9Sstevel@tonic-gate extern int	nd_get_default(queue_t *, MBLKP, caddr_t, cred_t *);
827c478bd9Sstevel@tonic-gate extern int	nd_get_long(queue_t *, MBLKP, caddr_t, cred_t *);
837c478bd9Sstevel@tonic-gate extern int	nd_get_names(queue_t *, MBLKP, caddr_t, cred_t *);
847c478bd9Sstevel@tonic-gate extern int	nd_set_default(queue_t *, MBLKP, char *, caddr_t, cred_t *);
857c478bd9Sstevel@tonic-gate extern int	nd_set_long(queue_t *, MBLKP, char *, caddr_t, cred_t *);
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
907c478bd9Sstevel@tonic-gate }
917c478bd9Sstevel@tonic-gate #endif
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate #endif	/* _INET_ND_H */
94