xref: /titanic_50/usr/src/lib/libdladm/common/libdliptun.h (revision 2b24ab6b3865caeede9eeb9db6b83e1d89dcd1ea)
1*2b24ab6bSSebastien Roy /*
2*2b24ab6bSSebastien Roy  * CDDL HEADER START
3*2b24ab6bSSebastien Roy  *
4*2b24ab6bSSebastien Roy  * The contents of this file are subject to the terms of the
5*2b24ab6bSSebastien Roy  * Common Development and Distribution License (the "License").
6*2b24ab6bSSebastien Roy  * You may not use this file except in compliance with the License.
7*2b24ab6bSSebastien Roy  *
8*2b24ab6bSSebastien Roy  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*2b24ab6bSSebastien Roy  * or http://www.opensolaris.org/os/licensing.
10*2b24ab6bSSebastien Roy  * See the License for the specific language governing permissions
11*2b24ab6bSSebastien Roy  * and limitations under the License.
12*2b24ab6bSSebastien Roy  *
13*2b24ab6bSSebastien Roy  * When distributing Covered Code, include this CDDL HEADER in each
14*2b24ab6bSSebastien Roy  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*2b24ab6bSSebastien Roy  * If applicable, add the following below this CDDL HEADER, with the
16*2b24ab6bSSebastien Roy  * fields enclosed by brackets "[]" replaced with your own identifying
17*2b24ab6bSSebastien Roy  * information: Portions Copyright [yyyy] [name of copyright owner]
18*2b24ab6bSSebastien Roy  *
19*2b24ab6bSSebastien Roy  * CDDL HEADER END
20*2b24ab6bSSebastien Roy  */
21*2b24ab6bSSebastien Roy /*
22*2b24ab6bSSebastien Roy  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23*2b24ab6bSSebastien Roy  * Use is subject to license terms.
24*2b24ab6bSSebastien Roy  */
25*2b24ab6bSSebastien Roy 
26*2b24ab6bSSebastien Roy #ifndef _LIBDLIPTUN_H
27*2b24ab6bSSebastien Roy #define	_LIBDLIPTUN_H
28*2b24ab6bSSebastien Roy 
29*2b24ab6bSSebastien Roy #include <netdb.h>
30*2b24ab6bSSebastien Roy #include <sys/types.h>
31*2b24ab6bSSebastien Roy #include <netinet/in.h>
32*2b24ab6bSSebastien Roy #include <inet/iptun.h>
33*2b24ab6bSSebastien Roy #include <libdladm.h>
34*2b24ab6bSSebastien Roy 
35*2b24ab6bSSebastien Roy #ifdef	__cplusplus
36*2b24ab6bSSebastien Roy extern "C" {
37*2b24ab6bSSebastien Roy #endif
38*2b24ab6bSSebastien Roy 
39*2b24ab6bSSebastien Roy typedef struct iptun_params {
40*2b24ab6bSSebastien Roy 	datalink_id_t	iptun_param_linkid;
41*2b24ab6bSSebastien Roy 	uint_t		iptun_param_flags;
42*2b24ab6bSSebastien Roy 	iptun_type_t	iptun_param_type;
43*2b24ab6bSSebastien Roy 	char		iptun_param_laddr[NI_MAXHOST];	/* local address */
44*2b24ab6bSSebastien Roy 	char		iptun_param_raddr[NI_MAXHOST];	/* remote address */
45*2b24ab6bSSebastien Roy 	ipsec_req_t	iptun_param_secinfo;
46*2b24ab6bSSebastien Roy } iptun_params_t;
47*2b24ab6bSSebastien Roy 
48*2b24ab6bSSebastien Roy /* iptun_param_flags */
49*2b24ab6bSSebastien Roy #define	IPTUN_PARAM_TYPE	0x00000001 /* itp_type is set */
50*2b24ab6bSSebastien Roy #define	IPTUN_PARAM_LADDR	0x00000002 /* itp_laddr is set */
51*2b24ab6bSSebastien Roy #define	IPTUN_PARAM_RADDR	0x00000004 /* itp_raddr is set */
52*2b24ab6bSSebastien Roy #define	IPTUN_PARAM_SECINFO	0x00000008 /* itp_secinfo is set */
53*2b24ab6bSSebastien Roy #define	IPTUN_PARAM_IMPLICIT	0x00000010 /* implicitly created IP tunnel */
54*2b24ab6bSSebastien Roy #define	IPTUN_PARAM_IPSECPOL	0x00000020 /* IPsec policy exists */
55*2b24ab6bSSebastien Roy 
56*2b24ab6bSSebastien Roy extern dladm_status_t	dladm_iptun_create(dladm_handle_t, const char *,
57*2b24ab6bSSebastien Roy     iptun_params_t *, uint_t);
58*2b24ab6bSSebastien Roy extern dladm_status_t	dladm_iptun_delete(dladm_handle_t, datalink_id_t,
59*2b24ab6bSSebastien Roy     uint_t);
60*2b24ab6bSSebastien Roy extern dladm_status_t	dladm_iptun_modify(dladm_handle_t,
61*2b24ab6bSSebastien Roy     const iptun_params_t *, uint_t);
62*2b24ab6bSSebastien Roy extern dladm_status_t	dladm_iptun_getparams(dladm_handle_t, iptun_params_t *,
63*2b24ab6bSSebastien Roy     uint_t);
64*2b24ab6bSSebastien Roy extern dladm_status_t	dladm_iptun_up(dladm_handle_t, datalink_id_t);
65*2b24ab6bSSebastien Roy extern dladm_status_t	dladm_iptun_down(dladm_handle_t, datalink_id_t);
66*2b24ab6bSSebastien Roy extern dladm_status_t	dladm_iptun_set6to4relay(dladm_handle_t,
67*2b24ab6bSSebastien Roy     struct in_addr *);
68*2b24ab6bSSebastien Roy extern dladm_status_t	dladm_iptun_get6to4relay(dladm_handle_t,
69*2b24ab6bSSebastien Roy     struct in_addr *);
70*2b24ab6bSSebastien Roy 
71*2b24ab6bSSebastien Roy #ifdef	__cplusplus
72*2b24ab6bSSebastien Roy }
73*2b24ab6bSSebastien Roy #endif
74*2b24ab6bSSebastien Roy 
75*2b24ab6bSSebastien Roy #endif	/* _LIBDLIPTUN_H */
76