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 2015 Joyent, Inc. 14 */ 15 16 #ifndef _LIBVARPD_CLIENT_H 17 #define _LIBVARPD_CLIENT_H 18 19 /* 20 * varpd interfaces 21 */ 22 23 #include <sys/types.h> 24 #include <stdint.h> 25 #include <sys/mac.h> 26 #include <sys/overlay_target.h> 27 28 #ifdef __cplusplus 29 extern "C" { 30 #endif 31 32 typedef struct __varpd_client_handle varpd_client_handle_t; 33 typedef struct __varpd_client_prop_handle varpd_client_prop_handle_t; 34 35 typedef struct varpd_client_cache_entry { 36 struct ether_addr vcp_mac; 37 uint16_t vcp_flags; 38 struct in6_addr vcp_ip; 39 uint16_t vcp_port; 40 } varpd_client_cache_entry_t; 41 42 /* 43 * We just use the values from the kernel for now. 44 */ 45 #define LIBVARPD_PROP_SIZEMAX OVERLAY_PROP_SIZEMAX 46 #define LIBVARPD_PROP_NAMELEN OVERLAY_PROP_NAMELEN 47 48 extern int libvarpd_c_create(varpd_client_handle_t **, const char *); 49 extern void libvarpd_c_destroy(varpd_client_handle_t *); 50 extern int libvarpd_c_instance_create(varpd_client_handle_t *, datalink_id_t, 51 const char *, uint64_t *); 52 extern int libvarpd_c_instance_activate(varpd_client_handle_t *, uint64_t); 53 extern int libvarpd_c_instance_destroy(varpd_client_handle_t *, uint64_t); 54 55 extern int libvarpd_c_prop_nprops(varpd_client_handle_t *, uint64_t, uint_t *); 56 extern int libvarpd_c_prop_handle_alloc(varpd_client_handle_t *, uint64_t, 57 varpd_client_prop_handle_t **); 58 extern void libvarpd_c_prop_handle_free(varpd_client_prop_handle_t *); 59 extern int libvarpd_c_prop_info_fill(varpd_client_prop_handle_t *, uint_t); 60 extern int libvarpd_c_prop_info_fill_by_name(varpd_client_prop_handle_t *, 61 const char *); 62 extern int libvarpd_c_prop_info(varpd_client_prop_handle_t *, const char **, 63 uint_t *, uint_t *, const void **, uint32_t *, 64 const mac_propval_range_t **); 65 extern int libvarpd_c_prop_get(varpd_client_prop_handle_t *, void *, 66 uint32_t *); 67 extern int libvarpd_c_prop_set(varpd_client_prop_handle_t *, const void *, 68 uint32_t); 69 70 extern int libvarpd_c_instance_lookup(varpd_client_handle_t *, datalink_id_t, 71 uint64_t *); 72 extern int libvarpd_c_instance_target_mode(varpd_client_handle_t *, uint64_t, 73 uint_t *, uint_t *); 74 extern int libvarpd_c_instance_cache_flush(varpd_client_handle_t *, uint64_t); 75 extern int libvarpd_c_instance_cache_delete(varpd_client_handle_t *, uint64_t, 76 const struct ether_addr *); 77 extern int libvarpd_c_instance_cache_get(varpd_client_handle_t *, uint64_t, 78 const struct ether_addr *, varpd_client_cache_entry_t *); 79 extern int libvarpd_c_instance_cache_set(varpd_client_handle_t *, uint64_t, 80 const struct ether_addr *, const varpd_client_cache_entry_t *); 81 82 typedef int (*varpd_client_cache_f)(varpd_client_handle_t *, uint64_t, 83 const struct ether_addr *, const varpd_client_cache_entry_t *, void *); 84 extern int libvarpd_c_instance_cache_walk(varpd_client_handle_t *, uint64_t, 85 varpd_client_cache_f, void *); 86 87 88 #ifdef __cplusplus 89 } 90 #endif 91 92 #endif /* _LIBVARPD_CLIENT_H */ 93