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