xref: /titanic_50/usr/src/lib/libdscp/libdscp.h (revision ac92251dc182f030faf6a5f76981d551b0b16072)
125cf1a30Sjl139090 /*
225cf1a30Sjl139090  * CDDL HEADER START
325cf1a30Sjl139090  *
425cf1a30Sjl139090  * The contents of this file are subject to the terms of the
525cf1a30Sjl139090  * Common Development and Distribution License (the "License").
625cf1a30Sjl139090  * You may not use this file except in compliance with the License.
725cf1a30Sjl139090  *
825cf1a30Sjl139090  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
925cf1a30Sjl139090  * or http://www.opensolaris.org/os/licensing.
1025cf1a30Sjl139090  * See the License for the specific language governing permissions
1125cf1a30Sjl139090  * and limitations under the License.
1225cf1a30Sjl139090  *
1325cf1a30Sjl139090  * When distributing Covered Code, include this CDDL HEADER in each
1425cf1a30Sjl139090  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1525cf1a30Sjl139090  * If applicable, add the following below this CDDL HEADER, with the
1625cf1a30Sjl139090  * fields enclosed by brackets "[]" replaced with your own identifying
1725cf1a30Sjl139090  * information: Portions Copyright [yyyy] [name of copyright owner]
1825cf1a30Sjl139090  *
1925cf1a30Sjl139090  * CDDL HEADER END
2025cf1a30Sjl139090  */
2125cf1a30Sjl139090 /*
2225cf1a30Sjl139090  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
2325cf1a30Sjl139090  * Use is subject to license terms.
2425cf1a30Sjl139090  */
2525cf1a30Sjl139090 
2625cf1a30Sjl139090 #ifndef	_LIBDSCP_H
2725cf1a30Sjl139090 #define	_LIBDSCP_H
2825cf1a30Sjl139090 
2925cf1a30Sjl139090 #pragma ident	"%Z%%M%	%I%	%E% SMI"
3025cf1a30Sjl139090 
3125cf1a30Sjl139090 #include <sys/socket.h>
3225cf1a30Sjl139090 #include <netinet/in.h>
3325cf1a30Sjl139090 
3425cf1a30Sjl139090 #ifdef __cplusplus
3525cf1a30Sjl139090 extern "C" {
3625cf1a30Sjl139090 #endif
3725cf1a30Sjl139090 
3825cf1a30Sjl139090 /*
3925cf1a30Sjl139090  * DSCP Error Codes
4025cf1a30Sjl139090  */
4125cf1a30Sjl139090 typedef enum {
4225cf1a30Sjl139090 	DSCP_OK = 0,		/* Success */
4325cf1a30Sjl139090 	DSCP_ERROR,		/* General Error */
4425cf1a30Sjl139090 	DSCP_ERROR_ALREADY,	/* Socket Already Bound */
4525cf1a30Sjl139090 	DSCP_ERROR_INVALID,	/* Invalid Arguments */
4625cf1a30Sjl139090 	DSCP_ERROR_NOENT,	/* Lookup Failure From dscpIdent() */
4725cf1a30Sjl139090 	DSCP_ERROR_DB,		/* Error Reading Database */
48*ac92251dSjrutt 	DSCP_ERROR_REJECT,	/* Rejection From dscpAuth() */
49*ac92251dSjrutt 	DSCP_ERROR_DOWN		/* DSCP Interface down */
5025cf1a30Sjl139090 } dscp_err_t;
5125cf1a30Sjl139090 
5225cf1a30Sjl139090 /*
5325cf1a30Sjl139090  * Possible values for the 'which' parameter to dscpAddr().
5425cf1a30Sjl139090  */
5525cf1a30Sjl139090 #define	DSCP_ADDR_LOCAL		(1)	/* Get the domain's local IP address */
5625cf1a30Sjl139090 #define	DSCP_ADDR_REMOTE	(2)	/* Get the SP's remote IP address */
5725cf1a30Sjl139090 
5825cf1a30Sjl139090 /*
5925cf1a30Sjl139090  * Define a special value used to represent the SP as a domain ID.
6025cf1a30Sjl139090  */
6125cf1a30Sjl139090 #define	DSCP_IDENT_SP		(-1)
6225cf1a30Sjl139090 
6325cf1a30Sjl139090 int	dscpBind(int domain, int sockfd, int port);
6425cf1a30Sjl139090 int	dscpSecure(int domain, int sockfd);
6525cf1a30Sjl139090 int	dscpAuth(int domain, struct sockaddr *saddr, int len);
6625cf1a30Sjl139090 int	dscpAddr(int domain, int which, struct sockaddr *saddr, int *lenp);
6725cf1a30Sjl139090 int	dscpIdent(struct sockaddr *saddr, int len, int *domainp);
6825cf1a30Sjl139090 
6925cf1a30Sjl139090 #ifdef __cplusplus
7025cf1a30Sjl139090 }
7125cf1a30Sjl139090 #endif
7225cf1a30Sjl139090 
7325cf1a30Sjl139090 #endif	/* _LIBDSCP_H */
74