xref: /titanic_51/usr/src/lib/libdscp/libdscp.h (revision 25cf1a301a396c38e8adf52c15f537b80d2483f7)
1*25cf1a30Sjl139090 /*
2*25cf1a30Sjl139090  * CDDL HEADER START
3*25cf1a30Sjl139090  *
4*25cf1a30Sjl139090  * The contents of this file are subject to the terms of the
5*25cf1a30Sjl139090  * Common Development and Distribution License (the "License").
6*25cf1a30Sjl139090  * You may not use this file except in compliance with the License.
7*25cf1a30Sjl139090  *
8*25cf1a30Sjl139090  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*25cf1a30Sjl139090  * or http://www.opensolaris.org/os/licensing.
10*25cf1a30Sjl139090  * See the License for the specific language governing permissions
11*25cf1a30Sjl139090  * and limitations under the License.
12*25cf1a30Sjl139090  *
13*25cf1a30Sjl139090  * When distributing Covered Code, include this CDDL HEADER in each
14*25cf1a30Sjl139090  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*25cf1a30Sjl139090  * If applicable, add the following below this CDDL HEADER, with the
16*25cf1a30Sjl139090  * fields enclosed by brackets "[]" replaced with your own identifying
17*25cf1a30Sjl139090  * information: Portions Copyright [yyyy] [name of copyright owner]
18*25cf1a30Sjl139090  *
19*25cf1a30Sjl139090  * CDDL HEADER END
20*25cf1a30Sjl139090  */
21*25cf1a30Sjl139090 /*
22*25cf1a30Sjl139090  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*25cf1a30Sjl139090  * Use is subject to license terms.
24*25cf1a30Sjl139090  */
25*25cf1a30Sjl139090 
26*25cf1a30Sjl139090 #ifndef	_LIBDSCP_H
27*25cf1a30Sjl139090 #define	_LIBDSCP_H
28*25cf1a30Sjl139090 
29*25cf1a30Sjl139090 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*25cf1a30Sjl139090 
31*25cf1a30Sjl139090 #include <sys/socket.h>
32*25cf1a30Sjl139090 #include <netinet/in.h>
33*25cf1a30Sjl139090 
34*25cf1a30Sjl139090 #ifdef __cplusplus
35*25cf1a30Sjl139090 extern "C" {
36*25cf1a30Sjl139090 #endif
37*25cf1a30Sjl139090 
38*25cf1a30Sjl139090 /*
39*25cf1a30Sjl139090  * DSCP Error Codes
40*25cf1a30Sjl139090  */
41*25cf1a30Sjl139090 typedef enum {
42*25cf1a30Sjl139090 	DSCP_OK = 0,		/* Success */
43*25cf1a30Sjl139090 	DSCP_ERROR,		/* General Error */
44*25cf1a30Sjl139090 	DSCP_ERROR_ALREADY,	/* Socket Already Bound */
45*25cf1a30Sjl139090 	DSCP_ERROR_INVALID,	/* Invalid Arguments */
46*25cf1a30Sjl139090 	DSCP_ERROR_NOENT,	/* Lookup Failure From dscpIdent() */
47*25cf1a30Sjl139090 	DSCP_ERROR_DB,		/* Error Reading Database */
48*25cf1a30Sjl139090 	DSCP_ERROR_REJECT	/* Rejection From dscpAuth() */
49*25cf1a30Sjl139090 } dscp_err_t;
50*25cf1a30Sjl139090 
51*25cf1a30Sjl139090 /*
52*25cf1a30Sjl139090  * Possible values for the 'which' parameter to dscpAddr().
53*25cf1a30Sjl139090  */
54*25cf1a30Sjl139090 #define	DSCP_ADDR_LOCAL		(1)	/* Get the domain's local IP address */
55*25cf1a30Sjl139090 #define	DSCP_ADDR_REMOTE	(2)	/* Get the SP's remote IP address */
56*25cf1a30Sjl139090 
57*25cf1a30Sjl139090 /*
58*25cf1a30Sjl139090  * Define a special value used to represent the SP as a domain ID.
59*25cf1a30Sjl139090  */
60*25cf1a30Sjl139090 #define	DSCP_IDENT_SP		(-1)
61*25cf1a30Sjl139090 
62*25cf1a30Sjl139090 int	dscpBind(int domain, int sockfd, int port);
63*25cf1a30Sjl139090 int	dscpSecure(int domain, int sockfd);
64*25cf1a30Sjl139090 int	dscpAuth(int domain, struct sockaddr *saddr, int len);
65*25cf1a30Sjl139090 int	dscpAddr(int domain, int which, struct sockaddr *saddr, int *lenp);
66*25cf1a30Sjl139090 int	dscpIdent(struct sockaddr *saddr, int len, int *domainp);
67*25cf1a30Sjl139090 
68*25cf1a30Sjl139090 #ifdef __cplusplus
69*25cf1a30Sjl139090 }
70*25cf1a30Sjl139090 #endif
71*25cf1a30Sjl139090 
72*25cf1a30Sjl139090 #endif	/* _LIBDSCP_H */
73