xref: /illumos-gate/usr/src/uts/common/inet/nd.h (revision 2d6eb4a5)
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 #include <sys/types.h>
31*45916cd2Sjpk #include <inet/common.h>
32*45916cd2Sjpk #include <inet/led.h>
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
357c478bd9Sstevel@tonic-gate extern "C" {
367c478bd9Sstevel@tonic-gate #endif
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #define	ND_BASE		('N' << 8)	/* base */
397c478bd9Sstevel@tonic-gate #define	ND_GET		(ND_BASE + 0)	/* Get a value */
407c478bd9Sstevel@tonic-gate #define	ND_SET		(ND_BASE + 1)	/* Set a value */
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
437c478bd9Sstevel@tonic-gate /* ND callback function prototypes */
447c478bd9Sstevel@tonic-gate typedef	int (*ndgetf_t)(queue_t *, MBLKP, caddr_t, cred_t *);
457c478bd9Sstevel@tonic-gate typedef	int (*ndsetf_t)(queue_t *, MBLKP, char *, caddr_t, cred_t *);
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /* Named dispatch table entry */
487c478bd9Sstevel@tonic-gate typedef struct  nde_s {
497c478bd9Sstevel@tonic-gate 	char    *nde_name;
507c478bd9Sstevel@tonic-gate 	pfi_t	nde_get_pfi;
517c478bd9Sstevel@tonic-gate 	pfi_t	nde_set_pfi;
527c478bd9Sstevel@tonic-gate 	caddr_t nde_data;
537c478bd9Sstevel@tonic-gate } NDE;
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate /* Name dispatch table */
567c478bd9Sstevel@tonic-gate typedef struct  nd_s {
577c478bd9Sstevel@tonic-gate 	int	nd_free_count;	/* number of unused nd table entries */
587c478bd9Sstevel@tonic-gate 	int	nd_size;	/* size (in bytes) of current table */
597c478bd9Sstevel@tonic-gate 	NDE	*nd_tbl;	/* pointer to table in heap */
607c478bd9Sstevel@tonic-gate } ND;
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate #define	NDE_ALLOC_COUNT 32
637c478bd9Sstevel@tonic-gate #define	NDE_ALLOC_SIZE  (sizeof (NDE) * NDE_ALLOC_COUNT)
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate /* 64K STREAM limit - the max ndd info header. */
667c478bd9Sstevel@tonic-gate #define	ND_MAX_BUF_LEN	65303
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate /*
697c478bd9Sstevel@tonic-gate  * See uts/common/inet/nd.c for comments on how to use these routines.
707c478bd9Sstevel@tonic-gate  */
717c478bd9Sstevel@tonic-gate extern boolean_t	nd_load(caddr_t *, char *, ndgetf_t, ndsetf_t, caddr_t);
727c478bd9Sstevel@tonic-gate extern void		nd_unload(caddr_t *, char *);
737c478bd9Sstevel@tonic-gate extern void		nd_free(caddr_t *);
747c478bd9Sstevel@tonic-gate extern int		nd_getset(queue_t *, caddr_t, MBLKP);
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate /*
777c478bd9Sstevel@tonic-gate  * Canned nd_get and nd_set routines for use with nd_load().
787c478bd9Sstevel@tonic-gate  */
797c478bd9Sstevel@tonic-gate extern int	nd_get_default(queue_t *, MBLKP, caddr_t, cred_t *);
807c478bd9Sstevel@tonic-gate extern int	nd_get_long(queue_t *, MBLKP, caddr_t, cred_t *);
817c478bd9Sstevel@tonic-gate extern int	nd_get_names(queue_t *, MBLKP, caddr_t, cred_t *);
827c478bd9Sstevel@tonic-gate extern int	nd_set_default(queue_t *, MBLKP, char *, caddr_t, cred_t *);
837c478bd9Sstevel@tonic-gate extern int	nd_set_long(queue_t *, MBLKP, char *, caddr_t, cred_t *);
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
887c478bd9Sstevel@tonic-gate }
897c478bd9Sstevel@tonic-gate #endif
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate #endif	/* _INET_ND_H */
92