1 /* 2 * This file and its contents are supplied under the terms of the 3 * Common Development and Distribution License ("CDDL"), version 1.0. 4 * You may only use this file in accordance with the terms of version 5 * 1.0 of the CDDL. 6 * 7 * A full copy of the text of the CDDL should have accompanied this 8 * source. A copy of the CDDL is also available via the Internet at 9 * http://www.illumos.org/license/CDDL. 10 */ 11 12 /* 13 * Copyright (c) 2015 Joyent, Inc. 14 * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. 15 */ 16 17 #ifndef _LIBDLOVERLAY_H 18 #define _LIBDLOVERLAY_H 19 20 /* 21 * libdladm Overlay device routines 22 */ 23 24 #include <libdladm.h> 25 #include <libdladm_impl.h> 26 #include <sys/overlay.h> 27 28 #ifdef __cplusplus 29 extern "C" { 30 #endif 31 32 typedef struct dladm_overlay_attr { 33 datalink_id_t oa_linkid; 34 char oa_name[MAXLINKNAMELEN]; 35 char oa_encap[OVERLAY_PROP_SIZEMAX]; 36 char oa_search[OVERLAY_PROP_SIZEMAX]; 37 uint64_t oa_vid; 38 uint32_t oa_flags; 39 } dladm_overlay_attr_t; 40 41 #define DLADM_OVERLAY_F_DROP 0x0001 42 #define DLADM_OVERLAY_F_DEFAULT 0xf000 43 44 typedef struct dladm_overlay_point { 45 uint_t dop_dest; 46 struct ether_addr dop_mac; 47 uint16_t dop_flags; 48 struct in6_addr dop_ip; 49 uint16_t dop_port; 50 } dladm_overlay_point_t; 51 52 typedef struct dladm_overlay_status { 53 boolean_t dos_degraded; 54 char dos_fmamsg[256]; 55 } dladm_overlay_status_t; 56 57 extern dladm_status_t dladm_overlay_create(dladm_handle_t, const char *, 58 const char *, const char *, uint64_t, dladm_arg_list_t *, dladm_errlist_t *, 59 uint32_t); 60 extern dladm_status_t dladm_overlay_delete(dladm_handle_t, datalink_id_t, 61 uint32_t); 62 extern dladm_status_t dladm_overlay_up(dladm_handle_t, datalink_id_t, 63 dladm_errlist_t *); 64 65 typedef void (*dladm_overlay_status_f)(dladm_handle_t, datalink_id_t, 66 dladm_overlay_status_t *, void *); 67 extern dladm_status_t dladm_overlay_status(dladm_handle_t, datalink_id_t, 68 dladm_overlay_status_f, void *); 69 70 extern dladm_status_t dladm_overlay_cache_flush(dladm_handle_t, datalink_id_t); 71 extern dladm_status_t dladm_overlay_cache_delete(dladm_handle_t, datalink_id_t, 72 const struct ether_addr *); 73 extern dladm_status_t dladm_overlay_cache_set(dladm_handle_t, datalink_id_t, 74 const struct ether_addr *, char *); 75 extern dladm_status_t dladm_overlay_cache_get(dladm_handle_t, datalink_id_t, 76 const struct ether_addr *, dladm_overlay_point_t *); 77 78 #define DLADM_OVERLAY_PROP_SIZEMAX 256 79 #define DLADM_OVERLAY_PROP_NAMELEN 32 80 81 typedef struct __dladm_overlay_propinfo *dladm_overlay_propinfo_handle_t; 82 83 extern dladm_status_t dladm_overlay_prop_info(dladm_overlay_propinfo_handle_t, 84 const char **, uint_t *, uint_t *, const void **, uint32_t *, 85 const mac_propval_range_t **); 86 extern dladm_status_t dladm_overlay_get_prop(dladm_handle_t, datalink_id_t, 87 dladm_overlay_propinfo_handle_t, void *buf, size_t *bufsize); 88 89 typedef int (*dladm_overlay_prop_f)(dladm_handle_t, datalink_id_t, 90 dladm_overlay_propinfo_handle_t, void *); 91 extern dladm_status_t dladm_overlay_walk_prop(dladm_handle_t, datalink_id_t, 92 dladm_overlay_prop_f, void *arg, dladm_errlist_t *); 93 94 typedef int (*dladm_overlay_cache_f)(dladm_handle_t, datalink_id_t, 95 const struct ether_addr *, const dladm_overlay_point_t *, void *); 96 extern dladm_status_t dladm_overlay_walk_cache(dladm_handle_t, datalink_id_t, 97 dladm_overlay_cache_f, void *); 98 99 /* 100 * Some day we'll want to support being able to set properties after creation. 101 * If we do, the following strawman API might serve us well. 102 * 103 * extern dladm_status_t dladm_overlay_prop_lookup(dladm_handle_t, 104 * datalink_id_t, const char *, dladm_overlay_propinfo_handle_t *); 105 * extern void dladm_overlay_prop_handle_free(dladm_handle_t, datalink_id_t, 106 * dladm_overlay_propinfo_handle_t *); 107 * extern dladm_status_t dladm_overlay_set_prop(dladm_handle_t, datalink_id_t, 108 * dladm_propinfo_handle_t, void *buf, size_t *bufsize); 109 * extern dladm_status_t dladm_overlay_str_to_buf(dladm_handle_t, datalink_id_t, 110 * dladm_overlay_propinfo_handle_t *, const char *, void *, size_t *); 111 * extern dladm_status_t dladm_overlay_buf_to_str(dladm_handle_t, datalink_id_t, 112 * dladm_overlay_propinfo_handle_t *, const void *, const size_t, char *, 113 * size_t *); 114 */ 115 116 #ifdef __cplusplus 117 } 118 #endif 119 120 #endif /* _LIBDLOVERLAY_H */ 121