10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*1676Sjpk * Common Development and Distribution License (the "License"). 6*1676Sjpk * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*1676Sjpk * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate /* Copyright (c) 1990 Mentat Inc. */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _INET_ND_H 280Sstevel@tonic-gate #define _INET_ND_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate #include <sys/types.h> 33*1676Sjpk #include <inet/common.h> 34*1676Sjpk #include <inet/led.h> 350Sstevel@tonic-gate 360Sstevel@tonic-gate #ifdef __cplusplus 370Sstevel@tonic-gate extern "C" { 380Sstevel@tonic-gate #endif 390Sstevel@tonic-gate 400Sstevel@tonic-gate #define ND_BASE ('N' << 8) /* base */ 410Sstevel@tonic-gate #define ND_GET (ND_BASE + 0) /* Get a value */ 420Sstevel@tonic-gate #define ND_SET (ND_BASE + 1) /* Set a value */ 430Sstevel@tonic-gate 440Sstevel@tonic-gate #ifdef _KERNEL 450Sstevel@tonic-gate /* ND callback function prototypes */ 460Sstevel@tonic-gate typedef int (*ndgetf_t)(queue_t *, MBLKP, caddr_t, cred_t *); 470Sstevel@tonic-gate typedef int (*ndsetf_t)(queue_t *, MBLKP, char *, caddr_t, cred_t *); 480Sstevel@tonic-gate 490Sstevel@tonic-gate /* Named dispatch table entry */ 500Sstevel@tonic-gate typedef struct nde_s { 510Sstevel@tonic-gate char *nde_name; 520Sstevel@tonic-gate pfi_t nde_get_pfi; 530Sstevel@tonic-gate pfi_t nde_set_pfi; 540Sstevel@tonic-gate caddr_t nde_data; 550Sstevel@tonic-gate } NDE; 560Sstevel@tonic-gate 570Sstevel@tonic-gate /* Name dispatch table */ 580Sstevel@tonic-gate typedef struct nd_s { 590Sstevel@tonic-gate int nd_free_count; /* number of unused nd table entries */ 600Sstevel@tonic-gate int nd_size; /* size (in bytes) of current table */ 610Sstevel@tonic-gate NDE *nd_tbl; /* pointer to table in heap */ 620Sstevel@tonic-gate } ND; 630Sstevel@tonic-gate 640Sstevel@tonic-gate #define NDE_ALLOC_COUNT 32 650Sstevel@tonic-gate #define NDE_ALLOC_SIZE (sizeof (NDE) * NDE_ALLOC_COUNT) 660Sstevel@tonic-gate 670Sstevel@tonic-gate /* 64K STREAM limit - the max ndd info header. */ 680Sstevel@tonic-gate #define ND_MAX_BUF_LEN 65303 690Sstevel@tonic-gate 700Sstevel@tonic-gate /* 710Sstevel@tonic-gate * See uts/common/inet/nd.c for comments on how to use these routines. 720Sstevel@tonic-gate */ 730Sstevel@tonic-gate extern boolean_t nd_load(caddr_t *, char *, ndgetf_t, ndsetf_t, caddr_t); 740Sstevel@tonic-gate extern void nd_unload(caddr_t *, char *); 750Sstevel@tonic-gate extern void nd_free(caddr_t *); 760Sstevel@tonic-gate extern int nd_getset(queue_t *, caddr_t, MBLKP); 770Sstevel@tonic-gate 780Sstevel@tonic-gate /* 790Sstevel@tonic-gate * Canned nd_get and nd_set routines for use with nd_load(). 800Sstevel@tonic-gate */ 810Sstevel@tonic-gate extern int nd_get_default(queue_t *, MBLKP, caddr_t, cred_t *); 820Sstevel@tonic-gate extern int nd_get_long(queue_t *, MBLKP, caddr_t, cred_t *); 830Sstevel@tonic-gate extern int nd_get_names(queue_t *, MBLKP, caddr_t, cred_t *); 840Sstevel@tonic-gate extern int nd_set_default(queue_t *, MBLKP, char *, caddr_t, cred_t *); 850Sstevel@tonic-gate extern int nd_set_long(queue_t *, MBLKP, char *, caddr_t, cred_t *); 860Sstevel@tonic-gate 870Sstevel@tonic-gate #endif /* _KERNEL */ 880Sstevel@tonic-gate 890Sstevel@tonic-gate #ifdef __cplusplus 900Sstevel@tonic-gate } 910Sstevel@tonic-gate #endif 920Sstevel@tonic-gate 930Sstevel@tonic-gate #endif /* _INET_ND_H */ 94