xref: /onnv-gate/usr/src/lib/libdscp/libdscp.h (revision 3047:d261ab7efc22)
11772Sjl139090 /*
21772Sjl139090  * CDDL HEADER START
31772Sjl139090  *
41772Sjl139090  * The contents of this file are subject to the terms of the
51772Sjl139090  * Common Development and Distribution License (the "License").
61772Sjl139090  * You may not use this file except in compliance with the License.
71772Sjl139090  *
81772Sjl139090  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91772Sjl139090  * or http://www.opensolaris.org/os/licensing.
101772Sjl139090  * See the License for the specific language governing permissions
111772Sjl139090  * and limitations under the License.
121772Sjl139090  *
131772Sjl139090  * When distributing Covered Code, include this CDDL HEADER in each
141772Sjl139090  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151772Sjl139090  * If applicable, add the following below this CDDL HEADER, with the
161772Sjl139090  * fields enclosed by brackets "[]" replaced with your own identifying
171772Sjl139090  * information: Portions Copyright [yyyy] [name of copyright owner]
181772Sjl139090  *
191772Sjl139090  * CDDL HEADER END
201772Sjl139090  */
211772Sjl139090 /*
221772Sjl139090  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
231772Sjl139090  * Use is subject to license terms.
241772Sjl139090  */
251772Sjl139090 
261772Sjl139090 #ifndef	_LIBDSCP_H
271772Sjl139090 #define	_LIBDSCP_H
281772Sjl139090 
291772Sjl139090 #pragma ident	"%Z%%M%	%I%	%E% SMI"
301772Sjl139090 
311772Sjl139090 #include <sys/socket.h>
321772Sjl139090 #include <netinet/in.h>
331772Sjl139090 
341772Sjl139090 #ifdef __cplusplus
351772Sjl139090 extern "C" {
361772Sjl139090 #endif
371772Sjl139090 
381772Sjl139090 /*
391772Sjl139090  * DSCP Error Codes
401772Sjl139090  */
411772Sjl139090 typedef enum {
421772Sjl139090 	DSCP_OK = 0,		/* Success */
431772Sjl139090 	DSCP_ERROR,		/* General Error */
441772Sjl139090 	DSCP_ERROR_ALREADY,	/* Socket Already Bound */
451772Sjl139090 	DSCP_ERROR_INVALID,	/* Invalid Arguments */
461772Sjl139090 	DSCP_ERROR_NOENT,	/* Lookup Failure From dscpIdent() */
471772Sjl139090 	DSCP_ERROR_DB,		/* Error Reading Database */
48*3047Sjrutt 	DSCP_ERROR_REJECT,	/* Rejection From dscpAuth() */
49*3047Sjrutt 	DSCP_ERROR_DOWN		/* DSCP Interface down */
501772Sjl139090 } dscp_err_t;
511772Sjl139090 
521772Sjl139090 /*
531772Sjl139090  * Possible values for the 'which' parameter to dscpAddr().
541772Sjl139090  */
551772Sjl139090 #define	DSCP_ADDR_LOCAL		(1)	/* Get the domain's local IP address */
561772Sjl139090 #define	DSCP_ADDR_REMOTE	(2)	/* Get the SP's remote IP address */
571772Sjl139090 
581772Sjl139090 /*
591772Sjl139090  * Define a special value used to represent the SP as a domain ID.
601772Sjl139090  */
611772Sjl139090 #define	DSCP_IDENT_SP		(-1)
621772Sjl139090 
631772Sjl139090 int	dscpBind(int domain, int sockfd, int port);
641772Sjl139090 int	dscpSecure(int domain, int sockfd);
651772Sjl139090 int	dscpAuth(int domain, struct sockaddr *saddr, int len);
661772Sjl139090 int	dscpAddr(int domain, int which, struct sockaddr *saddr, int *lenp);
671772Sjl139090 int	dscpIdent(struct sockaddr *saddr, int len, int *domainp);
681772Sjl139090 
691772Sjl139090 #ifdef __cplusplus
701772Sjl139090 }
711772Sjl139090 #endif
721772Sjl139090 
731772Sjl139090 #endif	/* _LIBDSCP_H */
74